Skip to content

Adding missing GeographicCoordinates object to locations service #156

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

Merged
merged 4 commits into from
Apr 8, 2022
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
7 changes: 6 additions & 1 deletion fedex/services/location_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def __init__(self, config_obj, *args, **kwargs):
self.SortDetail = None
"""@ivar: Holds the LocationSortDetail WSDL object."""

self.GeographicCoordinates = None
"""@ivar: Holds the GeographicCoordinates WSDL object."""

super(FedexSearchLocationRequest, self).__init__(
self._config_obj, 'LocationsService_v9.wsdl', *args, **kwargs)

Expand All @@ -65,6 +68,7 @@ def _prepare_wsdl_objects(self):
self.Constraints = self.create_wsdl_object_of_type('SearchLocationConstraints')
self.Address = self.create_wsdl_object_of_type('Address')
self.LocationsSearchCriterion = 'ADDRESS'
self.GeographicCoordinates = None
self.SortDetail = self.create_wsdl_object_of_type('LocationSortDetail')

def _assemble_and_send_request(self):
Expand Down Expand Up @@ -94,4 +98,5 @@ def _assemble_and_send_request(self):
MultipleMatchesAction=self.MultipleMatchesAction,
Constraints=self.Constraints,
Address=self.Address,
SortDetail=self.SortDetail)
SortDetail=self.SortDetail,
GeographicCoordinates=self.GeographicCoordinates)
11 changes: 11 additions & 0 deletions tests/test_location_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,18 @@ def test_location_address_search(self):
location_request = FedexSearchLocationRequest(CONFIG_OBJ)
location_request.Address.PostalCode = '38119'
location_request.Address.CountryCode = 'US'

def test_location_coordinates_search(self):
# Test search by geo coordinates
# https://www.fedex.com/us/developer/webhelp/ws/2020/US/FedEx_WebServices_2020_Developer_Guide.htm#t=wsdvg%2FLocation_Request_Coding_Details.htm

location_request = FedexSearchLocationRequest(CONFIG_OBJ)
location_request.LocationsSearchCriterion = 'GEOGRAPHIC_COORDINATES'
location_request.Address.CountryCode = 'US'
location_request.GeographicCoordinates = '34.074866096127096-118.40365442768258/'

location_request.send_request()
assert location_request.response.HighestSeverity == 'SUCCESS'

if __name__ == "__main__":
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
Expand Down