Skip to content

Commit d680c33

Browse files
author
Alvaro Navarro
authored
Merge pull request #46 from alnacle/feature/hotel-ratings
Add Hotel Ratings API
2 parents 7c00e22 + dd921f8 commit d680c33

File tree

6 files changed

+56
-2
lines changed

6 files changed

+56
-2
lines changed

README.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ method:
122122
123123
amadeus.get('/v2/reference-data/urls/checkin-links', airlineCode='BA')
124124
125+
Or with ``POST`` using ``.client.post`` method:
126+
127+
.. code:: py
128+
129+
amadeus.post('/v1/shopping/flight-offers/pricing', data)
130+
131+
125132
Response
126133
--------
127134

@@ -232,7 +239,7 @@ List of supported endpoints
232239
amadeus.travel.analytics.air_traffic.searched.get(originCityCode='MAD', marketCountryCode='ES', searchPeriod='2017-08')
233240
# How many people in Spain searched for a trip from Madrid to New-York in September 2017?
234241
amadeus.travel.analytics.air_traffic.searched_by_destination.get(originCityCode='MAD', destinationCityCode='NYC', marketCountryCode='ES', searchPeriod='2017-08')
235-
242+
236243
# Flight Most Booked Destinations
237244
amadeus.travel.analytics.air_traffic.booked.get(originCityCode='MAD', period='2017-08')
238245
@@ -249,7 +256,11 @@ List of supported endpoints
249256
amadeus.shopping.hotel_offers_by_hotel.get(hotelId = 'IALONCHO')
250257
# Confirm the availability of a specific offer
251258
amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get()
252-
259+
260+
# Hotel Ratings
261+
# What travelers think about this hotel?
262+
amadeus.e_reputation.hotel_sentiments.get(hotelIds = 'ADNYCCTB')
263+
253264
# Point of Interest
254265
# What are the popular places in Barcelona (based a geo location and a radius)
255266
amadeus.reference_data.locations.points_of_interest.get(latitude=41.397158, longitude=2.160873)

amadeus/e_reputation/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from ._hotel_sentiments import HotelSentiments
2+
3+
__all__ = ['HotelSentiments']
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class HotelSentiments(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Provides ratings and sentiments scores for hotels
8+
9+
.. code-block:: python
10+
11+
amadeus.e_reputation.hotel_sentiments.get(hotelIds='TELONMFS,ADNYCCTB'])
12+
13+
:param hotelIds: comma separated string list of amadeus hotel Ids (max
14+
3). These Ids are found in the Hotel Search response. ``"RDLON308"``,
15+
for example for the Radisson Blu Hampshire hotel.
16+
17+
:rtype: amadeus.Response
18+
:raises amadeus.ResponseError: if the request could not be completed
19+
'''
20+
return self.client.get('/v2/e-reputation/hotel-sentiments', **params)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from amadeus.client.decorator import Decorator
2+
from amadeus.e_reputation._hotel_sentiments import HotelSentiments
3+
4+
5+
class EReputation(Decorator, object):
6+
def __init__(self, client):
7+
Decorator.__init__(self, client)
8+
self.hotel_sentiments = HotelSentiments(client)

amadeus/namespaces/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from amadeus.namespaces._reference_data import ReferenceData
22
from amadeus.namespaces._travel import Travel
33
from amadeus.namespaces._shopping import Shopping
4+
from amadeus.namespaces._e_reputation import EReputation
45

56

67
class Core(object):
78
def __init__(self):
89
self.reference_data = ReferenceData(self)
910
self.travel = Travel(self)
1011
self.shopping = Shopping(self)
12+
self.e_reputation = EReputation(self)

specs/namespaces/namespaces_spec.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
expect(client.shopping.hotel_offer).not_to(be_none)
4848
expect(client.shopping.hotel_offers_by_hotel).not_to(be_none)
4949

50+
expect(client.e_reputation.hotel_sentiments).not_to(be_none)
51+
5052
with it('should define all expected .get methods'):
5153
client = self.client
5254
expect(client.reference_data.urls.checkin_links.get).not_to(be_none)
@@ -81,6 +83,8 @@
8183
expect(client.shopping.hotel_offers_by_hotel.get).not_to(be_none)
8284
expect(client.shopping.hotel_offer('123').get).not_to(be_none)
8385

86+
expect(client.e_reputation.hotel_sentiments.get).not_to(be_none)
87+
8488
with context('testing all calls to the client'):
8589
with before.each:
8690
self.client.get = method_returning(None)
@@ -202,3 +206,9 @@
202206
expect(self.client.get).to(have_been_called_with(
203207
'/v2/shopping/hotel-offers/XXX', a='b'
204208
))
209+
210+
with it('.e_reputation.hotel_sentiments.get'):
211+
self.client.e_reputation.hotel_sentiments.get(hotelIds='XKPARC12')
212+
expect(self.client.get).to(have_been_called_with(
213+
'/v2/e-reputation/hotel-sentiments', hotelIds='XKPARC12'
214+
))

0 commit comments

Comments
 (0)