Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAV-2676 [Flowbird] Intégration des prix issus de l'API flowbird #4202

Merged
merged 6 commits into from
Jan 19, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,10 @@ def process_data(self, data, poi):
parking_coord = Coords(parking.get('coord').get('lat'), parking.get('coord').get('lon'))
distance = crowfly_distance_between(poi_coord, parking_coord)
if distance < self.distance:
return ParkingPlaces(availability=parking.get('availability'))
return ParkingPlaces(
availability=parking.get('availability'),
currency=parking.get('currency'),
amount=parking.get('amount'),
start_time=parking.get('startTime'),
end_time=parking.get('endTime'),
)
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def __init__(
occupied_electric_vehicle=None,
state=None,
availability=None,
currency=None,
start_time=None,
end_time=None,
amount=None,
):
if available is not None:
self.available = available
Expand All @@ -66,6 +70,14 @@ def __init__(
self.state = state
if availability is not None:
self.availability = availability
if currency is not None:
self.currency = currency
if amount is not None:
self.amount = amount
if start_time is not None:
self.start_time = start_time
if end_time is not None:
self.end_time = end_time
if not total_places and any(n is not None for n in [available, occupied, available_PRM, occupied_PRM]):
self.total_places = (available or 0) + (occupied or 0) + (available_PRM or 0) + (occupied_PRM or 0)

Expand All @@ -82,6 +94,10 @@ def __eq__(self, other):
"occupied_electric_vehicle",
"state",
"availability",
"currency",
"amount",
"start_time",
"end_time",
"total_places",
]:
if hasattr(other, item):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,22 @@ def parking_space_availability_forseti_get_informations_test():
"name": "786 Parking",
"coord": {"lat": 42.368227, "lon": -83.0779357},
"availability": True,
"currency": "USD",
"startTime": "2019-04-01T00:00:00Z",
"endTime": "2019-04-01T23:59:59Z",
"amount": 6000,
}
],
"pagination": {"start_page": 0, "items_on_page": 25, "items_per_page": 25, "total_result": 1},
}

parking_places = ParkingPlaces(availability=True)
parking_places = ParkingPlaces(
availability=True,
currency='USD',
start_time='2019-04-01T00:00:00Z',
end_time='2019-04-01T23:59:59Z',
amount=6000,
)
provider = ForsetiProvider('http://forseti')
provider._call_webservice = MagicMock(return_value=webservice_response)
parking = provider.get_informations(poi)
Expand Down