Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------

Expand Down Expand Up @@ -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')

Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions amadeus/e_reputation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._hotel_sentiments import HotelSentiments

__all__ = ['HotelSentiments']
20 changes: 20 additions & 0 deletions amadeus/e_reputation/_hotel_sentiments.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions amadeus/namespaces/_e_reputation.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions amadeus/namespaces/core.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
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):
def __init__(self):
self.reference_data = ReferenceData(self)
self.travel = Travel(self)
self.shopping = Shopping(self)
self.e_reputation = EReputation(self)
10 changes: 10 additions & 0 deletions specs/namespaces/namespaces_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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'
))