From ce817922f9d5d3467ba7e3d5f5414e050d62aa20 Mon Sep 17 00:00:00 2001 From: Brent Janski <31578457+talktobrent@users.noreply.github.com> Date: Tue, 28 Sep 2021 22:52:28 -0500 Subject: [PATCH 1/4] 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? --- fedex/services/location_service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fedex/services/location_service.py b/fedex/services/location_service.py index 9d47a1c..80c9618 100644 --- a/fedex/services/location_service.py +++ b/fedex/services/location_service.py @@ -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 LocationSortDetail WSDL object.""" + super(FedexSearchLocationRequest, self).__init__( self._config_obj, 'LocationsService_v9.wsdl', *args, **kwargs) @@ -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): @@ -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) From 554797a40cfb48da9a248c2d7a7d25459ced1487 Mon Sep 17 00:00:00 2001 From: Brent Janski <31578457+talktobrent@users.noreply.github.com> Date: Tue, 28 Sep 2021 22:59:13 -0500 Subject: [PATCH 2/4] Fixed comment Fixed copied comment --- fedex/services/location_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedex/services/location_service.py b/fedex/services/location_service.py index 80c9618..f7db850 100644 --- a/fedex/services/location_service.py +++ b/fedex/services/location_service.py @@ -53,7 +53,7 @@ def __init__(self, config_obj, *args, **kwargs): """@ivar: Holds the LocationSortDetail WSDL object.""" self.GeographicCoordinates = None - """@ivar: Holds the LocationSortDetail WSDL object.""" + """@ivar: Holds the GeographicCoordinates WSDL object.""" super(FedexSearchLocationRequest, self).__init__( self._config_obj, 'LocationsService_v9.wsdl', *args, **kwargs) From deb38b3f61d164538c3b6440d4a08d3aa26b25bf Mon Sep 17 00:00:00 2001 From: Brent Janski <31578457+talktobrent@users.noreply.github.com> Date: Wed, 29 Sep 2021 01:08:22 -0500 Subject: [PATCH 3/4] Added test for GeographicCoordinates location search --- tests/test_location_service.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_location_service.py b/tests/test_location_service.py index 107ad5d..6ab19ec 100644 --- a/tests/test_location_service.py +++ b/tests/test_location_service.py @@ -47,7 +47,16 @@ 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): + + 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) From 2a11e4b64726fd1fa661dae653ba89758e2a02ce Mon Sep 17 00:00:00 2001 From: Brent Janski <31578457+talktobrent@users.noreply.github.com> Date: Wed, 29 Sep 2021 01:53:11 -0500 Subject: [PATCH 4/4] Added test comments --- tests/test_location_service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_location_service.py b/tests/test_location_service.py index 6ab19ec..26054a3 100644 --- a/tests/test_location_service.py +++ b/tests/test_location_service.py @@ -49,6 +49,8 @@ def test_location_address_search(self): 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'