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
14 changes: 12 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ List of supported endpoints
# The flight ID comes from the Flight Create Orders (in test environment it's temporary)
flight_booking = amadeus.booking.flight_orders.post(body).data
amadeus.booking.flight_order(flight_booking['id']).get()


# Flight SeatMap Display GET
amadeus.shopping.seatmaps.get(**{"flight-orderId": "orderid"})
# Flight SeatMap Display POST
amadeus.shopping.seatmaps.post(body)

# Flight Low-fare Search
amadeus.shopping.flight_offers.get(origin='MAD', destination='NYC', departureDate='2020-06-01')

Expand Down Expand Up @@ -259,7 +264,7 @@ List of supported endpoints

# Flight Busiest Travel Period
amadeus.travel.analytics.air_traffic.busiest_period.get(cityCode='MAD', period='2017', direction='ARRIVING')

# Hotel Search
# Get list of Hotels by city code
amadeus.shopping.hotel_offers.get(cityCode = 'LON')
Expand Down Expand Up @@ -307,6 +312,11 @@ List of supported endpoints
# Get the result of the process by jobId
amadeus.travel.trip_parser_jobs.result(response.data['id']).get()

# Flight Offers Search GET
amadeus.shopping.flight_offers_search.get(originLocationCode='SYD', destinationLocationCode='BKK', departureDate='2020-05-01', adults=1)
# Flight Offers Search POST
amadeus.shopping.flight_offers_search.post(body)

Development & Contributing
--------------------------

Expand Down
2 changes: 2 additions & 0 deletions amadeus/namespaces/_shopping.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from amadeus.shopping._hotel_offers import HotelOffers
from amadeus.shopping._hotel_offers_by_hotel import HotelOffersByHotel
from amadeus.shopping._hotel_offer import HotelOffer
from amadeus.shopping._seatmaps import Seatmaps


class Shopping(Decorator, object):
Expand All @@ -17,6 +18,7 @@ def __init__(self, client):
self.hotel_offers = HotelOffers(client)
self.hotel_offers_by_hotel = HotelOffersByHotel(client)
self.flight_offers_search = FlightOffersSearch(client)
self.seatmaps = Seatmaps(client)

def hotel_offer(self, offer_id):
return HotelOffer(self.client, offer_id)
Expand Down
39 changes: 39 additions & 0 deletions amadeus/shopping/_seatmaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from amadeus.client.decorator import Decorator


class Seatmaps(Decorator, object):
def get(self, **params):
'''
Allows you to retrieve the seat map of one or several flights based
on the flight-orderId returned from Flight Create Orders API Call.

.. code-block:: python

amadeus.shopping.seatmaps.get(
flight-orderId='<order_id>'
)

:param flight-orderId: identifier of the order.
Either a flight offer or a flight order Id.

:rtype: amadeus.Response
:raises amadeus.ResponseError: if the request could not be completed
'''
return self.client.get('/v1/shopping/seatmaps', **params)

def post(self, body):
'''
Allows you to retrieve the seat map of one or several flights.
Take the body of a flight offer search or flight offer price
and pass it in to this method to get a seatmap

.. code-block:: python

amadeus.shopping.seatmaps.post(body)

:param body: the parameters to send to the API

:rtype: amadeus.Response
:raises amadeus.ResponseError: if the request could not be completed
'''
return self.client.post('/v1/shopping/seatmaps', body)
16 changes: 16 additions & 0 deletions specs/namespaces/namespaces_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
expect(client.shopping.flight_offers_search).not_to(be_none)
expect(client.shopping.flight_offers.pricing).not_to(be_none)

expect(client.shopping.seatmaps).not_to(be_none)

expect(client.shopping.hotel_offers).not_to(be_none)
expect(client.shopping.hotel_offer).not_to(be_none)
expect(client.shopping.hotel_offers_by_hotel).not_to(be_none)
Expand Down Expand Up @@ -102,6 +104,8 @@
expect(client.shopping.flight_offers.get).not_to(be_none)
expect(client.shopping.flight_offers_search.get).not_to(be_none)

expect(client.shopping.seatmaps.get).not_to(be_none)

expect(client.shopping.hotel_offers.get).not_to(be_none)
expect(client.shopping.hotel_offers_by_hotel.get).not_to(be_none)
expect(client.shopping.hotel_offer('123').get).not_to(be_none)
Expand Down Expand Up @@ -256,6 +260,12 @@
'/v2/shopping/hotel-offers/XXX', a='b'
))

with it('.shopping.seatmaps.get'):
self.client.shopping.seatmaps.get(**{'a': 'b'})
expect(self.client.get).to(have_been_called_with(
'/v1/shopping/seatmaps', 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(
Expand Down Expand Up @@ -304,6 +314,12 @@
'/v2/shopping/flight-offers', {'foo': 'bar'}
))

with it('.shopping.seatmaps.post'):
self.client.shopping.seatmaps.post({'foo': 'bar'})
expect(self.client.post).to(have_been_called_with(
'/v1/shopping/seatmaps', {'foo': 'bar'}
))

with it('.shopping.flight_offers.pricing.post'):
self.client.shopping.flight_offers.pricing.post({'foo': 'bar'})
expect(self.client.post).to(have_been_called_with(
Expand Down