Skip to content

Commit 910c566

Browse files
authored
Merge pull request #33 from anthonyroux/point_of_interests
Add new API: Point of Interest
2 parents ecc3fd0 + a4fa561 commit 910c566

File tree

10 files changed

+107
-4
lines changed

10 files changed

+107
-4
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Changelog
22
=========
3+
3.1.0 - 2019-03-25
4+
--------------------
5+
Release of the `Point of Interest API <https://developers.amadeus.com/self-service/category/210/api-doc/55>`_
6+
7+
The Points Of Interest API, powered by AVUXI TopPlace, is a search API that returns a list of popular places for a particular location. The location can be defined as area bound by four coordinates or as a geographical coordinate with a radius. The popularity of a place or 'point of interest' is determined by AVUXI's proprietary algorithm that considers factors such as ratings, check-ins, category scores among other factors from a host of online media sources.
8+
39

410
3.0.0 - 2019-01-22
511
--------------------

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ List of supported endpoints
245245
amadeus.shopping.hotel_offers_by_hotel.get(hotelId = 'IALONCHO')
246246
# Confirm the availability of a specific offer
247247
amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get()
248+
# Point of Interest
249+
# What are the popular places in Barcelona (based a geo location and a radius)
250+
amadeus.reference_data.locations.points_of_interest.get(latitude=41.397158, longitude=2.160873)
251+
# What are the popular places in Barcelona? (based on a square)
252+
amadeus.reference_data.locations.points_of_interest.by_square.get(north=41.397158, west=2.160873, south=41.394582, east=2.177181)
248253
249254
250255
Development & Contributing

amadeus/amadeus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, **options):
3737
.. code-block:: python
3838
3939
40-
amadeus = amadeus.Client()
40+
amadeus = amadeus.Client()
4141
4242
:param client_id: the API key used to authenticate the API
4343
:paramtype client_id: str

amadeus/reference_data/_locations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from amadeus.client.decorator import Decorator
22
from amadeus.reference_data.locations._airports import Airports
3+
from amadeus.reference_data.locations._points_of_interest import PointsOfInterest
34

45

56
class Locations(Decorator, object):
67
def __init__(self, client):
78
Decorator.__init__(self, client)
89
self.airports = Airports(client)
10+
self.points_of_interest = PointsOfInterest(client)
911

1012
def get(self, **params):
1113
'''
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from ._airports import Airports
2-
3-
__all__ = ['Airports']
2+
from ._points_of_interest import PointsOfInterest
3+
__all__ = ['Airports', 'PointsOfInterest']

amadeus/reference_data/locations/_airports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def get(self, **params):
99
.. code-block:: python
1010
1111
12-
client.reference_data.locations.get(
12+
client.reference_data.locations.airports.get(
1313
longitude=49.0000,
1414
latitude=2.55
1515
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from amadeus.client.decorator import Decorator
2+
from amadeus.reference_data.locations.points_of_interest._by_square \
3+
import BySquare
4+
5+
6+
class PointsOfInterest(Decorator, object):
7+
def __init__(self, client):
8+
Decorator.__init__(self, client)
9+
self.by_square = BySquare(client)
10+
11+
def get(self, **params):
12+
'''
13+
Returns a list of relevant point of interests near to a given point.
14+
15+
.. code-block:: python
16+
17+
18+
client.reference_data.locations.points_of_interest.get(
19+
longitude=2.160873,
20+
latitude=41.397158
21+
)
22+
23+
:param latitude: latitude of geographic location to search around.
24+
For example: ``41.397158``
25+
:param longitude: longitude of geographic location to search around.
26+
For example: ``2.160873``
27+
28+
:rtype: amadeus.Response
29+
:raises amadeus.ResponseError: if the request could not be completed
30+
'''
31+
return self.client.get(
32+
'/v1/reference-data/locations/pois', **params)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from ._by_square import BySquare
2+
__all__ = ['BySquare']
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class BySquare(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Returns a list of relevant point of interests
8+
around a defined square (4 points).
9+
10+
.. code-block:: python
11+
12+
13+
client.reference_data.locations.points_of_interest.by_square.get(
14+
north=41.397158,
15+
west=2.160873,
16+
south=41.394582,
17+
east=2.177181
18+
)
19+
20+
:param north: latitude north of bounding box.
21+
For example: ``41.397158``
22+
:param west: longitude west of bounding box.
23+
For example: ``2.160873``
24+
:param south: latitude south of bounding box.
25+
For example: ``41.394582``
26+
:param east: longitude east of bounding box.
27+
For example: ``2.177181``
28+
29+
:rtype: amadeus.Response
30+
:raises amadeus.ResponseError: if the request could not be completed
31+
'''
32+
return self.client.get(
33+
'/v1/reference-data/locations/pois/by-square', **params)

specs/namespaces/namespaces_spec.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
expect(client.reference_data.location).not_to(be_none)
2121
expect(client.reference_data.locations).not_to(be_none)
2222
expect(client.reference_data.locations.airports).not_to(be_none)
23+
expect(client.reference_data.locations.points_of_interest).not_to(be_none)
24+
expect(
25+
client.reference_data.locations.points_of_interest.by_square).not_to(
26+
be_none)
2327

2428
expect(client.travel).not_to(be_none)
2529
expect(client.travel.analytics).not_to(be_none)
@@ -46,6 +50,12 @@
4650
expect(client.reference_data.location('ALHR').get).not_to(be_none)
4751
expect(client.reference_data.locations.get).not_to(be_none)
4852
expect(client.reference_data.locations.airports.get).not_to(be_none)
53+
expect(
54+
client.reference_data.locations.points_of_interest.get).not_to(
55+
be_none)
56+
expect(
57+
client.reference_data.locations.points_of_interest.by_square.get
58+
).not_to(be_none)
4959

5060
expect(client.travel.analytics.air_traffic.traveled.get).not_to(be_none)
5161
expect(client.travel.analytics.air_traffic.booked.get).not_to(be_none)
@@ -100,6 +110,19 @@
100110
'/v1/reference-data/locations/airports', a='b'
101111
))
102112

113+
with it('.reference_data.locations.points_of_interest.get'):
114+
self.client.reference_data.locations.points_of_interest.get(a='b')
115+
expect(self.client.get).to(have_been_called_with(
116+
'/v1/reference-data/locations/pois', a='b'
117+
))
118+
119+
with it('.reference_data.locations.points_of_interest.by_square.get'):
120+
self.client.reference_data.locations.points_of_interest.by_square.get(
121+
a='b')
122+
expect(self.client.get).to(have_been_called_with(
123+
'/v1/reference-data/locations/pois/by-square', a='b'
124+
))
125+
103126
with it('.travel.analytics.air_traffic.traveled.get'):
104127
self.client.travel.analytics.air_traffic.traveled.get(a='b')
105128
expect(self.client.get).to(have_been_called_with(

0 commit comments

Comments
 (0)