diff --git a/README.rst b/README.rst index 6d9aa2b6..9febfdd6 100644 --- a/README.rst +++ b/README.rst @@ -122,6 +122,13 @@ method: amadeus.get('/v2/reference-data/urls/checkin-links', airlineCode='BA') +Or with ``POST`` using ``.client.post`` method: + +.. code:: py + + amadeus.post('/v1/shopping/flight-offers/pricing', data) + + Response -------- @@ -232,7 +239,7 @@ List of supported endpoints amadeus.travel.analytics.air_traffic.searched.get(originCityCode='MAD', marketCountryCode='ES', searchPeriod='2017-08') # How many people in Spain searched for a trip from Madrid to New-York in September 2017? amadeus.travel.analytics.air_traffic.searched_by_destination.get(originCityCode='MAD', destinationCityCode='NYC', marketCountryCode='ES', searchPeriod='2017-08') - + # Flight Most Booked Destinations amadeus.travel.analytics.air_traffic.booked.get(originCityCode='MAD', period='2017-08') @@ -249,7 +256,11 @@ List of supported endpoints amadeus.shopping.hotel_offers_by_hotel.get(hotelId = 'IALONCHO') # Confirm the availability of a specific offer amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get() - + + # Hotel Ratings + # What travelers think about this hotel? + amadeus.e_reputation.hotel_sentiments.get(hotelIds = 'ADNYCCTB') + # Point of Interest # What are the popular places in Barcelona (based a geo location and a radius) amadeus.reference_data.locations.points_of_interest.get(latitude=41.397158, longitude=2.160873) diff --git a/amadeus/e_reputation/__init__.py b/amadeus/e_reputation/__init__.py new file mode 100644 index 00000000..455834d6 --- /dev/null +++ b/amadeus/e_reputation/__init__.py @@ -0,0 +1,3 @@ +from ._hotel_sentiments import HotelSentiments + +__all__ = ['HotelSentiments'] diff --git a/amadeus/e_reputation/_hotel_sentiments.py b/amadeus/e_reputation/_hotel_sentiments.py new file mode 100644 index 00000000..ee520d01 --- /dev/null +++ b/amadeus/e_reputation/_hotel_sentiments.py @@ -0,0 +1,20 @@ +from amadeus.client.decorator import Decorator + + +class HotelSentiments(Decorator, object): + def get(self, **params): + ''' + Provides ratings and sentiments scores for hotels + + .. code-block:: python + + amadeus.e_reputation.hotel_sentiments.get(hotelIds='TELONMFS,ADNYCCTB']) + + :param hotelIds: comma separated string list of amadeus hotel Ids (max + 3). These Ids are found in the Hotel Search response. ``"RDLON308"``, + for example for the Radisson Blu Hampshire hotel. + + :rtype: amadeus.Response + :raises amadeus.ResponseError: if the request could not be completed + ''' + return self.client.get('/v2/e-reputation/hotel-sentiments', **params) diff --git a/amadeus/namespaces/_e_reputation.py b/amadeus/namespaces/_e_reputation.py new file mode 100644 index 00000000..cde26dce --- /dev/null +++ b/amadeus/namespaces/_e_reputation.py @@ -0,0 +1,8 @@ +from amadeus.client.decorator import Decorator +from amadeus.e_reputation._hotel_sentiments import HotelSentiments + + +class EReputation(Decorator, object): + def __init__(self, client): + Decorator.__init__(self, client) + self.hotel_sentiments = HotelSentiments(client) diff --git a/amadeus/namespaces/core.py b/amadeus/namespaces/core.py index 0c9bd8de..f6a013ed 100644 --- a/amadeus/namespaces/core.py +++ b/amadeus/namespaces/core.py @@ -1,6 +1,7 @@ from amadeus.namespaces._reference_data import ReferenceData from amadeus.namespaces._travel import Travel from amadeus.namespaces._shopping import Shopping +from amadeus.namespaces._e_reputation import EReputation class Core(object): @@ -8,3 +9,4 @@ def __init__(self): self.reference_data = ReferenceData(self) self.travel = Travel(self) self.shopping = Shopping(self) + self.e_reputation = EReputation(self) diff --git a/specs/namespaces/namespaces_spec.py b/specs/namespaces/namespaces_spec.py index fd6a401c..699a4b2d 100644 --- a/specs/namespaces/namespaces_spec.py +++ b/specs/namespaces/namespaces_spec.py @@ -47,6 +47,8 @@ expect(client.shopping.hotel_offer).not_to(be_none) expect(client.shopping.hotel_offers_by_hotel).not_to(be_none) + expect(client.e_reputation.hotel_sentiments).not_to(be_none) + with it('should define all expected .get methods'): client = self.client expect(client.reference_data.urls.checkin_links.get).not_to(be_none) @@ -81,6 +83,8 @@ expect(client.shopping.hotel_offers_by_hotel.get).not_to(be_none) expect(client.shopping.hotel_offer('123').get).not_to(be_none) + expect(client.e_reputation.hotel_sentiments.get).not_to(be_none) + with context('testing all calls to the client'): with before.each: self.client.get = method_returning(None) @@ -202,3 +206,9 @@ expect(self.client.get).to(have_been_called_with( '/v2/shopping/hotel-offers/XXX', a='b' )) + + with it('.e_reputation.hotel_sentiments.get'): + self.client.e_reputation.hotel_sentiments.get(hotelIds='XKPARC12') + expect(self.client.get).to(have_been_called_with( + '/v2/e-reputation/hotel-sentiments', hotelIds='XKPARC12' + ))