Skip to content

Commit 564fa2b

Browse files
authored
Merge pull request #131 from siddydutta/travel-restrictions
Add Support for Travel Restrictions API
2 parents 91b712b + a10d50d commit 564fa2b

9 files changed

Lines changed: 68 additions & 1 deletion

File tree

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ List of supported endpoints
336336
amadeus.analytics.itinerary_price_metrics.get(originIataCode='MAD', destinationIataCode='CDG',
337337
departureDate='2021-03-21')
338338
339+
# Covid-19 Area Report
340+
amadeus.duty_of_care.diseases.covid19_area_report.get(countryCode="US")
341+
339342
Development & Contributing
340343
--------------------------
341344

amadeus/duty_of_care/__init__.py

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

amadeus/duty_of_care/_diseases.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.duty_of_care.diseases import Covid19AreaReport
3+
4+
5+
class Diseases(Decorator, object):
6+
def __init__(self, client):
7+
Decorator.__init__(self, client)
8+
self.covid19_area_report = Covid19AreaReport(client)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from ._covid19_area_report import Covid19AreaReport
2+
3+
__all__ = ['Covid19AreaReport']
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class Covid19AreaReport(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Returns the Covid-19 restrictions on targerted area.
8+
9+
.. code-block:: python
10+
11+
amadeus.travel_restrictions.covid19_area_report.get(
12+
countryCode='US'
13+
)
14+
15+
:param countryCode: ISO 3166 Alphas-2 code, for
16+
example ``"US"`` for United States of America
17+
18+
:rtype: amadeus.Response
19+
:raises amadeus.ResponseError: if the request could not be completed
20+
'''
21+
return self.client.get(
22+
'/v1/duty-of-care/diseases/covid19-area-report', **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.duty_of_care._diseases import Diseases
3+
4+
5+
class DutyOfCare(Decorator, object):
6+
def __init__(self, client):
7+
Decorator.__init__(self, client)
8+
self.diseases = Diseases(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._schedule import Schedule
1010
from amadeus.namespaces._analytics import Analytics
1111
from amadeus.namespaces._location import Location
12+
from amadeus.namespaces._duty_of_care import DutyOfCare
1213

1314

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

docs/index.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,10 @@ Location/Analytics
221221
================
222222

223223
.. autoclass:: amadeus.location.analytics.CategoryRatedAreas
224-
:members: get
224+
:members: get
225+
226+
DutyOfCare/Diseases
227+
================
228+
229+
.. autoclass:: amadeus.duty_of_care.diseases.Covid19AreaReport
230+
:members: get

specs/namespaces/namespaces_spec.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
expect(client.location).not_to(be_none)
8888
expect(client.location.analytics.category_rated_areas).not_to(be_none)
8989

90+
expect(client.duty_of_care).not_to(be_none)
91+
expect(client.duty_of_care.diseases.covid19_area_report).not_to(be_none)
92+
9093
with it('should define all expected .get methods'):
9194
client = self.client
9295
expect(client.reference_data.urls.checkin_links.get).not_to(be_none)
@@ -144,6 +147,9 @@
144147

145148
expect(client.location.analytics.category_rated_areas.get).not_to(be_none)
146149

150+
expect(client.duty_of_care.diseases.covid19_area_report.get).not_to(
151+
be_none)
152+
147153
with it('should define all expected .delete methods'):
148154
client = self.client
149155
expect(client.booking.flight_order('123').delete).not_to(be_none)
@@ -498,3 +504,9 @@
498504
expect(self.client.get).to(have_been_called_with(
499505
'/v1/analytics/itinerary-price-metrics', a='b'
500506
))
507+
508+
with it('.duty_of_care.diseases.covid19_area_report.get'):
509+
self.client.duty_of_care.diseases.covid19_area_report.get(a='b')
510+
expect(self.client.get).to(have_been_called_with(
511+
'/v1/duty-of-care/diseases/covid19-area-report', a='b'
512+
))

0 commit comments

Comments
 (0)