1 """
2 Location Service Module
3
4 This package contains the shipping methods defined by Fedex's
5 LocationService WSDL file. Each is encapsulated in a class for
6 easy access. For more details on each, refer to the respective class's
7 documentation.
8 """
9
10 from ..base_service import FedexBaseService
11
12
14 """
15 This class allows you to figure out a FedEx location closest
16 to a specified location criteria, based on location type.
17 The response includes location details like operating times,
18 directions and a map link and more.
19 """
20
21 - def __init__(self, config_obj, *args, **kwargs):
22 """
23 @type config_obj: L{FedexConfig}
24 @param config_obj: A valid FedexConfig object.
25 """
26
27 self._config_obj = config_obj
28
29 self._version_info = {
30 'service_id': 'locs',
31 'major': '3',
32 'intermediate': '0',
33 'minor': '0'
34 }
35
36
37 self.Address = None
38 """@ivar: Holds the Address WSDL object."""
39
40 self.PhoneNumber = None
41 """@ivar: Holds the PhoneNumber string object."""
42
43 self.MultipleMatchesAction = None
44 """@ivar: Holds the MultipleMatchesActionType WSDL object."""
45
46 self.Constraints = []
47 """@ivar: Holds a list of SearchLocationConstraints WSDL objects."""
48
49 self.LocationsSearchCriterion = None
50 """@ivar: Holds the LocationsSearchCriteriaType WSDL object."""
51
52 self.SortDetail = None
53 """@ivar: Holds the LocationSortDetail WSDL object."""
54
55 super(FedexSearchLocationRequest, self).__init__(
56 self._config_obj, 'LocationsService_v3.wsdl', *args, **kwargs)
57
59 """
60 Create the data structure and get it ready for the WSDL request.
61 """
62
63
64 self.MultipleMatchesAction = 'RETURN_ALL'
65 self.Constraints = self.create_wsdl_object_of_type('SearchLocationConstraints')
66 self.Address = self.create_wsdl_object_of_type('Address')
67 self.LocationsSearchCriterion = 'ADDRESS'
68 self.SortDetail = self.create_wsdl_object_of_type('LocationSortDetail')
69
71 """
72 Fires off the Fedex request.
73
74 @warning: NEVER CALL THIS METHOD DIRECTLY. CALL send_request(),
75 WHICH RESIDES ON FedexBaseService AND IS INHERITED.
76 """
77
78
79
80
81 del self.ClientDetail.IntegratorId
82 self.logger.debug(self.WebAuthenticationDetail)
83 self.logger.debug(self.ClientDetail)
84 self.logger.debug(self.TransactionDetail)
85 self.logger.debug(self.VersionId)
86
87 return self.client.service.searchLocations(
88 WebAuthenticationDetail=self.WebAuthenticationDetail,
89 ClientDetail=self.ClientDetail,
90 TransactionDetail=self.TransactionDetail,
91 Version=self.VersionId,
92 LocationsSearchCriterion=self.LocationsSearchCriterion,
93 PhoneNumber=self.PhoneNumber,
94 MultipleMatchesAction=self.MultipleMatchesAction,
95 Constraints=self.Constraints,
96 Address=self.Address,
97 SortDetail=self.SortDetail)
98