Skip to content

Commit ee2792b

Browse files
authored
Merge pull request #160 from siddydutta/airline-routes-v1
Add Support of Airline Routes V1.0
2 parents 5980a95 + 31f4f07 commit ee2792b

File tree

7 files changed

+51
-0
lines changed

7 files changed

+51
-0
lines changed

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ List of supported endpoints
359359
# Covid-19 Area Report
360360
amadeus.duty_of_care.diseases.covid19_area_report.get(countryCode="US")
361361
362+
# Airline Routes
363+
amadeus.airline.destinations.get(airlineCode='BA')
364+
362365
Development & Contributing
363366
--------------------------
364367

amadeus/airline/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from ._destinations import Destinations
2+
3+
__all__ = ['Destinations']

amadeus/airline/_destinations.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class Destinations(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Get airline destinations.
8+
9+
.. code-block:: python
10+
11+
amadeus.airline.destinations.get(airlineCode='BA')
12+
13+
:param airlineCode: the airline code following IATA standard.
14+
Example: ``"BA"``
15+
16+
:rtype: amadeus.Response
17+
:raises amadeus.ResponseError: if the request could not be completed
18+
'''
19+
return self.client.get('/v1/airline/destinations', **params)

amadeus/namespaces/_airline.py

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.airline._destinations import Destinations
3+
4+
5+
class Airline(Decorator, object):
6+
def __init__(self, client):
7+
Decorator.__init__(self, client)
8+
self.destinations = Destinations(client)

amadeus/namespaces/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from amadeus.namespaces._analytics import Analytics
1010
from amadeus.namespaces._location import Location
1111
from amadeus.namespaces._duty_of_care import DutyOfCare
12+
from amadeus.namespaces._airline import Airline
1213

1314

1415
class Core(object):
@@ -24,3 +25,4 @@ def __init__(self):
2425
self.analytics = Analytics(self)
2526
self.location = Location(self)
2627
self.duty_of_care = DutyOfCare(self)
28+
self.airline = Airline(self)

docs/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,9 @@ DutyOfCare/Diseases
262262

263263
.. autoclass:: amadeus.duty_of_care.diseases.Covid19AreaReport
264264
:members: get
265+
266+
Airline/Destinations
267+
================
268+
269+
.. autoclass:: amadeus.airline.Destinations
270+
:members: get

specs/namespaces/namespaces_spec.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
expect(client.duty_of_care).not_to(be_none)
9696
expect(client.duty_of_care.diseases.covid19_area_report).not_to(be_none)
9797

98+
expect(client.airline.destinations).not_to(be_none)
99+
98100
with it('should define all expected .get methods'):
99101
client = self.client
100102
expect(client.reference_data.urls.checkin_links.get).not_to(be_none)
@@ -163,6 +165,8 @@
163165
expect(client.duty_of_care.diseases.covid19_area_report.get).not_to(
164166
be_none)
165167

168+
expect(client.airline.destinations.get).not_to(be_none)
169+
166170
with it('should define all expected .delete methods'):
167171
client = self.client
168172
expect(client.booking.flight_order('123').delete).not_to(be_none)
@@ -570,3 +574,9 @@
570574
expect(self.client.get).to(have_been_called_with(
571575
'/v1/reference-data/locations/cities', a='b'
572576
))
577+
578+
with it('.airline.destinations.get'):
579+
self.client.airline.destinations.get(a='b')
580+
expect(self.client.get).to(have_been_called_with(
581+
'/v1/airline/destinations', a='b'
582+
))

0 commit comments

Comments
 (0)