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

Remove park control objects and added production endpoint #162

Merged
merged 4 commits into from
Nov 12, 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
9 changes: 8 additions & 1 deletion src/parkapi_sources/converters/apcoa/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ApcoaPullConverter(PullConverter):
uid='apcoa',
name='APCOA-SERVICES API',
public_url='https://devzone.apcoa-services.com/',
source_url='https://api.apcoa-services.com/carpark-dev/v4/Carparks',
source_url='https://api.apcoa-services.com/carpark/v4/Carparks',
has_realtime_data=False, # ATM only static data can be called from the API
)

Expand All @@ -41,6 +41,13 @@ def get_static_parking_sites(self) -> tuple[list[StaticParkingSiteInput], list[I
parking_sites_input = self.get_data()

for parking_site_dict in parking_sites_input.Results:
# Ignore Park & Control Objects/Entries - Not allowed to be published
if (
parking_site_dict.get('SiteIdLong').startswith('S1180_')
and parking_site_dict.get('ShowAs') == 'SURVEILLANCE_OBJECT'
):
continue

# Ignore missing coordinates if requested
if self.config_helper.get('PARK_API_APCOA_IGNORE_MISSING_COORDINATES', False):
if not parking_site_dict.get('NavigationLocations'):
Expand Down
10 changes: 5 additions & 5 deletions tests/converters/apcoa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def test_get_static_parking_sites(apcoa_pull_converter: ApcoaPullConverter, requ
json_data = json_file.read()

requests_mock.get(
'https://api.apcoa-services.com/carpark-dev/v4/Carparks',
'https://api.apcoa-services.com/carpark/v4/Carparks',
text=json_data,
)

static_parking_site_inputs, import_parking_site_exceptions = apcoa_pull_converter.get_static_parking_sites()

assert len(static_parking_site_inputs) == 345
assert len(import_parking_site_exceptions) == 224
assert len(static_parking_site_inputs) == 330
assert len(import_parking_site_exceptions) == 23

validate_static_parking_site_inputs(static_parking_site_inputs)

Expand All @@ -83,15 +83,15 @@ def test_get_static_parking_sites_ignore_missing_coordinates(
json_data = json_file.read()

requests_mock.get(
'https://api.apcoa-services.com/carpark-dev/v4/Carparks',
'https://api.apcoa-services.com/carpark/v4/Carparks',
text=json_data,
)

static_parking_site_inputs, import_parking_site_exceptions = (
apcoa_ignore_missing_coordinates_pull_converter.get_static_parking_sites()
)

assert len(static_parking_site_inputs) == 345
assert len(static_parking_site_inputs) == 330
assert len(import_parking_site_exceptions) == 18

validate_static_parking_site_inputs(static_parking_site_inputs)
Expand Down
Loading