Skip to content

Commit

Permalink
Merge pull request #162 from mobidata-bw/remove-park-control-objects
Browse files Browse the repository at this point in the history
Remove park control objects and added production endpoint
  • Loading branch information
the-infinity authored Nov 12, 2024
2 parents c32558a + a603f8d commit 7cc5920
Show file tree
Hide file tree
Showing 3 changed files with 141,103 additions and 101,179 deletions.
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

0 comments on commit 7cc5920

Please sign in to comment.