Skip to content

Commit 33e9b61

Browse files
authored
Adding missing GeographicCoordinates object to locations service (#156)
* Missing object from locations service Add missing GeographicCoordinates object to location service, it is in the locations wsdl but appears to be overlooked in the service module? * Fixed comment Fixed copied comment * Added test for GeographicCoordinates location search * Added test comments
1 parent c900fcc commit 33e9b61

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

fedex/services/location_service.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def __init__(self, config_obj, *args, **kwargs):
5252
self.SortDetail = None
5353
"""@ivar: Holds the LocationSortDetail WSDL object."""
5454

55+
self.GeographicCoordinates = None
56+
"""@ivar: Holds the GeographicCoordinates WSDL object."""
57+
5558
super(FedexSearchLocationRequest, self).__init__(
5659
self._config_obj, 'LocationsService_v9.wsdl', *args, **kwargs)
5760

@@ -65,6 +68,7 @@ def _prepare_wsdl_objects(self):
6568
self.Constraints = self.create_wsdl_object_of_type('SearchLocationConstraints')
6669
self.Address = self.create_wsdl_object_of_type('Address')
6770
self.LocationsSearchCriterion = 'ADDRESS'
71+
self.GeographicCoordinates = None
6872
self.SortDetail = self.create_wsdl_object_of_type('LocationSortDetail')
6973

7074
def _assemble_and_send_request(self):
@@ -94,4 +98,5 @@ def _assemble_and_send_request(self):
9498
MultipleMatchesAction=self.MultipleMatchesAction,
9599
Constraints=self.Constraints,
96100
Address=self.Address,
97-
SortDetail=self.SortDetail)
101+
SortDetail=self.SortDetail,
102+
GeographicCoordinates=self.GeographicCoordinates)

tests/test_location_service.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ def test_location_address_search(self):
4747
location_request = FedexSearchLocationRequest(CONFIG_OBJ)
4848
location_request.Address.PostalCode = '38119'
4949
location_request.Address.CountryCode = 'US'
50+
51+
def test_location_coordinates_search(self):
52+
# Test search by geo coordinates
53+
# https://www.fedex.com/us/developer/webhelp/ws/2020/US/FedEx_WebServices_2020_Developer_Guide.htm#t=wsdvg%2FLocation_Request_Coding_Details.htm
54+
55+
location_request = FedexSearchLocationRequest(CONFIG_OBJ)
56+
location_request.LocationsSearchCriterion = 'GEOGRAPHIC_COORDINATES'
57+
location_request.Address.CountryCode = 'US'
58+
location_request.GeographicCoordinates = '34.074866096127096-118.40365442768258/'
5059

60+
location_request.send_request()
61+
assert location_request.response.HighestSeverity == 'SUCCESS'
5162

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

0 commit comments

Comments
 (0)