Skip to content

Commit 1cb1516

Browse files
authored
Merge pull request #165 from siddydutta/travel-restrictions-v2
Add support of Travel Restrictions V2
2 parents 82f1af8 + 04b15ee commit 1cb1516

File tree

6 files changed

+40
-2
lines changed

6 files changed

+40
-2
lines changed

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,10 @@ List of supported endpoints
352352
amadeus.analytics.itinerary_price_metrics.get(originIataCode='MAD', destinationIataCode='CDG',
353353
departureDate='2021-03-21')
354354
355-
# Covid-19 Area Report
355+
# Travel Restrictions v1
356356
amadeus.duty_of_care.diseases.covid19_area_report.get(countryCode="US")
357+
# Travel Restrictions v2
358+
amadeus.duty_of_care.diseases.covid19_report.get(countryCode='US')
357359
358360
# Airline Routes
359361
amadeus.airline.destinations.get(airlineCode='BA')

amadeus/duty_of_care/_diseases.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from amadeus.client.decorator import Decorator
22
from amadeus.duty_of_care.diseases import Covid19AreaReport
3+
from amadeus.duty_of_care.diseases import Covid19Report
34

45

56
class Diseases(Decorator, object):
67
def __init__(self, client):
78
Decorator.__init__(self, client)
89
self.covid19_area_report = Covid19AreaReport(client)
10+
self.covid19_report = Covid19Report(client)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from ._covid19_area_report import Covid19AreaReport
2+
from ._covid19_report import Covid19Report
23

3-
__all__ = ['Covid19AreaReport']
4+
__all__ = ['Covid19AreaReport', 'Covid19Report']
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 Covid19Report(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Returns the Covid-19 restrictions on targeted area.
8+
9+
.. code-block:: python
10+
11+
amadeus.duty_of_care.diseases.covid19_report.get(
12+
countryCode='US'
13+
)
14+
15+
:param countryCode: Country code following ISO 3166 Alpha-2
16+
standard, for 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+
'/v2/duty-of-care/diseases/covid19-area-report', **params)

docs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ DutyOfCare/Diseases
257257
.. autoclass:: amadeus.duty_of_care.diseases.Covid19AreaReport
258258
:members: get
259259

260+
.. autoclass:: amadeus.duty_of_care.diseases.Covid19Report
261+
:members: get
262+
260263
Airline/Destinations
261264
================
262265

specs/namespaces/namespaces_spec.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
expect(client.duty_of_care).not_to(be_none)
9494
expect(client.duty_of_care.diseases.covid19_area_report).not_to(be_none)
95+
expect(client.duty_of_care.diseases.covid19_report).not_to(be_none)
9596

9697
expect(client.airline.destinations).not_to(be_none)
9798

@@ -159,6 +160,7 @@
159160

160161
expect(client.duty_of_care.diseases.covid19_area_report.get).not_to(
161162
be_none)
163+
expect(client.duty_of_care.diseases.covid19_report.get).not_to(be_none)
162164

163165
expect(client.airline.destinations.get).not_to(be_none)
164166

@@ -525,6 +527,12 @@
525527
'/v1/duty-of-care/diseases/covid19-area-report', a='b'
526528
))
527529

530+
with it('.duty_of_care.diseases.covid19_report.get'):
531+
self.client.duty_of_care.diseases.covid19_report.get(a='b')
532+
expect(self.client.get).to(have_been_called_with(
533+
'/v2/duty-of-care/diseases/covid19-area-report', a='b'
534+
))
535+
528536
with it('.reference_data.locations.hotels.by_hotels.get'):
529537
self.client.reference_data.locations.hotels.by_hotels.get(
530538
a='b')

0 commit comments

Comments
 (0)