@@ -11,158 +11,158 @@ |
||
11 | 11 | */ |
12 | 12 | class TelematicsVendor extends Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Unique ID of a telematics vendor. |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - public $id; |
|
14 | + /** |
|
15 | + * Unique ID of a telematics vendor. |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + public $id; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Vendor name |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - public $name; |
|
20 | + /** |
|
21 | + * Vendor name |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + public $name; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Vendor slug |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public $slug; |
|
26 | + /** |
|
27 | + * Vendor slug |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public $slug; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Vendor description |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $description; |
|
32 | + /** |
|
33 | + * Vendor description |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $description; |
|
37 | 37 | |
38 | - /** |
|
39 | - * URL to the telematics vendor's logo. |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - public $logo_url; |
|
38 | + /** |
|
39 | + * URL to the telematics vendor's logo. |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + public $logo_url; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Website URL of a telematics vendor. |
|
46 | - * @var string |
|
47 | - */ |
|
48 | - public $website_url; |
|
44 | + /** |
|
45 | + * Website URL of a telematics vendor. |
|
46 | + * @var string |
|
47 | + */ |
|
48 | + public $website_url; |
|
49 | 49 | |
50 | - /** |
|
51 | - * API URL of a telematics vendor. |
|
52 | - * @var string |
|
53 | - */ |
|
54 | - public $api_docs_url; |
|
50 | + /** |
|
51 | + * API URL of a telematics vendor. |
|
52 | + * @var string |
|
53 | + */ |
|
54 | + public $api_docs_url; |
|
55 | 55 | |
56 | - /** |
|
57 | - * If 1, the vendor is integrated in Route4Me |
|
58 | - * @var string |
|
59 | - */ |
|
60 | - public $is_integrated; |
|
56 | + /** |
|
57 | + * If 1, the vendor is integrated in Route4Me |
|
58 | + * @var string |
|
59 | + */ |
|
60 | + public $is_integrated; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Vendors size. |
|
64 | - * <para>Accepted values:</para> |
|
65 | - * <para>global, regional, local. </para> |
|
66 | - * @var string |
|
67 | - */ |
|
68 | - public $size; |
|
62 | + /** |
|
63 | + * Vendors size. |
|
64 | + * <para>Accepted values:</para> |
|
65 | + * <para>global, regional, local. </para> |
|
66 | + * @var string |
|
67 | + */ |
|
68 | + public $size; |
|
69 | 69 | |
70 | - /** |
|
71 | - * An array of the countries, the vendor is operating. |
|
72 | - * @var Country[] |
|
73 | - */ |
|
74 | - public $countries = []; |
|
70 | + /** |
|
71 | + * An array of the countries, the vendor is operating. |
|
72 | + * @var Country[] |
|
73 | + */ |
|
74 | + public $countries = []; |
|
75 | 75 | |
76 | - /** |
|
77 | - * An array the vendor features |
|
78 | - * @var TelematicsVendorFeature[] |
|
79 | - */ |
|
80 | - public $features = []; |
|
81 | - |
|
82 | - /** |
|
83 | - * Get vendor(s), search for vendors, compare vendors. |
|
84 | - * @param TelematicsVendorParameters $params |
|
85 | - * @return TelematicsVendorResponse or TelematicsVendorsResponse. |
|
86 | - */ |
|
87 | - public static function GetTelematicsVendors($params) |
|
88 | - { |
|
89 | - Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
|
90 | - |
|
91 | - $allQueryFields = ['vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors']; |
|
92 | - |
|
93 | - $vendors = Route4Me::makeRequst([ |
|
94 | - 'url' => '', |
|
95 | - 'method' => 'GET', |
|
96 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
97 | - ]); |
|
98 | - |
|
99 | - return $vendors; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Returns a random telematics vendor (for tests). |
|
104 | - * @param $offset integer |
|
105 | - * @param $limit integer |
|
106 | - * @return Telematics vendor |
|
107 | - */ |
|
108 | - public static function GetRandomVendorID($offset, $limit) |
|
109 | - { |
|
110 | - $allVendors = self::GetTelematicsVendors(null); |
|
111 | - $vendorsNumber = sizeof($allVendors['vendors']); |
|
112 | - |
|
113 | - if ($vendorsNumber < $limit) { |
|
114 | - if ($vendorsNumber > $offset) { |
|
115 | - $limit = $vendorsNumber; |
|
116 | - } else { |
|
117 | - if ($vendorsNumber == $offset) { |
|
118 | - return $allVendors['vendors'][$offset]->{'vendor_id'}; |
|
119 | - } else { |
|
120 | - echo 'The vendors numbers are less than offset'; |
|
121 | - |
|
122 | - return null; |
|
123 | - } |
|
124 | - } |
|
125 | - } |
|
126 | - |
|
127 | - $randNumber = rand($offset, $limit); |
|
128 | - |
|
129 | - return $allVendors['vendors'][$randNumber]['id']; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Register telematics member |
|
134 | - * @param TelematicsVendorParameters $params contains: |
|
135 | - * @param integer member_id : member ID |
|
136 | - * @param string api_key : API key |
|
137 | - * @return array from a TelematicsRegisterMemberResponse type object |
|
138 | - * @throws \Route4Me\Exception\ApiError |
|
139 | - */ |
|
140 | - public static function RegisterTelematicsMember($params) |
|
141 | - { |
|
142 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
143 | - |
|
144 | - $allQueryFields = ['member_id', 'api_key']; |
|
145 | - |
|
146 | - $vendors = Route4Me::makeRequst([ |
|
147 | - 'url' => Endpoint::TELEMATICS_REGISTER_MEMBER, |
|
148 | - 'method' => 'GET', |
|
149 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
150 | - ]); |
|
151 | - |
|
152 | - return $vendors; |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Get a vendor by ID |
|
157 | - * @param string $vendorId |
|
158 | - * @return TelematicsVendor type object |
|
159 | - */ |
|
160 | - public static function getVendorById($vendorId) |
|
161 | - { |
|
162 | - if ($vendorId!=null) { |
|
163 | - return self::GetTelematicsVendors($vendorId); |
|
164 | - } else { |
|
165 | - return null; |
|
166 | - } |
|
167 | - } |
|
76 | + /** |
|
77 | + * An array the vendor features |
|
78 | + * @var TelematicsVendorFeature[] |
|
79 | + */ |
|
80 | + public $features = []; |
|
81 | + |
|
82 | + /** |
|
83 | + * Get vendor(s), search for vendors, compare vendors. |
|
84 | + * @param TelematicsVendorParameters $params |
|
85 | + * @return TelematicsVendorResponse or TelematicsVendorsResponse. |
|
86 | + */ |
|
87 | + public static function GetTelematicsVendors($params) |
|
88 | + { |
|
89 | + Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
|
90 | + |
|
91 | + $allQueryFields = ['vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors']; |
|
92 | + |
|
93 | + $vendors = Route4Me::makeRequst([ |
|
94 | + 'url' => '', |
|
95 | + 'method' => 'GET', |
|
96 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
97 | + ]); |
|
98 | + |
|
99 | + return $vendors; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Returns a random telematics vendor (for tests). |
|
104 | + * @param $offset integer |
|
105 | + * @param $limit integer |
|
106 | + * @return Telematics vendor |
|
107 | + */ |
|
108 | + public static function GetRandomVendorID($offset, $limit) |
|
109 | + { |
|
110 | + $allVendors = self::GetTelematicsVendors(null); |
|
111 | + $vendorsNumber = sizeof($allVendors['vendors']); |
|
112 | + |
|
113 | + if ($vendorsNumber < $limit) { |
|
114 | + if ($vendorsNumber > $offset) { |
|
115 | + $limit = $vendorsNumber; |
|
116 | + } else { |
|
117 | + if ($vendorsNumber == $offset) { |
|
118 | + return $allVendors['vendors'][$offset]->{'vendor_id'}; |
|
119 | + } else { |
|
120 | + echo 'The vendors numbers are less than offset'; |
|
121 | + |
|
122 | + return null; |
|
123 | + } |
|
124 | + } |
|
125 | + } |
|
126 | + |
|
127 | + $randNumber = rand($offset, $limit); |
|
128 | + |
|
129 | + return $allVendors['vendors'][$randNumber]['id']; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Register telematics member |
|
134 | + * @param TelematicsVendorParameters $params contains: |
|
135 | + * @param integer member_id : member ID |
|
136 | + * @param string api_key : API key |
|
137 | + * @return array from a TelematicsRegisterMemberResponse type object |
|
138 | + * @throws \Route4Me\Exception\ApiError |
|
139 | + */ |
|
140 | + public static function RegisterTelematicsMember($params) |
|
141 | + { |
|
142 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
143 | + |
|
144 | + $allQueryFields = ['member_id', 'api_key']; |
|
145 | + |
|
146 | + $vendors = Route4Me::makeRequst([ |
|
147 | + 'url' => Endpoint::TELEMATICS_REGISTER_MEMBER, |
|
148 | + 'method' => 'GET', |
|
149 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
150 | + ]); |
|
151 | + |
|
152 | + return $vendors; |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Get a vendor by ID |
|
157 | + * @param string $vendorId |
|
158 | + * @return TelematicsVendor type object |
|
159 | + */ |
|
160 | + public static function getVendorById($vendorId) |
|
161 | + { |
|
162 | + if ($vendorId!=null) { |
|
163 | + return self::GetTelematicsVendors($vendorId); |
|
164 | + } else { |
|
165 | + return null; |
|
166 | + } |
|
167 | + } |
|
168 | 168 | } |
@@ -14,687 +14,687 @@ |
||
14 | 14 | */ |
15 | 15 | class AddressBookLocation extends Common |
16 | 16 | { |
17 | - /** |
|
18 | - * A territory shape name the contact belongs. |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - public $address_id; |
|
22 | - |
|
23 | - /** |
|
24 | - * A group the contact belongs. |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - public $address_group; |
|
28 | - |
|
29 | - /** |
|
30 | - * The contact's alias. |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - public $address_alias; |
|
34 | - |
|
35 | - /** |
|
36 | - * The geographic address of the contact. |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - public $address_1; |
|
40 | - |
|
41 | - /** |
|
42 | - * Second geographic address of the contact. |
|
43 | - * @var string |
|
44 | - */ |
|
45 | - public $address_2; |
|
46 | - |
|
47 | - /** |
|
48 | - * The first name of the contact person. |
|
49 | - * @var string |
|
50 | - */ |
|
51 | - public $first_name; |
|
52 | - |
|
53 | - /** |
|
54 | - * The last name of the contact person. |
|
55 | - * @var string |
|
56 | - */ |
|
57 | - public $last_name; |
|
58 | - |
|
59 | - /** |
|
60 | - * The contact's email. |
|
61 | - * @var string |
|
62 | - */ |
|
63 | - public $address_email; |
|
64 | - |
|
65 | - /** |
|
66 | - * The contact's phone number. |
|
67 | - * @var string |
|
68 | - */ |
|
69 | - public $address_phone_number; |
|
70 | - |
|
71 | - /** |
|
72 | - * A city the contact belongs. |
|
73 | - * @var string |
|
74 | - */ |
|
75 | - public $address_city; |
|
76 | - |
|
77 | - /** |
|
78 | - * The ID of the state the contact belongs. |
|
79 | - * @var string |
|
80 | - */ |
|
81 | - public $address_state_id; |
|
82 | - |
|
83 | - /** |
|
84 | - * The ID of the country the contact belongs. |
|
85 | - * @var string |
|
86 | - */ |
|
87 | - public $address_country_id; |
|
88 | - |
|
89 | - /** |
|
90 | - * The contact's ZIP code. |
|
91 | - * @var string |
|
92 | - */ |
|
93 | - public $address_zip; |
|
94 | - |
|
95 | - /** |
|
96 | - * A latitude of the contact's cached position. |
|
97 | - * @var double |
|
98 | - */ |
|
99 | - public $cached_lat; |
|
100 | - |
|
101 | - /** |
|
102 | - * A longitude of the contact's cached position. |
|
103 | - * @var double |
|
104 | - */ |
|
105 | - public $cached_lng; |
|
106 | - |
|
107 | - /** |
|
108 | - * A latitude of the contact's curbside. |
|
109 | - * @var double |
|
110 | - */ |
|
111 | - public $curbside_lat; |
|
112 | - |
|
113 | - /** |
|
114 | - * A longitude of the contact's curbside. |
|
115 | - * @var double |
|
116 | - */ |
|
117 | - public $curbside_lng; |
|
118 | - |
|
119 | - /** |
|
120 | - * The contact's color on the map. |
|
121 | - * @var string |
|
122 | - */ |
|
123 | - public $color; |
|
124 | - |
|
125 | - /** |
|
126 | - * An array of the contact's custom field-value pairs. |
|
127 | - * @var array |
|
128 | - */ |
|
129 | - public $address_custom_data; |
|
130 | - |
|
131 | - /** |
|
132 | - * An array of the contact's schedules. |
|
133 | - * @var Schedule[] |
|
134 | - */ |
|
135 | - public $schedule; |
|
136 | - |
|
137 | - /** |
|
138 | - * Time when the contact was created. |
|
139 | - * @var long |
|
140 | - */ |
|
141 | - public $created_timestamp; |
|
142 | - |
|
143 | - /** |
|
144 | - * Unique ID of the member. |
|
145 | - * @var integer |
|
146 | - */ |
|
147 | - public $member_id; |
|
148 | - |
|
149 | - /** |
|
150 | - * The list of dates that should be omitted from the schedules. |
|
151 | - * @var string[] |
|
152 | - */ |
|
153 | - public $schedule_blacklist; |
|
154 | - |
|
155 | - /** |
|
156 | - * Number of the routes containing the contact. |
|
157 | - * @var integer |
|
158 | - */ |
|
159 | - public $in_route_count; |
|
160 | - |
|
161 | - /** |
|
162 | - * When the contact was last visited. |
|
163 | - * @var long |
|
164 | - */ |
|
165 | - public $last_visited_timestamp; |
|
166 | - |
|
167 | - /** |
|
168 | - * When the contact was last routed. |
|
169 | - * @var long |
|
170 | - */ |
|
171 | - public $last_routed_timestamp; |
|
172 | - |
|
173 | - /** |
|
174 | - * Start of the contact's local time window. |
|
175 | - * @var long |
|
176 | - */ |
|
177 | - public $local_time_window_start; |
|
178 | - |
|
179 | - /** |
|
180 | - * End of the contact's local time window. |
|
181 | - * @var long |
|
182 | - */ |
|
183 | - public $local_time_window_end; |
|
184 | - |
|
185 | - /** |
|
186 | - * Start of the contact's second local time window. |
|
187 | - * @var long |
|
188 | - */ |
|
189 | - public $local_time_window_start_2; |
|
190 | - |
|
191 | - /** |
|
192 | - * End of the contact's second local time window. |
|
193 | - * @var long |
|
194 | - */ |
|
195 | - public $local_time_window_end_2; |
|
196 | - |
|
197 | - /** |
|
198 | - * The service time at the contact's address. |
|
199 | - * @var integer |
|
200 | - */ |
|
201 | - public $service_time; |
|
202 | - |
|
203 | - /** |
|
204 | - * The contact's local timezone. |
|
205 | - * @var string |
|
206 | - */ |
|
207 | - public $local_timezone_string; |
|
208 | - |
|
209 | - /** |
|
210 | - * The contact's icon on the map. |
|
211 | - * @var string |
|
212 | - */ |
|
213 | - public $address_icon; |
|
214 | - |
|
215 | - /** |
|
216 | - * The contact's stop type. |
|
217 | - * @var string |
|
218 | - */ |
|
219 | - public $address_stop_type; |
|
220 | - |
|
221 | - /** |
|
222 | - * The cubic volume of the contact's cargo. |
|
223 | - * @var double |
|
224 | - */ |
|
225 | - public $address_cube; |
|
226 | - |
|
227 | - /** |
|
228 | - * The number of pieces/pallets that this destination/order/line-item consumes/contains on a vehicle. |
|
229 | - * @var integer |
|
230 | - */ |
|
231 | - public $address_pieces; |
|
232 | - |
|
233 | - /** |
|
234 | - * The reference number of the address. |
|
235 | - * @var string |
|
236 | - */ |
|
237 | - public $address_reference_no; |
|
238 | - |
|
239 | - /** |
|
240 | - * The revenue from the contact. |
|
241 | - * @var double |
|
242 | - */ |
|
243 | - public $address_revenue; |
|
244 | - |
|
245 | - /** |
|
246 | - * The weight of the contact's cargo. |
|
247 | - * @var double |
|
248 | - */ |
|
249 | - public $address_weight; |
|
250 | - |
|
251 | - /** |
|
252 | - * If present, the priority will sequence addresses in all the optimal routes so that |
|
253 | - * higher priority addresses are general at the beginning of the route sequence.<br> |
|
254 | - * 1 is the highest priority, 100000 is the lowest. |
|
255 | - * @var integer |
|
256 | - */ |
|
257 | - public $address_priority; |
|
258 | - |
|
259 | - /** |
|
260 | - * The customer purchase order of the contact. |
|
261 | - * @var string |
|
262 | - */ |
|
263 | - public $address_customer_po; |
|
264 | - |
|
265 | - public function __construct() |
|
266 | - { |
|
267 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
268 | - } |
|
269 | - |
|
270 | - /** |
|
271 | - * @deprecated 1.2.8 |
|
272 | - * @see \Route4Me\V5\AddressBook\AddressBook::getAddressById() |
|
273 | - */ |
|
274 | - public static function getAddressBookLocation($addressId) |
|
275 | - { |
|
276 | - $ablocations = Route4Me::makeRequst([ |
|
277 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
278 | - 'method' => 'GET', |
|
279 | - 'query' => [ |
|
280 | - 'query' => $addressId, |
|
281 | - 'limit' => 30, |
|
282 | - ], |
|
283 | - ]); |
|
284 | - |
|
285 | - return $ablocations; |
|
286 | - } |
|
287 | - |
|
288 | - /** |
|
289 | - * @deprecated 1.2.8 |
|
290 | - * @see \Route4Me\V5\AddressBook\AddressBook::getAddressesByBodyPayload() |
|
291 | - */ |
|
292 | - public static function searchAddressBookLocations($params) |
|
293 | - { |
|
294 | - $allQueryFields = ['display', 'query', 'fields', 'limit', 'offset']; |
|
295 | - |
|
296 | - $result = Route4Me::makeRequst([ |
|
297 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
298 | - 'method' => 'GET', |
|
299 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
300 | - ]); |
|
301 | - |
|
302 | - return $result; |
|
303 | - } |
|
304 | - |
|
305 | - /** |
|
306 | - * @deprecated 1.2.8 |
|
307 | - * @see \Route4Me\V5\AddressBook\AddressBook::getAddressesByIds() |
|
308 | - */ |
|
309 | - public static function getAddressBookLocations($params) |
|
310 | - { |
|
311 | - $allQueryFields = ['limit', 'offset', 'address_id']; |
|
312 | - |
|
313 | - $ablocations = Route4Me::makeRequst([ |
|
314 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
315 | - 'method' => 'GET', |
|
316 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
317 | - ]); |
|
318 | - |
|
319 | - return $ablocations; |
|
320 | - } |
|
321 | - |
|
322 | - public static function getRandomAddressBookLocation($params) |
|
323 | - { |
|
324 | - $ablocations = self::getAddressBookLocations($params); |
|
325 | - |
|
326 | - if (isset($ablocations['results'])) { |
|
327 | - $locationsSize = sizeof($ablocations['results']); |
|
328 | - |
|
329 | - if ($locationsSize > 0) { |
|
330 | - $randomLocationIndex = rand(0, $locationsSize - 1); |
|
331 | - |
|
332 | - return $ablocations['results'][$randomLocationIndex]; |
|
333 | - } |
|
334 | - } |
|
335 | - |
|
336 | - return null; |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * @deprecated 1.2.8 |
|
341 | - * @see \Route4Me\V5\AddressBook\AddressBook::addAddress() |
|
342 | - * |
|
343 | - * @param AddressBookLocation $params |
|
344 | - */ |
|
345 | - public static function addAdressBookLocation($params) |
|
346 | - { |
|
347 | - $allBodyFields = Route4Me::getObjectProperties(new self(), ['address_id', 'in_route_count']); |
|
348 | - |
|
349 | - $response = Route4Me::makeRequst([ |
|
350 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
351 | - 'method' => 'POST', |
|
352 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
353 | - ]); |
|
354 | - |
|
355 | - return $response; |
|
356 | - } |
|
357 | - |
|
358 | - /** |
|
359 | - * @deprecated 1.2.8 |
|
360 | - * @see \Route4Me\V5\AddressBook\AddressBook::deleteAddressesByIds() |
|
361 | - */ |
|
362 | - public function deleteAdressBookLocation($address_ids) |
|
363 | - { |
|
364 | - $result = Route4Me::makeRequst([ |
|
365 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
366 | - 'method' => 'DELETEARRAY', |
|
367 | - 'query' => [ |
|
368 | - 'address_ids' => $address_ids, |
|
369 | - ], |
|
370 | - ]); |
|
371 | - |
|
372 | - return $result; |
|
373 | - } |
|
374 | - |
|
375 | - /** |
|
376 | - * @deprecated 1.2.8 |
|
377 | - * @see \Route4Me\V5\AddressBook\AddressBook::updateAddressById() |
|
378 | - */ |
|
379 | - public function updateAddressBookLocation($params) |
|
380 | - { |
|
381 | - $allBodyFields = Route4Me::getObjectProperties(new self(), ['in_route_count']); |
|
382 | - |
|
383 | - $response = Route4Me::makeRequst([ |
|
384 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
385 | - 'method' => 'PUT', |
|
386 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
387 | - ]); |
|
388 | - |
|
389 | - return $response; |
|
390 | - } |
|
391 | - |
|
392 | - public static function validateScheduleMode($scheduleMode) |
|
393 | - { |
|
394 | - $schedModes = ['daily', 'weekly', 'monthly', 'annually']; |
|
395 | - |
|
396 | - if (in_array($scheduleMode, $schedModes)) { |
|
397 | - return true; |
|
398 | - } else { |
|
399 | - return false; |
|
400 | - } |
|
401 | - } |
|
402 | - |
|
403 | - public static function validateScheduleEnable($scheduleEnabled) |
|
404 | - { |
|
405 | - if (is_string($scheduleEnabled)) { |
|
406 | - if (strtolower($scheduleEnabled)=="true") $scheduleEnabled = true; |
|
407 | - if (strtolower($scheduleEnabled)=="false") $scheduleEnabled = false; |
|
408 | - } |
|
409 | - |
|
410 | - $schedEnables = [true, false,]; |
|
411 | - |
|
412 | - if (in_array($scheduleEnabled, $schedEnables,true)) { |
|
413 | - return true; |
|
414 | - } else { |
|
415 | - return false; |
|
416 | - } |
|
417 | - } |
|
418 | - |
|
419 | - public static function validateScheduleEvery($scheduleEvery) |
|
420 | - { |
|
421 | - if (is_numeric($scheduleEvery)) { |
|
422 | - if ($scheduleEvery>0) { |
|
423 | - return true; |
|
424 | - } else { |
|
425 | - return false; |
|
426 | - } |
|
427 | - } else { |
|
428 | - return false; |
|
429 | - } |
|
430 | - } |
|
431 | - |
|
432 | - public static function validateScheduleWeekDays($scheduleWeekDays) |
|
433 | - { |
|
434 | - if (is_bool($scheduleWeekDays)) return false; |
|
435 | - |
|
436 | - $weekdays = explode(',', $scheduleWeekDays); |
|
437 | - $weekdaysSize = sizeof($weekdays); |
|
438 | - |
|
439 | - if ($weekdaysSize < 1) { |
|
440 | - return false; |
|
441 | - } |
|
442 | - |
|
443 | - $isValid = true; |
|
444 | - |
|
445 | - for ($i = 0; $i < $weekdaysSize; ++$i) { |
|
446 | - if (is_bool($weekdays[$i])) { |
|
447 | - $isValid = false; |
|
448 | - } elseif (is_numeric($weekdays[$i])) { |
|
449 | - $wday = intval($weekdays[$i]); |
|
450 | - if ($wday < 1 || $wday > 7) { |
|
451 | - $isValid = false; |
|
452 | - } |
|
453 | - } else { |
|
454 | - $isValid = false; |
|
455 | - } |
|
456 | - } |
|
457 | - |
|
458 | - return $isValid; |
|
459 | - } |
|
460 | - |
|
461 | - public static function validateScheduleMonthlyMode($scheduleMonthlyMode) |
|
462 | - { |
|
463 | - $schedMonthlyMmodes = ['dates', 'nth']; |
|
464 | - |
|
465 | - if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes,true)) { |
|
466 | - return true; |
|
467 | - } else { |
|
468 | - return false; |
|
469 | - } |
|
470 | - } |
|
471 | - |
|
472 | - public static function validateScheduleMonthlyDates($scheduleMonthlyDates) |
|
473 | - { |
|
474 | - if (is_bool($scheduleMonthlyDates)) return false; |
|
475 | - |
|
476 | - $monthlyDates = explode(',', $scheduleMonthlyDates); |
|
477 | - $monthlyDatesSize = sizeof($monthlyDates); |
|
478 | - |
|
479 | - if ($monthlyDatesSize < 1) { |
|
480 | - return false; |
|
481 | - } |
|
482 | - |
|
483 | - $isValid = true; |
|
484 | - |
|
485 | - for ($i = 0; $i < $monthlyDatesSize; ++$i) { |
|
486 | - if (is_numeric($monthlyDates[$i])) { |
|
487 | - $mday = intval($monthlyDates[$i]); |
|
488 | - if ($mday < 1 || $mday > 31) { |
|
489 | - $isValid = false; |
|
490 | - } |
|
491 | - } else { |
|
492 | - $isValid = false; |
|
493 | - } |
|
494 | - } |
|
495 | - |
|
496 | - return $isValid; |
|
497 | - } |
|
498 | - |
|
499 | - public static function validateScheduleNthN($scheduleNthN) |
|
500 | - { |
|
501 | - if (!is_numeric($scheduleNthN)) { |
|
502 | - return false; |
|
503 | - } |
|
504 | - |
|
505 | - $schedNthNs = [1, 2, 3, 4, 5, -1]; |
|
506 | - |
|
507 | - if (in_array($scheduleNthN, $schedNthNs)) { |
|
508 | - return true; |
|
509 | - } else { |
|
510 | - return false; |
|
511 | - } |
|
512 | - } |
|
513 | - |
|
514 | - public static function validateScheduleNthWhat($scheduleNthWhat) |
|
515 | - { |
|
516 | - if (!is_numeric($scheduleNthWhat)) { |
|
517 | - return false; |
|
518 | - } |
|
519 | - |
|
520 | - $schedNthWhats = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
|
521 | - |
|
522 | - if (in_array($scheduleNthWhat, $schedNthWhats)) { |
|
523 | - return true; |
|
524 | - } else { |
|
525 | - return false; |
|
526 | - } |
|
527 | - } |
|
528 | - |
|
529 | - /** Function adds the locations (with/without schedule) from the CSV file. |
|
530 | - * $csvFileHandle - a file handler. |
|
531 | - * Returns array $results which contains two arrays: fail and succes. |
|
532 | - */ |
|
533 | - public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping) |
|
534 | - { |
|
535 | - $max_line_length = 512; |
|
536 | - $delemietr = ','; |
|
537 | - |
|
538 | - $results = []; |
|
539 | - $results['fail'] = []; |
|
540 | - $results['success'] = []; |
|
541 | - |
|
542 | - $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
543 | - |
|
544 | - $addressBookFields = Route4Me::getObjectProperties(new self(), ['address_id', 'in_route_count']); |
|
545 | - |
|
546 | - if (empty($columns)) { |
|
547 | - array_push($results['fail'], 'Empty CSV table'); |
|
548 | - |
|
549 | - return $results; |
|
550 | - } |
|
551 | - |
|
552 | - $iRow = 1; |
|
553 | - |
|
554 | - while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
555 | - if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) |
|
556 | - || !isset($rows[$locationsFieldsMapping['address_1']]) || [null] == $rows) { |
|
557 | - continue; |
|
558 | - } |
|
559 | - |
|
560 | - $curSchedule = ''; |
|
561 | - $mode = ''; |
|
562 | - |
|
563 | - $failCount = sizeof($results['fail']); |
|
564 | - |
|
565 | - if (isset($rows[$locationsFieldsMapping['schedule_mode']])) { |
|
566 | - if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) { |
|
567 | - $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; |
|
568 | - $mode = $rows[$locationsFieldsMapping['schedule_mode']]; |
|
569 | - } else { |
|
570 | - array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); |
|
571 | - } |
|
572 | - } else { |
|
573 | - array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); |
|
574 | - } |
|
575 | - |
|
576 | - if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) { |
|
577 | - if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { |
|
578 | - $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].','; |
|
579 | - } else { |
|
580 | - array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set "); |
|
581 | - } |
|
582 | - } |
|
583 | - |
|
584 | - if (isset($rows[$locationsFieldsMapping['schedule_every']])) { |
|
585 | - if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) { |
|
586 | - $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
587 | - if ('daily' == $mode) { |
|
588 | - $curSchedule = trim($curSchedule, ','); |
|
589 | - $curSchedule .= '}'; |
|
590 | - } |
|
591 | - } else { |
|
592 | - array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); |
|
593 | - } |
|
594 | - } |
|
595 | - |
|
596 | - if ('daily' != $mode) { |
|
597 | - switch ($mode) { |
|
598 | - case 'weekly': |
|
599 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
600 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
601 | - $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
602 | - } else { |
|
603 | - array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
604 | - } |
|
605 | - } else { |
|
606 | - array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
607 | - } |
|
608 | - break; |
|
609 | - case 'monthly': |
|
610 | - $monthlyMode = ''; |
|
611 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
612 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
613 | - $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
614 | - $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
615 | - } else { |
|
616 | - array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
617 | - } |
|
618 | - } else { |
|
619 | - array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
620 | - } |
|
621 | - |
|
622 | - if ('' != $monthlyMode) { |
|
623 | - switch ($monthlyMode) { |
|
624 | - case 'dates': |
|
625 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
626 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
627 | - $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
628 | - } else { |
|
629 | - array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
630 | - } |
|
631 | - } |
|
632 | - break; |
|
633 | - case 'nth': |
|
634 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
635 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
636 | - $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
637 | - } else { |
|
638 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
639 | - } |
|
640 | - } else { |
|
641 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
642 | - } |
|
643 | - |
|
644 | - if ('' != $curSchedule) { |
|
645 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
646 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
647 | - $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}'; |
|
648 | - } else { |
|
649 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
650 | - } |
|
651 | - } else { |
|
652 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
653 | - } |
|
654 | - } |
|
655 | - break; |
|
656 | - } |
|
657 | - } |
|
658 | - break; |
|
659 | - default: |
|
660 | - $curSchedule = ''; |
|
661 | - break; |
|
662 | - } |
|
663 | - } |
|
664 | - |
|
665 | - if (sizeof($results['fail']) > $failCount) { |
|
666 | - $curSchedule = ''; |
|
667 | - } |
|
668 | - |
|
669 | - if (('daily' == $mode || 'weekly' == $mode || 'monthy' == $mode) && '' == $curSchedule) { |
|
670 | - ++$iRow; |
|
671 | - continue; |
|
672 | - } |
|
673 | - |
|
674 | - $curSchedule = strtolower($curSchedule); |
|
675 | - |
|
676 | - $curSchedule = '[{'.$curSchedule.'}]'; |
|
677 | - |
|
678 | - $parametersArray = []; |
|
679 | - |
|
680 | - foreach ($addressBookFields as $addressBookField) { |
|
681 | - if (isset($locationsFieldsMapping[$addressBookField])) { |
|
682 | - $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]]; |
|
683 | - } |
|
684 | - } |
|
685 | - |
|
686 | - $AdressBookLocationParameters = self::fromArray($parametersArray); |
|
687 | - |
|
688 | - $abContacts = new self(); |
|
689 | - |
|
690 | - $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry |
|
691 | - |
|
692 | - array_push( |
|
693 | - $results['success'], |
|
694 | - 'The schedule location with address_id = '.strval($abcResults['address_id']).' added successfuly.' |
|
695 | - ); |
|
696 | - } |
|
697 | - |
|
698 | - return $results; |
|
699 | - } |
|
17 | + /** |
|
18 | + * A territory shape name the contact belongs. |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + public $address_id; |
|
22 | + |
|
23 | + /** |
|
24 | + * A group the contact belongs. |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + public $address_group; |
|
28 | + |
|
29 | + /** |
|
30 | + * The contact's alias. |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + public $address_alias; |
|
34 | + |
|
35 | + /** |
|
36 | + * The geographic address of the contact. |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + public $address_1; |
|
40 | + |
|
41 | + /** |
|
42 | + * Second geographic address of the contact. |
|
43 | + * @var string |
|
44 | + */ |
|
45 | + public $address_2; |
|
46 | + |
|
47 | + /** |
|
48 | + * The first name of the contact person. |
|
49 | + * @var string |
|
50 | + */ |
|
51 | + public $first_name; |
|
52 | + |
|
53 | + /** |
|
54 | + * The last name of the contact person. |
|
55 | + * @var string |
|
56 | + */ |
|
57 | + public $last_name; |
|
58 | + |
|
59 | + /** |
|
60 | + * The contact's email. |
|
61 | + * @var string |
|
62 | + */ |
|
63 | + public $address_email; |
|
64 | + |
|
65 | + /** |
|
66 | + * The contact's phone number. |
|
67 | + * @var string |
|
68 | + */ |
|
69 | + public $address_phone_number; |
|
70 | + |
|
71 | + /** |
|
72 | + * A city the contact belongs. |
|
73 | + * @var string |
|
74 | + */ |
|
75 | + public $address_city; |
|
76 | + |
|
77 | + /** |
|
78 | + * The ID of the state the contact belongs. |
|
79 | + * @var string |
|
80 | + */ |
|
81 | + public $address_state_id; |
|
82 | + |
|
83 | + /** |
|
84 | + * The ID of the country the contact belongs. |
|
85 | + * @var string |
|
86 | + */ |
|
87 | + public $address_country_id; |
|
88 | + |
|
89 | + /** |
|
90 | + * The contact's ZIP code. |
|
91 | + * @var string |
|
92 | + */ |
|
93 | + public $address_zip; |
|
94 | + |
|
95 | + /** |
|
96 | + * A latitude of the contact's cached position. |
|
97 | + * @var double |
|
98 | + */ |
|
99 | + public $cached_lat; |
|
100 | + |
|
101 | + /** |
|
102 | + * A longitude of the contact's cached position. |
|
103 | + * @var double |
|
104 | + */ |
|
105 | + public $cached_lng; |
|
106 | + |
|
107 | + /** |
|
108 | + * A latitude of the contact's curbside. |
|
109 | + * @var double |
|
110 | + */ |
|
111 | + public $curbside_lat; |
|
112 | + |
|
113 | + /** |
|
114 | + * A longitude of the contact's curbside. |
|
115 | + * @var double |
|
116 | + */ |
|
117 | + public $curbside_lng; |
|
118 | + |
|
119 | + /** |
|
120 | + * The contact's color on the map. |
|
121 | + * @var string |
|
122 | + */ |
|
123 | + public $color; |
|
124 | + |
|
125 | + /** |
|
126 | + * An array of the contact's custom field-value pairs. |
|
127 | + * @var array |
|
128 | + */ |
|
129 | + public $address_custom_data; |
|
130 | + |
|
131 | + /** |
|
132 | + * An array of the contact's schedules. |
|
133 | + * @var Schedule[] |
|
134 | + */ |
|
135 | + public $schedule; |
|
136 | + |
|
137 | + /** |
|
138 | + * Time when the contact was created. |
|
139 | + * @var long |
|
140 | + */ |
|
141 | + public $created_timestamp; |
|
142 | + |
|
143 | + /** |
|
144 | + * Unique ID of the member. |
|
145 | + * @var integer |
|
146 | + */ |
|
147 | + public $member_id; |
|
148 | + |
|
149 | + /** |
|
150 | + * The list of dates that should be omitted from the schedules. |
|
151 | + * @var string[] |
|
152 | + */ |
|
153 | + public $schedule_blacklist; |
|
154 | + |
|
155 | + /** |
|
156 | + * Number of the routes containing the contact. |
|
157 | + * @var integer |
|
158 | + */ |
|
159 | + public $in_route_count; |
|
160 | + |
|
161 | + /** |
|
162 | + * When the contact was last visited. |
|
163 | + * @var long |
|
164 | + */ |
|
165 | + public $last_visited_timestamp; |
|
166 | + |
|
167 | + /** |
|
168 | + * When the contact was last routed. |
|
169 | + * @var long |
|
170 | + */ |
|
171 | + public $last_routed_timestamp; |
|
172 | + |
|
173 | + /** |
|
174 | + * Start of the contact's local time window. |
|
175 | + * @var long |
|
176 | + */ |
|
177 | + public $local_time_window_start; |
|
178 | + |
|
179 | + /** |
|
180 | + * End of the contact's local time window. |
|
181 | + * @var long |
|
182 | + */ |
|
183 | + public $local_time_window_end; |
|
184 | + |
|
185 | + /** |
|
186 | + * Start of the contact's second local time window. |
|
187 | + * @var long |
|
188 | + */ |
|
189 | + public $local_time_window_start_2; |
|
190 | + |
|
191 | + /** |
|
192 | + * End of the contact's second local time window. |
|
193 | + * @var long |
|
194 | + */ |
|
195 | + public $local_time_window_end_2; |
|
196 | + |
|
197 | + /** |
|
198 | + * The service time at the contact's address. |
|
199 | + * @var integer |
|
200 | + */ |
|
201 | + public $service_time; |
|
202 | + |
|
203 | + /** |
|
204 | + * The contact's local timezone. |
|
205 | + * @var string |
|
206 | + */ |
|
207 | + public $local_timezone_string; |
|
208 | + |
|
209 | + /** |
|
210 | + * The contact's icon on the map. |
|
211 | + * @var string |
|
212 | + */ |
|
213 | + public $address_icon; |
|
214 | + |
|
215 | + /** |
|
216 | + * The contact's stop type. |
|
217 | + * @var string |
|
218 | + */ |
|
219 | + public $address_stop_type; |
|
220 | + |
|
221 | + /** |
|
222 | + * The cubic volume of the contact's cargo. |
|
223 | + * @var double |
|
224 | + */ |
|
225 | + public $address_cube; |
|
226 | + |
|
227 | + /** |
|
228 | + * The number of pieces/pallets that this destination/order/line-item consumes/contains on a vehicle. |
|
229 | + * @var integer |
|
230 | + */ |
|
231 | + public $address_pieces; |
|
232 | + |
|
233 | + /** |
|
234 | + * The reference number of the address. |
|
235 | + * @var string |
|
236 | + */ |
|
237 | + public $address_reference_no; |
|
238 | + |
|
239 | + /** |
|
240 | + * The revenue from the contact. |
|
241 | + * @var double |
|
242 | + */ |
|
243 | + public $address_revenue; |
|
244 | + |
|
245 | + /** |
|
246 | + * The weight of the contact's cargo. |
|
247 | + * @var double |
|
248 | + */ |
|
249 | + public $address_weight; |
|
250 | + |
|
251 | + /** |
|
252 | + * If present, the priority will sequence addresses in all the optimal routes so that |
|
253 | + * higher priority addresses are general at the beginning of the route sequence.<br> |
|
254 | + * 1 is the highest priority, 100000 is the lowest. |
|
255 | + * @var integer |
|
256 | + */ |
|
257 | + public $address_priority; |
|
258 | + |
|
259 | + /** |
|
260 | + * The customer purchase order of the contact. |
|
261 | + * @var string |
|
262 | + */ |
|
263 | + public $address_customer_po; |
|
264 | + |
|
265 | + public function __construct() |
|
266 | + { |
|
267 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
268 | + } |
|
269 | + |
|
270 | + /** |
|
271 | + * @deprecated 1.2.8 |
|
272 | + * @see \Route4Me\V5\AddressBook\AddressBook::getAddressById() |
|
273 | + */ |
|
274 | + public static function getAddressBookLocation($addressId) |
|
275 | + { |
|
276 | + $ablocations = Route4Me::makeRequst([ |
|
277 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
278 | + 'method' => 'GET', |
|
279 | + 'query' => [ |
|
280 | + 'query' => $addressId, |
|
281 | + 'limit' => 30, |
|
282 | + ], |
|
283 | + ]); |
|
284 | + |
|
285 | + return $ablocations; |
|
286 | + } |
|
287 | + |
|
288 | + /** |
|
289 | + * @deprecated 1.2.8 |
|
290 | + * @see \Route4Me\V5\AddressBook\AddressBook::getAddressesByBodyPayload() |
|
291 | + */ |
|
292 | + public static function searchAddressBookLocations($params) |
|
293 | + { |
|
294 | + $allQueryFields = ['display', 'query', 'fields', 'limit', 'offset']; |
|
295 | + |
|
296 | + $result = Route4Me::makeRequst([ |
|
297 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
298 | + 'method' => 'GET', |
|
299 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
300 | + ]); |
|
301 | + |
|
302 | + return $result; |
|
303 | + } |
|
304 | + |
|
305 | + /** |
|
306 | + * @deprecated 1.2.8 |
|
307 | + * @see \Route4Me\V5\AddressBook\AddressBook::getAddressesByIds() |
|
308 | + */ |
|
309 | + public static function getAddressBookLocations($params) |
|
310 | + { |
|
311 | + $allQueryFields = ['limit', 'offset', 'address_id']; |
|
312 | + |
|
313 | + $ablocations = Route4Me::makeRequst([ |
|
314 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
315 | + 'method' => 'GET', |
|
316 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
317 | + ]); |
|
318 | + |
|
319 | + return $ablocations; |
|
320 | + } |
|
321 | + |
|
322 | + public static function getRandomAddressBookLocation($params) |
|
323 | + { |
|
324 | + $ablocations = self::getAddressBookLocations($params); |
|
325 | + |
|
326 | + if (isset($ablocations['results'])) { |
|
327 | + $locationsSize = sizeof($ablocations['results']); |
|
328 | + |
|
329 | + if ($locationsSize > 0) { |
|
330 | + $randomLocationIndex = rand(0, $locationsSize - 1); |
|
331 | + |
|
332 | + return $ablocations['results'][$randomLocationIndex]; |
|
333 | + } |
|
334 | + } |
|
335 | + |
|
336 | + return null; |
|
337 | + } |
|
338 | + |
|
339 | + /** |
|
340 | + * @deprecated 1.2.8 |
|
341 | + * @see \Route4Me\V5\AddressBook\AddressBook::addAddress() |
|
342 | + * |
|
343 | + * @param AddressBookLocation $params |
|
344 | + */ |
|
345 | + public static function addAdressBookLocation($params) |
|
346 | + { |
|
347 | + $allBodyFields = Route4Me::getObjectProperties(new self(), ['address_id', 'in_route_count']); |
|
348 | + |
|
349 | + $response = Route4Me::makeRequst([ |
|
350 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
351 | + 'method' => 'POST', |
|
352 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
353 | + ]); |
|
354 | + |
|
355 | + return $response; |
|
356 | + } |
|
357 | + |
|
358 | + /** |
|
359 | + * @deprecated 1.2.8 |
|
360 | + * @see \Route4Me\V5\AddressBook\AddressBook::deleteAddressesByIds() |
|
361 | + */ |
|
362 | + public function deleteAdressBookLocation($address_ids) |
|
363 | + { |
|
364 | + $result = Route4Me::makeRequst([ |
|
365 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
366 | + 'method' => 'DELETEARRAY', |
|
367 | + 'query' => [ |
|
368 | + 'address_ids' => $address_ids, |
|
369 | + ], |
|
370 | + ]); |
|
371 | + |
|
372 | + return $result; |
|
373 | + } |
|
374 | + |
|
375 | + /** |
|
376 | + * @deprecated 1.2.8 |
|
377 | + * @see \Route4Me\V5\AddressBook\AddressBook::updateAddressById() |
|
378 | + */ |
|
379 | + public function updateAddressBookLocation($params) |
|
380 | + { |
|
381 | + $allBodyFields = Route4Me::getObjectProperties(new self(), ['in_route_count']); |
|
382 | + |
|
383 | + $response = Route4Me::makeRequst([ |
|
384 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
385 | + 'method' => 'PUT', |
|
386 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
387 | + ]); |
|
388 | + |
|
389 | + return $response; |
|
390 | + } |
|
391 | + |
|
392 | + public static function validateScheduleMode($scheduleMode) |
|
393 | + { |
|
394 | + $schedModes = ['daily', 'weekly', 'monthly', 'annually']; |
|
395 | + |
|
396 | + if (in_array($scheduleMode, $schedModes)) { |
|
397 | + return true; |
|
398 | + } else { |
|
399 | + return false; |
|
400 | + } |
|
401 | + } |
|
402 | + |
|
403 | + public static function validateScheduleEnable($scheduleEnabled) |
|
404 | + { |
|
405 | + if (is_string($scheduleEnabled)) { |
|
406 | + if (strtolower($scheduleEnabled)=="true") $scheduleEnabled = true; |
|
407 | + if (strtolower($scheduleEnabled)=="false") $scheduleEnabled = false; |
|
408 | + } |
|
409 | + |
|
410 | + $schedEnables = [true, false,]; |
|
411 | + |
|
412 | + if (in_array($scheduleEnabled, $schedEnables,true)) { |
|
413 | + return true; |
|
414 | + } else { |
|
415 | + return false; |
|
416 | + } |
|
417 | + } |
|
418 | + |
|
419 | + public static function validateScheduleEvery($scheduleEvery) |
|
420 | + { |
|
421 | + if (is_numeric($scheduleEvery)) { |
|
422 | + if ($scheduleEvery>0) { |
|
423 | + return true; |
|
424 | + } else { |
|
425 | + return false; |
|
426 | + } |
|
427 | + } else { |
|
428 | + return false; |
|
429 | + } |
|
430 | + } |
|
431 | + |
|
432 | + public static function validateScheduleWeekDays($scheduleWeekDays) |
|
433 | + { |
|
434 | + if (is_bool($scheduleWeekDays)) return false; |
|
435 | + |
|
436 | + $weekdays = explode(',', $scheduleWeekDays); |
|
437 | + $weekdaysSize = sizeof($weekdays); |
|
438 | + |
|
439 | + if ($weekdaysSize < 1) { |
|
440 | + return false; |
|
441 | + } |
|
442 | + |
|
443 | + $isValid = true; |
|
444 | + |
|
445 | + for ($i = 0; $i < $weekdaysSize; ++$i) { |
|
446 | + if (is_bool($weekdays[$i])) { |
|
447 | + $isValid = false; |
|
448 | + } elseif (is_numeric($weekdays[$i])) { |
|
449 | + $wday = intval($weekdays[$i]); |
|
450 | + if ($wday < 1 || $wday > 7) { |
|
451 | + $isValid = false; |
|
452 | + } |
|
453 | + } else { |
|
454 | + $isValid = false; |
|
455 | + } |
|
456 | + } |
|
457 | + |
|
458 | + return $isValid; |
|
459 | + } |
|
460 | + |
|
461 | + public static function validateScheduleMonthlyMode($scheduleMonthlyMode) |
|
462 | + { |
|
463 | + $schedMonthlyMmodes = ['dates', 'nth']; |
|
464 | + |
|
465 | + if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes,true)) { |
|
466 | + return true; |
|
467 | + } else { |
|
468 | + return false; |
|
469 | + } |
|
470 | + } |
|
471 | + |
|
472 | + public static function validateScheduleMonthlyDates($scheduleMonthlyDates) |
|
473 | + { |
|
474 | + if (is_bool($scheduleMonthlyDates)) return false; |
|
475 | + |
|
476 | + $monthlyDates = explode(',', $scheduleMonthlyDates); |
|
477 | + $monthlyDatesSize = sizeof($monthlyDates); |
|
478 | + |
|
479 | + if ($monthlyDatesSize < 1) { |
|
480 | + return false; |
|
481 | + } |
|
482 | + |
|
483 | + $isValid = true; |
|
484 | + |
|
485 | + for ($i = 0; $i < $monthlyDatesSize; ++$i) { |
|
486 | + if (is_numeric($monthlyDates[$i])) { |
|
487 | + $mday = intval($monthlyDates[$i]); |
|
488 | + if ($mday < 1 || $mday > 31) { |
|
489 | + $isValid = false; |
|
490 | + } |
|
491 | + } else { |
|
492 | + $isValid = false; |
|
493 | + } |
|
494 | + } |
|
495 | + |
|
496 | + return $isValid; |
|
497 | + } |
|
498 | + |
|
499 | + public static function validateScheduleNthN($scheduleNthN) |
|
500 | + { |
|
501 | + if (!is_numeric($scheduleNthN)) { |
|
502 | + return false; |
|
503 | + } |
|
504 | + |
|
505 | + $schedNthNs = [1, 2, 3, 4, 5, -1]; |
|
506 | + |
|
507 | + if (in_array($scheduleNthN, $schedNthNs)) { |
|
508 | + return true; |
|
509 | + } else { |
|
510 | + return false; |
|
511 | + } |
|
512 | + } |
|
513 | + |
|
514 | + public static function validateScheduleNthWhat($scheduleNthWhat) |
|
515 | + { |
|
516 | + if (!is_numeric($scheduleNthWhat)) { |
|
517 | + return false; |
|
518 | + } |
|
519 | + |
|
520 | + $schedNthWhats = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
|
521 | + |
|
522 | + if (in_array($scheduleNthWhat, $schedNthWhats)) { |
|
523 | + return true; |
|
524 | + } else { |
|
525 | + return false; |
|
526 | + } |
|
527 | + } |
|
528 | + |
|
529 | + /** Function adds the locations (with/without schedule) from the CSV file. |
|
530 | + * $csvFileHandle - a file handler. |
|
531 | + * Returns array $results which contains two arrays: fail and succes. |
|
532 | + */ |
|
533 | + public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping) |
|
534 | + { |
|
535 | + $max_line_length = 512; |
|
536 | + $delemietr = ','; |
|
537 | + |
|
538 | + $results = []; |
|
539 | + $results['fail'] = []; |
|
540 | + $results['success'] = []; |
|
541 | + |
|
542 | + $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
543 | + |
|
544 | + $addressBookFields = Route4Me::getObjectProperties(new self(), ['address_id', 'in_route_count']); |
|
545 | + |
|
546 | + if (empty($columns)) { |
|
547 | + array_push($results['fail'], 'Empty CSV table'); |
|
548 | + |
|
549 | + return $results; |
|
550 | + } |
|
551 | + |
|
552 | + $iRow = 1; |
|
553 | + |
|
554 | + while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
555 | + if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) |
|
556 | + || !isset($rows[$locationsFieldsMapping['address_1']]) || [null] == $rows) { |
|
557 | + continue; |
|
558 | + } |
|
559 | + |
|
560 | + $curSchedule = ''; |
|
561 | + $mode = ''; |
|
562 | + |
|
563 | + $failCount = sizeof($results['fail']); |
|
564 | + |
|
565 | + if (isset($rows[$locationsFieldsMapping['schedule_mode']])) { |
|
566 | + if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) { |
|
567 | + $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; |
|
568 | + $mode = $rows[$locationsFieldsMapping['schedule_mode']]; |
|
569 | + } else { |
|
570 | + array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); |
|
571 | + } |
|
572 | + } else { |
|
573 | + array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); |
|
574 | + } |
|
575 | + |
|
576 | + if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) { |
|
577 | + if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { |
|
578 | + $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].','; |
|
579 | + } else { |
|
580 | + array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set "); |
|
581 | + } |
|
582 | + } |
|
583 | + |
|
584 | + if (isset($rows[$locationsFieldsMapping['schedule_every']])) { |
|
585 | + if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) { |
|
586 | + $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
587 | + if ('daily' == $mode) { |
|
588 | + $curSchedule = trim($curSchedule, ','); |
|
589 | + $curSchedule .= '}'; |
|
590 | + } |
|
591 | + } else { |
|
592 | + array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); |
|
593 | + } |
|
594 | + } |
|
595 | + |
|
596 | + if ('daily' != $mode) { |
|
597 | + switch ($mode) { |
|
598 | + case 'weekly': |
|
599 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
600 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
601 | + $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
602 | + } else { |
|
603 | + array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
604 | + } |
|
605 | + } else { |
|
606 | + array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
607 | + } |
|
608 | + break; |
|
609 | + case 'monthly': |
|
610 | + $monthlyMode = ''; |
|
611 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
612 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
613 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
614 | + $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
615 | + } else { |
|
616 | + array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
617 | + } |
|
618 | + } else { |
|
619 | + array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
620 | + } |
|
621 | + |
|
622 | + if ('' != $monthlyMode) { |
|
623 | + switch ($monthlyMode) { |
|
624 | + case 'dates': |
|
625 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
626 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
627 | + $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
628 | + } else { |
|
629 | + array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
630 | + } |
|
631 | + } |
|
632 | + break; |
|
633 | + case 'nth': |
|
634 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
635 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
636 | + $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
637 | + } else { |
|
638 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
639 | + } |
|
640 | + } else { |
|
641 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
642 | + } |
|
643 | + |
|
644 | + if ('' != $curSchedule) { |
|
645 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
646 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
647 | + $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}'; |
|
648 | + } else { |
|
649 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
650 | + } |
|
651 | + } else { |
|
652 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
653 | + } |
|
654 | + } |
|
655 | + break; |
|
656 | + } |
|
657 | + } |
|
658 | + break; |
|
659 | + default: |
|
660 | + $curSchedule = ''; |
|
661 | + break; |
|
662 | + } |
|
663 | + } |
|
664 | + |
|
665 | + if (sizeof($results['fail']) > $failCount) { |
|
666 | + $curSchedule = ''; |
|
667 | + } |
|
668 | + |
|
669 | + if (('daily' == $mode || 'weekly' == $mode || 'monthy' == $mode) && '' == $curSchedule) { |
|
670 | + ++$iRow; |
|
671 | + continue; |
|
672 | + } |
|
673 | + |
|
674 | + $curSchedule = strtolower($curSchedule); |
|
675 | + |
|
676 | + $curSchedule = '[{'.$curSchedule.'}]'; |
|
677 | + |
|
678 | + $parametersArray = []; |
|
679 | + |
|
680 | + foreach ($addressBookFields as $addressBookField) { |
|
681 | + if (isset($locationsFieldsMapping[$addressBookField])) { |
|
682 | + $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]]; |
|
683 | + } |
|
684 | + } |
|
685 | + |
|
686 | + $AdressBookLocationParameters = self::fromArray($parametersArray); |
|
687 | + |
|
688 | + $abContacts = new self(); |
|
689 | + |
|
690 | + $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry |
|
691 | + |
|
692 | + array_push( |
|
693 | + $results['success'], |
|
694 | + 'The schedule location with address_id = '.strval($abcResults['address_id']).' added successfuly.' |
|
695 | + ); |
|
696 | + } |
|
697 | + |
|
698 | + return $results; |
|
699 | + } |
|
700 | 700 | } |
@@ -9,32 +9,32 @@ |
||
9 | 9 | */ |
10 | 10 | class CustomNoteType extends Common |
11 | 11 | { |
12 | - /** |
|
13 | - * Note custom entry ID |
|
14 | - * @var integer |
|
15 | - */ |
|
16 | - public $note_custom_entry_id; |
|
12 | + /** |
|
13 | + * Note custom entry ID |
|
14 | + * @var integer |
|
15 | + */ |
|
16 | + public $note_custom_entry_id; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Note ID |
|
20 | - * @var integer |
|
21 | - */ |
|
22 | - public $note_id; |
|
18 | + /** |
|
19 | + * Note ID |
|
20 | + * @var integer |
|
21 | + */ |
|
22 | + public $note_id; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Note custom type ID |
|
26 | - * @var integer |
|
27 | - */ |
|
28 | - public $note_custom_type_id; |
|
24 | + /** |
|
25 | + * Note custom type ID |
|
26 | + * @var integer |
|
27 | + */ |
|
28 | + public $note_custom_type_id; |
|
29 | 29 | |
30 | - /** |
|
31 | - * The value of a note custom type |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - public $note_custom_value; |
|
30 | + /** |
|
31 | + * The value of a note custom type |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + public $note_custom_value; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Note custom type |
|
38 | - */ |
|
39 | - public $note_custom_type; |
|
36 | + /** |
|
37 | + * Note custom type |
|
38 | + */ |
|
39 | + public $note_custom_type; |
|
40 | 40 | } |
@@ -11,63 +11,63 @@ |
||
11 | 11 | */ |
12 | 12 | class DirectionStep extends Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Name (detailed) |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - public $direction; |
|
14 | + /** |
|
15 | + * Name (detailed) |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + public $direction; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Name (brief) |
|
22 | - * @var strng |
|
23 | - */ |
|
24 | - public $directions; |
|
20 | + /** |
|
21 | + * Name (brief) |
|
22 | + * @var strng |
|
23 | + */ |
|
24 | + public $directions; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Distance |
|
28 | - * @var double |
|
29 | - */ |
|
30 | - public $distance; |
|
26 | + /** |
|
27 | + * Distance |
|
28 | + * @var double |
|
29 | + */ |
|
30 | + public $distance; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Distance unit |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $distance_unit; |
|
32 | + /** |
|
33 | + * Distance unit |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $distance_unit; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Maneuver Type. Available values: |
|
40 | - * - Head,Go Straight,Turn Left,Turn Right,Turn Slight Left, |
|
41 | - * - Turn Slight Right,Turn Sharp Left,Turn Sharp Right, |
|
42 | - * - Roundabout Left,Roundabout Right,Uturn Left,Uturn Right, |
|
43 | - * - Ramp Left,Ramp Right,Fork Left,Fork Right,Keep Left, |
|
44 | - * - Keep Right,Ferry,Ferry Train,Merge,Reached Your Destination. |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - public $maneuverType; |
|
38 | + /** |
|
39 | + * Maneuver Type. Available values: |
|
40 | + * - Head,Go Straight,Turn Left,Turn Right,Turn Slight Left, |
|
41 | + * - Turn Slight Right,Turn Sharp Left,Turn Sharp Right, |
|
42 | + * - Roundabout Left,Roundabout Right,Uturn Left,Uturn Right, |
|
43 | + * - Ramp Left,Ramp Right,Fork Left,Fork Right,Keep Left, |
|
44 | + * - Keep Right,Ferry,Ferry Train,Merge,Reached Your Destination. |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + public $maneuverType; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Compass Direction. Available values:<br> |
|
51 | - * N, S, W, E, NW, NE, SW, SE |
|
52 | - * @var string |
|
53 | - */ |
|
54 | - public $compass_direction; |
|
49 | + /** |
|
50 | + * Compass Direction. Available values:<br> |
|
51 | + * N, S, W, E, NW, NE, SW, SE |
|
52 | + * @var string |
|
53 | + */ |
|
54 | + public $compass_direction; |
|
55 | 55 | |
56 | - /** |
|
57 | - * UDU Distance (UDU: User Distance Unit). |
|
58 | - * @var double |
|
59 | - */ |
|
60 | - public $udu_distance; |
|
56 | + /** |
|
57 | + * UDU Distance (UDU: User Distance Unit). |
|
58 | + * @var double |
|
59 | + */ |
|
60 | + public $udu_distance; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Direction step duration(seconds) |
|
64 | - * @var integer |
|
65 | - */ |
|
66 | - public $duration_sec; |
|
62 | + /** |
|
63 | + * Direction step duration(seconds) |
|
64 | + * @var integer |
|
65 | + */ |
|
66 | + public $duration_sec; |
|
67 | 67 | |
68 | - /** |
|
69 | - * Maneuver Point |
|
70 | - * @var GeoPoint |
|
71 | - */ |
|
72 | - public $maneuverPoint; |
|
68 | + /** |
|
69 | + * Maneuver Point |
|
70 | + * @var GeoPoint |
|
71 | + */ |
|
72 | + public $maneuverPoint; |
|
73 | 73 | } |
@@ -11,15 +11,15 @@ |
||
11 | 11 | */ |
12 | 12 | class GeoPoint extends Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Latitude |
|
16 | - * @var double |
|
17 | - */ |
|
18 | - public $lat; |
|
14 | + /** |
|
15 | + * Latitude |
|
16 | + * @var double |
|
17 | + */ |
|
18 | + public $lat; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Longitude |
|
22 | - * @var double |
|
23 | - */ |
|
24 | - public $lng; |
|
20 | + /** |
|
21 | + * Longitude |
|
22 | + * @var double |
|
23 | + */ |
|
24 | + public $lng; |
|
25 | 25 | } |
@@ -6,96 +6,96 @@ |
||
6 | 6 | |
7 | 7 | class Geocoding extends Common |
8 | 8 | { |
9 | - public $strExportFormat; |
|
10 | - public $format; |
|
11 | - public $addresses; |
|
12 | - public $pk; |
|
13 | - public $offset; |
|
14 | - public $limit; |
|
15 | - public $housenumber; |
|
16 | - public $zipcode; |
|
9 | + public $strExportFormat; |
|
10 | + public $format; |
|
11 | + public $addresses; |
|
12 | + public $pk; |
|
13 | + public $offset; |
|
14 | + public $limit; |
|
15 | + public $housenumber; |
|
16 | + public $zipcode; |
|
17 | 17 | |
18 | - public static function forwardGeocoding($params) |
|
19 | - { |
|
20 | - $allBodyFields = ['strExportFormat', 'addresses']; |
|
18 | + public static function forwardGeocoding($params) |
|
19 | + { |
|
20 | + $allBodyFields = ['strExportFormat', 'addresses']; |
|
21 | 21 | |
22 | - $fgCoding = Route4Me::makeRequst([ |
|
23 | - 'url' => Endpoint::GEOCODER, |
|
24 | - 'method' => 'POST', |
|
25 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
26 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
27 | - ]); |
|
22 | + $fgCoding = Route4Me::makeRequst([ |
|
23 | + 'url' => Endpoint::GEOCODER, |
|
24 | + 'method' => 'POST', |
|
25 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
26 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
27 | + ]); |
|
28 | 28 | |
29 | - return $fgCoding; |
|
30 | - } |
|
29 | + return $fgCoding; |
|
30 | + } |
|
31 | 31 | |
32 | - public static function reverseGeocoding($params) |
|
33 | - { |
|
34 | - $allQueryFields = ['format', 'addresses', 'detailed']; |
|
32 | + public static function reverseGeocoding($params) |
|
33 | + { |
|
34 | + $allQueryFields = ['format', 'addresses', 'detailed']; |
|
35 | 35 | |
36 | - $fgcoding = Route4Me::makeRequst([ |
|
37 | - 'url' => Endpoint::GEOCODER, |
|
38 | - 'method' => 'POST', |
|
39 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
40 | - ]); |
|
36 | + $fgcoding = Route4Me::makeRequst([ |
|
37 | + 'url' => Endpoint::GEOCODER, |
|
38 | + 'method' => 'POST', |
|
39 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
40 | + ]); |
|
41 | 41 | |
42 | - return $fgcoding; |
|
43 | - } |
|
42 | + return $fgcoding; |
|
43 | + } |
|
44 | 44 | |
45 | - public static function getStreetData($params) |
|
46 | - { |
|
47 | - Route4Me::setBaseUrl(Endpoint::STREET_DATA); |
|
45 | + public static function getStreetData($params) |
|
46 | + { |
|
47 | + Route4Me::setBaseUrl(Endpoint::STREET_DATA); |
|
48 | 48 | |
49 | - $allPathFields = ['pk', 'offset', 'limit']; |
|
49 | + $allPathFields = ['pk', 'offset', 'limit']; |
|
50 | 50 | |
51 | - $url_query = Route4Me::generateUrlPath($allPathFields, $params); |
|
51 | + $url_query = Route4Me::generateUrlPath($allPathFields, $params); |
|
52 | 52 | |
53 | - $query = []; |
|
53 | + $query = []; |
|
54 | 54 | |
55 | - $response = Route4Me::makeRequst([ |
|
56 | - 'url' => $url_query, |
|
57 | - 'method' => 'GET', |
|
58 | - 'query' => $query, |
|
59 | - ]); |
|
55 | + $response = Route4Me::makeRequst([ |
|
56 | + 'url' => $url_query, |
|
57 | + 'method' => 'GET', |
|
58 | + 'query' => $query, |
|
59 | + ]); |
|
60 | 60 | |
61 | - return $response; |
|
62 | - } |
|
61 | + return $response; |
|
62 | + } |
|
63 | 63 | |
64 | - public static function getZipCode($params) |
|
65 | - { |
|
66 | - Route4Me::setBaseUrl(Endpoint::STREET_DATA_ZIPCODE); |
|
64 | + public static function getZipCode($params) |
|
65 | + { |
|
66 | + Route4Me::setBaseUrl(Endpoint::STREET_DATA_ZIPCODE); |
|
67 | 67 | |
68 | - $allPathFields = ['zipcode', 'offset', 'limit']; |
|
68 | + $allPathFields = ['zipcode', 'offset', 'limit']; |
|
69 | 69 | |
70 | - $url_query = Route4Me::generateUrlPath($allPathFields, $params); |
|
70 | + $url_query = Route4Me::generateUrlPath($allPathFields, $params); |
|
71 | 71 | |
72 | - $query = []; |
|
72 | + $query = []; |
|
73 | 73 | |
74 | - $response = Route4Me::makeRequst([ |
|
75 | - 'url' => $url_query, |
|
76 | - 'method' => 'GET', |
|
77 | - 'query' => $query, |
|
78 | - ]); |
|
74 | + $response = Route4Me::makeRequst([ |
|
75 | + 'url' => $url_query, |
|
76 | + 'method' => 'GET', |
|
77 | + 'query' => $query, |
|
78 | + ]); |
|
79 | 79 | |
80 | - return $response; |
|
81 | - } |
|
80 | + return $response; |
|
81 | + } |
|
82 | 82 | |
83 | - public static function getService($params) |
|
84 | - { |
|
85 | - Route4Me::setBaseUrl(Endpoint::STREET_DATA_SERVICE); |
|
83 | + public static function getService($params) |
|
84 | + { |
|
85 | + Route4Me::setBaseUrl(Endpoint::STREET_DATA_SERVICE); |
|
86 | 86 | |
87 | - $allPathFields = ['zipcode', 'housenumber', 'offset', 'limit']; |
|
87 | + $allPathFields = ['zipcode', 'housenumber', 'offset', 'limit']; |
|
88 | 88 | |
89 | - $url_query = Route4Me::generateUrlPath($allPathFields, $params); |
|
89 | + $url_query = Route4Me::generateUrlPath($allPathFields, $params); |
|
90 | 90 | |
91 | - $query = []; |
|
91 | + $query = []; |
|
92 | 92 | |
93 | - $response = Route4Me::makeRequst([ |
|
94 | - 'url' => $url_query, |
|
95 | - 'method' => 'GET', |
|
96 | - 'query' => $query, |
|
97 | - ]); |
|
93 | + $response = Route4Me::makeRequst([ |
|
94 | + 'url' => $url_query, |
|
95 | + 'method' => 'GET', |
|
96 | + 'query' => $query, |
|
97 | + ]); |
|
98 | 98 | |
99 | - return $response; |
|
100 | - } |
|
99 | + return $response; |
|
100 | + } |
|
101 | 101 | } |
@@ -9,85 +9,85 @@ |
||
9 | 9 | */ |
10 | 10 | class ScheduleCalendarParameters extends Common |
11 | 11 | { |
12 | - /** |
|
13 | - * Start date to filter the schedules in the string format<br> |
|
14 | - * (e.g. 2020-10-27). |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - public $date_from_string; |
|
12 | + /** |
|
13 | + * Start date to filter the schedules in the string format<br> |
|
14 | + * (e.g. 2020-10-27). |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + public $date_from_string; |
|
18 | 18 | |
19 | - /** |
|
20 | - * End date to filter the schedules in the string format<br> |
|
21 | - * (e.g. 2020-10-30). |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - public $date_to_string; |
|
19 | + /** |
|
20 | + * End date to filter the schedules in the string format<br> |
|
21 | + * (e.g. 2020-10-30). |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + public $date_to_string; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Member ID |
|
28 | - * @var integer |
|
29 | - */ |
|
30 | - public $member_id; |
|
26 | + /** |
|
27 | + * Member ID |
|
28 | + * @var integer |
|
29 | + */ |
|
30 | + public $member_id; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Timezone offset (in minutes)<br> |
|
34 | - * (e.g. NYT: -4*60 = -480, Kiev: 3*60 = 180). |
|
35 | - * @var integer |
|
36 | - */ |
|
37 | - public $timezone_offset_minutes; |
|
32 | + /** |
|
33 | + * Timezone offset (in minutes)<br> |
|
34 | + * (e.g. NYT: -4*60 = -480, Kiev: 3*60 = 180). |
|
35 | + * @var integer |
|
36 | + */ |
|
37 | + public $timezone_offset_minutes; |
|
38 | 38 | |
39 | - /** |
|
40 | - * If true, the scheduled orders are included in the calendar. |
|
41 | - * @var Boolean |
|
42 | - */ |
|
43 | - public $orders; |
|
39 | + /** |
|
40 | + * If true, the scheduled orders are included in the calendar. |
|
41 | + * @var Boolean |
|
42 | + */ |
|
43 | + public $orders; |
|
44 | 44 | |
45 | - /** |
|
46 | - * If true, the scheduled address book contacts |
|
47 | - * are included in the calendar. |
|
48 | - * @var Boolean |
|
49 | - */ |
|
50 | - public $ab; |
|
45 | + /** |
|
46 | + * If true, the scheduled address book contacts |
|
47 | + * are included in the calendar. |
|
48 | + * @var Boolean |
|
49 | + */ |
|
50 | + public $ab; |
|
51 | 51 | |
52 | - /** |
|
53 | - * If true, the scheduled routes are included in the calendar. |
|
54 | - * @var Boolean |
|
55 | - */ |
|
56 | - public $routes_count; |
|
52 | + /** |
|
53 | + * If true, the scheduled routes are included in the calendar. |
|
54 | + * @var Boolean |
|
55 | + */ |
|
56 | + public $routes_count; |
|
57 | 57 | |
58 | - /** |
|
59 | - * Class constructor. |
|
60 | - * @var |
|
61 | - */ |
|
62 | - public function __construct() |
|
63 | - { |
|
64 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
65 | - } |
|
58 | + /** |
|
59 | + * Class constructor. |
|
60 | + * @var |
|
61 | + */ |
|
62 | + public function __construct() |
|
63 | + { |
|
64 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
65 | + } |
|
66 | 66 | |
67 | - public function setTimezoneOffsetMinutes($tz) |
|
68 | - { |
|
69 | - $this->timezone_offset_minutes = -$tz; |
|
70 | - } |
|
67 | + public function setTimezoneOffsetMinutes($tz) |
|
68 | + { |
|
69 | + $this->timezone_offset_minutes = -$tz; |
|
70 | + } |
|
71 | 71 | |
72 | - public function getTimezoneOffsetMinutes() |
|
73 | - { |
|
74 | - if (is_numeric($this->timezone_offset_minutes)) { |
|
75 | - return -$this->timezone_offset_minutes; |
|
76 | - } else { |
|
77 | - return 0; |
|
78 | - } |
|
79 | - } |
|
72 | + public function getTimezoneOffsetMinutes() |
|
73 | + { |
|
74 | + if (is_numeric($this->timezone_offset_minutes)) { |
|
75 | + return -$this->timezone_offset_minutes; |
|
76 | + } else { |
|
77 | + return 0; |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - public function getScheduleCalendar($params) |
|
82 | - { |
|
83 | - $allQueryFields = ['date_from_string', 'date_to_string', 'member_id', 'timezone_offset_minutes', 'orders', 'ab', 'routes_count']; |
|
81 | + public function getScheduleCalendar($params) |
|
82 | + { |
|
83 | + $allQueryFields = ['date_from_string', 'date_to_string', 'member_id', 'timezone_offset_minutes', 'orders', 'ab', 'routes_count']; |
|
84 | 84 | |
85 | - $schedCalendar = Route4Me::makeRequst([ |
|
86 | - 'url' => Endpoint::SCHEDULE_CALENDAR, |
|
87 | - 'method' => 'GET', |
|
88 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
89 | - ]); |
|
85 | + $schedCalendar = Route4Me::makeRequst([ |
|
86 | + 'url' => Endpoint::SCHEDULE_CALENDAR, |
|
87 | + 'method' => 'GET', |
|
88 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
89 | + ]); |
|
90 | 90 | |
91 | - return $schedCalendar; |
|
92 | - } |
|
91 | + return $schedCalendar; |
|
92 | + } |
|
93 | 93 | } |
@@ -11,520 +11,520 @@ |
||
11 | 11 | */ |
12 | 12 | class RouteParameters extends Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Let the R4M API know if this SDK request is comming |
|
16 | - * from a file upload within your environment (for analytics). |
|
17 | - * @var Boolean |
|
18 | - */ |
|
19 | - public $is_upload; |
|
20 | - |
|
21 | - /** |
|
22 | - * The tour type of this route. rt is short for round trip, |
|
23 | - * the optimization engine changes its behavior for round trip |
|
24 | - * @var Boolean |
|
25 | - */ |
|
26 | - public $rt; |
|
27 | - |
|
28 | - /** |
|
29 | - * The name of this route. this route name will be accessible in the search API, |
|
30 | - * and also will be displayed on the mobile device of a user. |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - public $route_name; |
|
34 | - |
|
35 | - /** |
|
36 | - * The route start date in UTC, unix timestamp seconds. |
|
37 | - * Used to show users when the route will begin, also used for reporting and analytics. |
|
38 | - * @var integer |
|
39 | - */ |
|
40 | - public $route_date; |
|
41 | - |
|
42 | - /** |
|
43 | - * Offset in seconds relative to the route start date (i.e. 9AM would be 60 * 60 * 9) |
|
44 | - * @var integer |
|
45 | - */ |
|
46 | - public $route_time; |
|
47 | - |
|
48 | - /** |
|
49 | - * @deprecated 'Always false' |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - public $shared_publicly; |
|
53 | - |
|
54 | - /** |
|
55 | - * By disabling optimization, the route optimization engine |
|
56 | - * will not resequence the stops in your. |
|
57 | - * @var disable_optimization |
|
58 | - */ |
|
59 | - public $disable_optimization; |
|
60 | - |
|
61 | - /** |
|
62 | - * Gets or sets the optimize parameter.<br> |
|
63 | - * Availabale values: |
|
64 | - * - Distance, |
|
65 | - * - Time, |
|
66 | - * - timeWithTraffic |
|
67 | - * @var string |
|
68 | - */ |
|
69 | - public $optimize; |
|
70 | - |
|
71 | - /** |
|
72 | - * When the tour type is not round trip (rt = false), |
|
73 | - * enable lock last so that the final destination is fixed. |
|
74 | - * @var Boolean |
|
75 | - */ |
|
76 | - public $lock_last; |
|
77 | - |
|
78 | - /** |
|
79 | - * Vehicle capacity. |
|
80 | - * @var integer |
|
81 | - */ |
|
82 | - public $vehicle_capacity; |
|
83 | - |
|
84 | - /** |
|
85 | - * Maximum distance for a single vehicle in the route (always in miles) |
|
86 | - * @var integer |
|
87 | - */ |
|
88 | - public $vehicle_max_distance_mi; |
|
89 | - |
|
90 | - /** |
|
91 | - * The distance measurement unit for the route. |
|
92 | - * km or mi, the route4me api will convert all measurements into these units. |
|
93 | - * @var string |
|
94 | - */ |
|
95 | - public $distance_unit; |
|
96 | - |
|
97 | - /** |
|
98 | - * The mode of travel that the directions should be optimized for.<br> |
|
99 | - * Available values: |
|
100 | - * - Driving |
|
101 | - * - Walking |
|
102 | - * @var string |
|
103 | - */ |
|
104 | - public $travel_mode; |
|
105 | - |
|
106 | - /** |
|
107 | - * Options which let the user choose which road obstacles to avoid.<br> |
|
108 | - * This has no impact on route sequencing.<br> |
|
109 | - * Available values: |
|
110 | - * - Highways |
|
111 | - * - Tolls |
|
112 | - * - minimizeHighways |
|
113 | - * - minimizeTolls |
|
114 | - * - highways,tolls |
|
115 | - * - "". |
|
116 | - * @var string |
|
117 | - */ |
|
118 | - public $avoid; |
|
119 | - |
|
120 | - /** |
|
121 | - * The vehicle ID |
|
122 | - * @var string |
|
123 | - */ |
|
124 | - public $vehicle_id; |
|
125 | - |
|
126 | - /** |
|
127 | - * The latitude of the device making this sdk request. |
|
128 | - * @var double |
|
129 | - */ |
|
130 | - public $dev_lat; |
|
131 | - |
|
132 | - /** |
|
133 | - * The longitude of the device making this sdk request. |
|
134 | - * @var double |
|
135 | - */ |
|
136 | - public $dev_lng; |
|
137 | - |
|
138 | - /** |
|
139 | - * When using a multiple driver algorithm, this is the maximum permissible duration of a generated route.<br> |
|
140 | - * The optimization system will automatically create more routes when the route_max_duration is exceeded for a route.<br> |
|
141 | - * However it will create an 'unrouted' list of addresses if the maximum number of drivers is exceeded. |
|
142 | - * @var long |
|
143 | - */ |
|
144 | - public $route_max_duration; |
|
145 | - |
|
146 | - /** |
|
147 | - * The parameter specifies fine-tuning of an optimization process by route duration. |
|
148 | - * @var double |
|
149 | - */ |
|
150 | - public $target_duration; |
|
151 | - |
|
152 | - /** |
|
153 | - * The parameter specifies fine-tuning of an optimization process by route distance. |
|
154 | - * @var double |
|
155 | - */ |
|
156 | - public $target_distance; |
|
157 | - |
|
158 | - /** |
|
159 | - * The parameter specifies fine-tuning of an optimization process by waiting time. |
|
160 | - * @var double |
|
161 | - */ |
|
162 | - public $target_wait_by_tail_size; |
|
163 | - |
|
164 | - /** |
|
165 | - * The email address to notify upon completion of an optimization request. |
|
166 | - * @var string |
|
167 | - */ |
|
168 | - public $route_email; |
|
169 | - |
|
170 | - /** |
|
171 | - * @deprecated All routes are stored by default at this time |
|
172 | - * @var |
|
173 | - */ |
|
174 | - public $store_route = true; |
|
175 | - |
|
176 | - /** |
|
177 | - * Metric system |
|
178 | - * @see Enum\Metric |
|
179 | - * @var integer |
|
180 | - */ |
|
181 | - public $metric; |
|
182 | - |
|
183 | - /** |
|
184 | - * The algorithm type to use when optimizing the route. |
|
185 | - * @see Enum\AlgorithmType |
|
186 | - * @var integer |
|
187 | - */ |
|
188 | - public $algorithm_type; |
|
189 | - |
|
190 | - /** |
|
191 | - * The route owner's member ID.<br> |
|
192 | - * In order for users in your organization to have routes assigned to them, |
|
193 | - * you must provide their member ID within the Route4Me system.<br> |
|
194 | - * A list of member IDs can be retrieved with view_users API method. |
|
195 | - * @var integer |
|
196 | - */ |
|
197 | - public $member_id; |
|
198 | - |
|
199 | - /** |
|
200 | - * Specify the ip address of the remote user making this optimization request. |
|
201 | - * @var long |
|
202 | - */ |
|
203 | - public $ip; |
|
204 | - |
|
205 | - /** |
|
206 | - * The method to use when compute the distance between the points in a route.<br> |
|
207 | - * Available values: from 1 to 12. |
|
208 | - * @var integer |
|
209 | - */ |
|
210 | - public $dm; |
|
211 | - |
|
212 | - /** |
|
213 | - * Directions method. |
|
214 | - * @var integer |
|
215 | - */ |
|
216 | - public $dirm; |
|
217 | - |
|
218 | - /** |
|
219 | - * Legacy feature which permits a user to request an example number of optimized routes. |
|
220 | - * @var integer |
|
221 | - */ |
|
222 | - public $parts; |
|
223 | - |
|
224 | - /** |
|
225 | - * 32 Character MD5 String ID of the device that was used to plan this route. |
|
226 | - * @deprecated Always null |
|
227 | - * @var string |
|
228 | - */ |
|
229 | - public $device_id; |
|
230 | - |
|
231 | - /** |
|
232 | - * The type of device making this request. |
|
233 | - * @see Enum\DeviceType |
|
234 | - * @var string |
|
235 | - */ |
|
236 | - public $device_type; |
|
237 | - |
|
238 | - /** |
|
239 | - * If true, the vehicle has a trailer.<br> |
|
240 | - * For routes that have trucking directions enabled, directions generated<br> |
|
241 | - * will ensure compliance so that road directions generated do not take the vehicle |
|
242 | - * where trailers are prohibited. |
|
243 | - * @var Boolean |
|
244 | - */ |
|
245 | - public $has_trailer; |
|
246 | - |
|
247 | - /** |
|
248 | - * The vehicle's trailer weight.<br> |
|
249 | - * For routes that have trucking directions enabled, directions generated<br> |
|
250 | - * will ensure compliance so that road directions generated do not take the vehicle<br> |
|
251 | - * on roads where the weight of the vehicle in tons exceeds this value. |
|
252 | - * @var double |
|
253 | - */ |
|
254 | - public $trailer_weight_t; |
|
255 | - |
|
256 | - /** |
|
257 | - * If travel_mode is Trucking, specifies the truck weight. |
|
258 | - * @var double |
|
259 | - */ |
|
260 | - public $limited_weight_t; |
|
261 | - |
|
262 | - /** |
|
263 | - * The vehicle's weight per axle (tons) |
|
264 | - * @var double |
|
265 | - */ |
|
266 | - public $weight_per_axle_t; |
|
267 | - |
|
268 | - /** |
|
269 | - * Comma-delimited list of the truck hazardous goods. |
|
270 | - * @var string |
|
271 | - */ |
|
272 | - public $truck_hazardous_goods; |
|
273 | - |
|
274 | - /** |
|
275 | - * Truck axles number. |
|
276 | - * @var integer |
|
277 | - */ |
|
278 | - public $truck_axles; |
|
279 | - |
|
280 | - /** |
|
281 | - * Truck toll road usage. enum: ["YES", "NO"] |
|
282 | - * @var string |
|
283 | - */ |
|
284 | - public $truck_toll_road_usage; |
|
285 | - |
|
286 | - /** |
|
287 | - * Truck avoid ferries. enum: ["YES", "NO"] |
|
288 | - * @var string |
|
289 | - */ |
|
290 | - public $truck_avoid_ferries; |
|
291 | - |
|
292 | - /** |
|
293 | - * Truck highway only. enum: ["YES", "NO"] |
|
294 | - * @var string |
|
295 | - */ |
|
296 | - public $truck_hwy_only; |
|
297 | - |
|
298 | - /** |
|
299 | - * Truck of the type Long Combination Vehicle. enum: ["YES", "NO"] |
|
300 | - * @var string |
|
301 | - */ |
|
302 | - public $truck_lcv; |
|
303 | - |
|
304 | - /** |
|
305 | - * Avoid international borders. enum: ["YES", "NO"] |
|
306 | - * @var string |
|
307 | - */ |
|
308 | - public $truck_borders; |
|
309 | - |
|
310 | - /** |
|
311 | - * Truck side street adherence.<br> |
|
312 | - * enum: ["OFF", "MINIMAL","MODERATE","AVERAGE","STRICT","ADHERE","STRONGLYHERE"] |
|
313 | - * @var string |
|
314 | - */ |
|
315 | - public $truck_side_street_adherence; |
|
316 | - |
|
317 | - /** |
|
318 | - * Truck configuration. |
|
319 | - * enum: ["NONE","PASSENGER","28_DOUBLETRAILER","48_STRAIGHT_TRUCK", |
|
320 | - * "48_SEMI_TRAILER","53_SEMI_TRAILER","FULLSIZEVAN","26_STRAIGHT_TRUCK"] |
|
321 | - * @var string |
|
322 | - */ |
|
323 | - public $truck_config; |
|
324 | - |
|
325 | - /** |
|
326 | - * Truck dimension unit. enum: ["mi","km"] |
|
327 | - * @var string |
|
328 | - */ |
|
329 | - public $truck_dim_unit; |
|
330 | - |
|
331 | - /** |
|
332 | - * Truck type. |
|
333 | - * enum: ["suv","pickup_truck","van","18wheeler","cabin","waste_disposal", |
|
334 | - * "tree_cutting","bigrig","cement_mixer","livestock_carrier","dairy", "tractor_trailer"] |
|
335 | - * @var string |
|
336 | - */ |
|
337 | - public $truck_type; |
|
338 | - |
|
339 | - /** |
|
340 | - * If travel_mode = 'Trucking', specifies the truck weight (required) |
|
341 | - * @var double |
|
342 | - */ |
|
343 | - public $truck_weight; |
|
344 | - |
|
345 | - /** |
|
346 | - * Maximum cargo weight a vehicle can cary. |
|
347 | - * @var double |
|
348 | - */ |
|
349 | - public $vehicle_max_cargo_weight; |
|
350 | - |
|
351 | - /** |
|
352 | - * Maximum cargo volume a vehicle can cary. |
|
353 | - * @var double |
|
354 | - */ |
|
355 | - public $vehicle_max_cargo_volume; |
|
356 | - |
|
357 | - /** |
|
358 | - * Maximum allowed revenue from a subtour. |
|
359 | - * @var integer |
|
360 | - */ |
|
361 | - public $subtour_max_revenue; |
|
362 | - |
|
363 | - /** |
|
364 | - * An array of the Avoidance zones IDs. |
|
365 | - * @var string[] |
|
366 | - */ |
|
367 | - public $avoidance_zones = []; |
|
368 | - |
|
369 | - /** |
|
370 | - * The vehicle ID, to be assigned to the route. |
|
371 | - * @deprecated All new routes should be assigned to a member_id |
|
372 | - * @var string |
|
373 | - */ |
|
374 | - public $driver_id; |
|
375 | - |
|
376 | - /** |
|
377 | - * Minimum number of optimized routes. |
|
378 | - * @var integer |
|
379 | - */ |
|
380 | - public $parts_min; |
|
381 | - |
|
382 | - /** |
|
383 | - * If true, the vehicle will first drive then wait between stops. |
|
384 | - * @var Boolean |
|
385 | - */ |
|
386 | - public $first_drive_then_wait_between_stops; |
|
387 | - |
|
388 | - /** |
|
389 | - * The truck height.<br> |
|
390 | - * For routes that have trucking directions enabled, directions generated<br> |
|
391 | - * will ensure compliance of this maximum height of truck when generating |
|
392 | - * road network driving directions. |
|
393 | - * @var double |
|
394 | - */ |
|
395 | - public $truck_height; |
|
396 | - |
|
397 | - /** |
|
398 | - * The truck width.<br> |
|
399 | - * For routes that have trucking directions enabled, directions generated |
|
400 | - * will ensure compliance of this width of the truck when generating road network |
|
401 | - * driving directions. |
|
402 | - * @var double |
|
403 | - */ |
|
404 | - public $truck_width; |
|
405 | - |
|
406 | - /** |
|
407 | - * The truck length.<br> |
|
408 | - * For routes that have trucking directions enabled, directions generated |
|
409 | - * will ensure compliance of this length of the truck when generating |
|
410 | - * road network driving directions. |
|
411 | - * @var double |
|
412 | - */ |
|
413 | - public $truck_length; |
|
414 | - |
|
415 | - /** |
|
416 | - * The optimization quality.<br> |
|
417 | - * Available values: |
|
418 | - * - 1 - Generate Optimized Routes As Quickly as Possible; |
|
419 | - * - 2 - Generate Routes That Look Better On A Map; |
|
420 | - * - 3 - Generate The Shortest And Quickest Possible Routes. |
|
421 | - * @var integer |
|
422 | - */ |
|
423 | - public $optimization_quality; |
|
424 | - |
|
425 | - /** |
|
426 | - * The maximum number of stops permitted per created subroute. |
|
427 | - * @var integer |
|
428 | - */ |
|
429 | - public $max_tour_size; |
|
430 | - |
|
431 | - /** |
|
432 | - * The minimum number of stops permitted per created subroute. |
|
433 | - * @var integer |
|
434 | - */ |
|
435 | - public $min_tour_size; |
|
436 | - |
|
437 | - /** |
|
438 | - * If equal to 1, uturn is allowed for the vehicle. |
|
439 | - * @var integer |
|
440 | - */ |
|
441 | - public $uturn; |
|
442 | - |
|
443 | - /** |
|
444 | - * If equal to 1, leftturn is allowed for the vehicle. |
|
445 | - * @var integer |
|
446 | - */ |
|
447 | - public $leftturn; |
|
448 | - |
|
449 | - /** |
|
450 | - * If equal to 1, rightturn is allowed for the vehicle. |
|
451 | - * @var integer |
|
452 | - */ |
|
453 | - public $rightturn; |
|
454 | - |
|
455 | - /** |
|
456 | - * Route travel time slowdown (e.g. 25 (means 25% slowdown)). |
|
457 | - * @note the parameter is read-only and it can be set |
|
458 | - * with the parameter Slowdowns.TravelTime. |
|
459 | - * @var integer |
|
460 | - */ |
|
461 | - public $route_time_multiplier; |
|
462 | - |
|
463 | - /** |
|
464 | - * Route service time slowdown (e.g. 10 (means 10% slowdown)). |
|
465 | - * @note the parameter is read-only and it can be set |
|
466 | - * with the parameter Slowdowns.TravelTime. |
|
467 | - * @var integer |
|
468 | - */ |
|
469 | - public $route_service_time_multiplier; |
|
470 | - |
|
471 | - /** |
|
472 | - * Optimization engine (e.g. '1','2' etc) |
|
473 | - * @var string |
|
474 | - */ |
|
475 | - public $optimization_engine; |
|
476 | - |
|
477 | - /** |
|
478 | - * Override addresses |
|
479 | - * @var OverrideAddresses |
|
480 | - */ |
|
481 | - public $override_addresses; |
|
482 | - |
|
483 | - /** |
|
484 | - * Address bundling rules |
|
485 | - * @var V5\Addresses\AddressBundling |
|
486 | - */ |
|
487 | - public $bundling; |
|
488 | - |
|
489 | - /** |
|
490 | - * Advanced route constraints |
|
491 | - * @var RouteAdvancedConstraints |
|
492 | - */ |
|
493 | - public $advanced_constraints = []; |
|
494 | - |
|
495 | - /** |
|
496 | - * If true, the time windows ignored. |
|
497 | - * @var Boolean |
|
498 | - */ |
|
499 | - public $ignore_tw; |
|
500 | - |
|
501 | - /** |
|
502 | - * If true, the start time is dynamic. |
|
503 | - * @var Boolean |
|
504 | - */ |
|
505 | - public $is_dynamic_start_time; |
|
506 | - |
|
507 | - /** |
|
508 | - * @deprecated The parameter 'route_type' isn't included in route parameters. |
|
509 | - * @var string |
|
510 | - */ |
|
511 | - public $route_type; |
|
512 | - |
|
513 | - /** |
|
514 | - * Slowdown of the optimization parameters. |
|
515 | - * @note This is only query parameter. |
|
516 | - * @note This parameter is used in the optimization creation/generation process. |
|
517 | - * @var SlowdownParams |
|
518 | - */ |
|
519 | - public $slowdowns; |
|
520 | - |
|
521 | - public function setAddressBundle($addressBundle) |
|
522 | - { |
|
523 | - $this->bundling = $addressBundle; |
|
524 | - } |
|
525 | - |
|
526 | - public function getAddressBundle() |
|
527 | - { |
|
528 | - return $this->bundling; |
|
529 | - } |
|
14 | + /** |
|
15 | + * Let the R4M API know if this SDK request is comming |
|
16 | + * from a file upload within your environment (for analytics). |
|
17 | + * @var Boolean |
|
18 | + */ |
|
19 | + public $is_upload; |
|
20 | + |
|
21 | + /** |
|
22 | + * The tour type of this route. rt is short for round trip, |
|
23 | + * the optimization engine changes its behavior for round trip |
|
24 | + * @var Boolean |
|
25 | + */ |
|
26 | + public $rt; |
|
27 | + |
|
28 | + /** |
|
29 | + * The name of this route. this route name will be accessible in the search API, |
|
30 | + * and also will be displayed on the mobile device of a user. |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + public $route_name; |
|
34 | + |
|
35 | + /** |
|
36 | + * The route start date in UTC, unix timestamp seconds. |
|
37 | + * Used to show users when the route will begin, also used for reporting and analytics. |
|
38 | + * @var integer |
|
39 | + */ |
|
40 | + public $route_date; |
|
41 | + |
|
42 | + /** |
|
43 | + * Offset in seconds relative to the route start date (i.e. 9AM would be 60 * 60 * 9) |
|
44 | + * @var integer |
|
45 | + */ |
|
46 | + public $route_time; |
|
47 | + |
|
48 | + /** |
|
49 | + * @deprecated 'Always false' |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + public $shared_publicly; |
|
53 | + |
|
54 | + /** |
|
55 | + * By disabling optimization, the route optimization engine |
|
56 | + * will not resequence the stops in your. |
|
57 | + * @var disable_optimization |
|
58 | + */ |
|
59 | + public $disable_optimization; |
|
60 | + |
|
61 | + /** |
|
62 | + * Gets or sets the optimize parameter.<br> |
|
63 | + * Availabale values: |
|
64 | + * - Distance, |
|
65 | + * - Time, |
|
66 | + * - timeWithTraffic |
|
67 | + * @var string |
|
68 | + */ |
|
69 | + public $optimize; |
|
70 | + |
|
71 | + /** |
|
72 | + * When the tour type is not round trip (rt = false), |
|
73 | + * enable lock last so that the final destination is fixed. |
|
74 | + * @var Boolean |
|
75 | + */ |
|
76 | + public $lock_last; |
|
77 | + |
|
78 | + /** |
|
79 | + * Vehicle capacity. |
|
80 | + * @var integer |
|
81 | + */ |
|
82 | + public $vehicle_capacity; |
|
83 | + |
|
84 | + /** |
|
85 | + * Maximum distance for a single vehicle in the route (always in miles) |
|
86 | + * @var integer |
|
87 | + */ |
|
88 | + public $vehicle_max_distance_mi; |
|
89 | + |
|
90 | + /** |
|
91 | + * The distance measurement unit for the route. |
|
92 | + * km or mi, the route4me api will convert all measurements into these units. |
|
93 | + * @var string |
|
94 | + */ |
|
95 | + public $distance_unit; |
|
96 | + |
|
97 | + /** |
|
98 | + * The mode of travel that the directions should be optimized for.<br> |
|
99 | + * Available values: |
|
100 | + * - Driving |
|
101 | + * - Walking |
|
102 | + * @var string |
|
103 | + */ |
|
104 | + public $travel_mode; |
|
105 | + |
|
106 | + /** |
|
107 | + * Options which let the user choose which road obstacles to avoid.<br> |
|
108 | + * This has no impact on route sequencing.<br> |
|
109 | + * Available values: |
|
110 | + * - Highways |
|
111 | + * - Tolls |
|
112 | + * - minimizeHighways |
|
113 | + * - minimizeTolls |
|
114 | + * - highways,tolls |
|
115 | + * - "". |
|
116 | + * @var string |
|
117 | + */ |
|
118 | + public $avoid; |
|
119 | + |
|
120 | + /** |
|
121 | + * The vehicle ID |
|
122 | + * @var string |
|
123 | + */ |
|
124 | + public $vehicle_id; |
|
125 | + |
|
126 | + /** |
|
127 | + * The latitude of the device making this sdk request. |
|
128 | + * @var double |
|
129 | + */ |
|
130 | + public $dev_lat; |
|
131 | + |
|
132 | + /** |
|
133 | + * The longitude of the device making this sdk request. |
|
134 | + * @var double |
|
135 | + */ |
|
136 | + public $dev_lng; |
|
137 | + |
|
138 | + /** |
|
139 | + * When using a multiple driver algorithm, this is the maximum permissible duration of a generated route.<br> |
|
140 | + * The optimization system will automatically create more routes when the route_max_duration is exceeded for a route.<br> |
|
141 | + * However it will create an 'unrouted' list of addresses if the maximum number of drivers is exceeded. |
|
142 | + * @var long |
|
143 | + */ |
|
144 | + public $route_max_duration; |
|
145 | + |
|
146 | + /** |
|
147 | + * The parameter specifies fine-tuning of an optimization process by route duration. |
|
148 | + * @var double |
|
149 | + */ |
|
150 | + public $target_duration; |
|
151 | + |
|
152 | + /** |
|
153 | + * The parameter specifies fine-tuning of an optimization process by route distance. |
|
154 | + * @var double |
|
155 | + */ |
|
156 | + public $target_distance; |
|
157 | + |
|
158 | + /** |
|
159 | + * The parameter specifies fine-tuning of an optimization process by waiting time. |
|
160 | + * @var double |
|
161 | + */ |
|
162 | + public $target_wait_by_tail_size; |
|
163 | + |
|
164 | + /** |
|
165 | + * The email address to notify upon completion of an optimization request. |
|
166 | + * @var string |
|
167 | + */ |
|
168 | + public $route_email; |
|
169 | + |
|
170 | + /** |
|
171 | + * @deprecated All routes are stored by default at this time |
|
172 | + * @var |
|
173 | + */ |
|
174 | + public $store_route = true; |
|
175 | + |
|
176 | + /** |
|
177 | + * Metric system |
|
178 | + * @see Enum\Metric |
|
179 | + * @var integer |
|
180 | + */ |
|
181 | + public $metric; |
|
182 | + |
|
183 | + /** |
|
184 | + * The algorithm type to use when optimizing the route. |
|
185 | + * @see Enum\AlgorithmType |
|
186 | + * @var integer |
|
187 | + */ |
|
188 | + public $algorithm_type; |
|
189 | + |
|
190 | + /** |
|
191 | + * The route owner's member ID.<br> |
|
192 | + * In order for users in your organization to have routes assigned to them, |
|
193 | + * you must provide their member ID within the Route4Me system.<br> |
|
194 | + * A list of member IDs can be retrieved with view_users API method. |
|
195 | + * @var integer |
|
196 | + */ |
|
197 | + public $member_id; |
|
198 | + |
|
199 | + /** |
|
200 | + * Specify the ip address of the remote user making this optimization request. |
|
201 | + * @var long |
|
202 | + */ |
|
203 | + public $ip; |
|
204 | + |
|
205 | + /** |
|
206 | + * The method to use when compute the distance between the points in a route.<br> |
|
207 | + * Available values: from 1 to 12. |
|
208 | + * @var integer |
|
209 | + */ |
|
210 | + public $dm; |
|
211 | + |
|
212 | + /** |
|
213 | + * Directions method. |
|
214 | + * @var integer |
|
215 | + */ |
|
216 | + public $dirm; |
|
217 | + |
|
218 | + /** |
|
219 | + * Legacy feature which permits a user to request an example number of optimized routes. |
|
220 | + * @var integer |
|
221 | + */ |
|
222 | + public $parts; |
|
223 | + |
|
224 | + /** |
|
225 | + * 32 Character MD5 String ID of the device that was used to plan this route. |
|
226 | + * @deprecated Always null |
|
227 | + * @var string |
|
228 | + */ |
|
229 | + public $device_id; |
|
230 | + |
|
231 | + /** |
|
232 | + * The type of device making this request. |
|
233 | + * @see Enum\DeviceType |
|
234 | + * @var string |
|
235 | + */ |
|
236 | + public $device_type; |
|
237 | + |
|
238 | + /** |
|
239 | + * If true, the vehicle has a trailer.<br> |
|
240 | + * For routes that have trucking directions enabled, directions generated<br> |
|
241 | + * will ensure compliance so that road directions generated do not take the vehicle |
|
242 | + * where trailers are prohibited. |
|
243 | + * @var Boolean |
|
244 | + */ |
|
245 | + public $has_trailer; |
|
246 | + |
|
247 | + /** |
|
248 | + * The vehicle's trailer weight.<br> |
|
249 | + * For routes that have trucking directions enabled, directions generated<br> |
|
250 | + * will ensure compliance so that road directions generated do not take the vehicle<br> |
|
251 | + * on roads where the weight of the vehicle in tons exceeds this value. |
|
252 | + * @var double |
|
253 | + */ |
|
254 | + public $trailer_weight_t; |
|
255 | + |
|
256 | + /** |
|
257 | + * If travel_mode is Trucking, specifies the truck weight. |
|
258 | + * @var double |
|
259 | + */ |
|
260 | + public $limited_weight_t; |
|
261 | + |
|
262 | + /** |
|
263 | + * The vehicle's weight per axle (tons) |
|
264 | + * @var double |
|
265 | + */ |
|
266 | + public $weight_per_axle_t; |
|
267 | + |
|
268 | + /** |
|
269 | + * Comma-delimited list of the truck hazardous goods. |
|
270 | + * @var string |
|
271 | + */ |
|
272 | + public $truck_hazardous_goods; |
|
273 | + |
|
274 | + /** |
|
275 | + * Truck axles number. |
|
276 | + * @var integer |
|
277 | + */ |
|
278 | + public $truck_axles; |
|
279 | + |
|
280 | + /** |
|
281 | + * Truck toll road usage. enum: ["YES", "NO"] |
|
282 | + * @var string |
|
283 | + */ |
|
284 | + public $truck_toll_road_usage; |
|
285 | + |
|
286 | + /** |
|
287 | + * Truck avoid ferries. enum: ["YES", "NO"] |
|
288 | + * @var string |
|
289 | + */ |
|
290 | + public $truck_avoid_ferries; |
|
291 | + |
|
292 | + /** |
|
293 | + * Truck highway only. enum: ["YES", "NO"] |
|
294 | + * @var string |
|
295 | + */ |
|
296 | + public $truck_hwy_only; |
|
297 | + |
|
298 | + /** |
|
299 | + * Truck of the type Long Combination Vehicle. enum: ["YES", "NO"] |
|
300 | + * @var string |
|
301 | + */ |
|
302 | + public $truck_lcv; |
|
303 | + |
|
304 | + /** |
|
305 | + * Avoid international borders. enum: ["YES", "NO"] |
|
306 | + * @var string |
|
307 | + */ |
|
308 | + public $truck_borders; |
|
309 | + |
|
310 | + /** |
|
311 | + * Truck side street adherence.<br> |
|
312 | + * enum: ["OFF", "MINIMAL","MODERATE","AVERAGE","STRICT","ADHERE","STRONGLYHERE"] |
|
313 | + * @var string |
|
314 | + */ |
|
315 | + public $truck_side_street_adherence; |
|
316 | + |
|
317 | + /** |
|
318 | + * Truck configuration. |
|
319 | + * enum: ["NONE","PASSENGER","28_DOUBLETRAILER","48_STRAIGHT_TRUCK", |
|
320 | + * "48_SEMI_TRAILER","53_SEMI_TRAILER","FULLSIZEVAN","26_STRAIGHT_TRUCK"] |
|
321 | + * @var string |
|
322 | + */ |
|
323 | + public $truck_config; |
|
324 | + |
|
325 | + /** |
|
326 | + * Truck dimension unit. enum: ["mi","km"] |
|
327 | + * @var string |
|
328 | + */ |
|
329 | + public $truck_dim_unit; |
|
330 | + |
|
331 | + /** |
|
332 | + * Truck type. |
|
333 | + * enum: ["suv","pickup_truck","van","18wheeler","cabin","waste_disposal", |
|
334 | + * "tree_cutting","bigrig","cement_mixer","livestock_carrier","dairy", "tractor_trailer"] |
|
335 | + * @var string |
|
336 | + */ |
|
337 | + public $truck_type; |
|
338 | + |
|
339 | + /** |
|
340 | + * If travel_mode = 'Trucking', specifies the truck weight (required) |
|
341 | + * @var double |
|
342 | + */ |
|
343 | + public $truck_weight; |
|
344 | + |
|
345 | + /** |
|
346 | + * Maximum cargo weight a vehicle can cary. |
|
347 | + * @var double |
|
348 | + */ |
|
349 | + public $vehicle_max_cargo_weight; |
|
350 | + |
|
351 | + /** |
|
352 | + * Maximum cargo volume a vehicle can cary. |
|
353 | + * @var double |
|
354 | + */ |
|
355 | + public $vehicle_max_cargo_volume; |
|
356 | + |
|
357 | + /** |
|
358 | + * Maximum allowed revenue from a subtour. |
|
359 | + * @var integer |
|
360 | + */ |
|
361 | + public $subtour_max_revenue; |
|
362 | + |
|
363 | + /** |
|
364 | + * An array of the Avoidance zones IDs. |
|
365 | + * @var string[] |
|
366 | + */ |
|
367 | + public $avoidance_zones = []; |
|
368 | + |
|
369 | + /** |
|
370 | + * The vehicle ID, to be assigned to the route. |
|
371 | + * @deprecated All new routes should be assigned to a member_id |
|
372 | + * @var string |
|
373 | + */ |
|
374 | + public $driver_id; |
|
375 | + |
|
376 | + /** |
|
377 | + * Minimum number of optimized routes. |
|
378 | + * @var integer |
|
379 | + */ |
|
380 | + public $parts_min; |
|
381 | + |
|
382 | + /** |
|
383 | + * If true, the vehicle will first drive then wait between stops. |
|
384 | + * @var Boolean |
|
385 | + */ |
|
386 | + public $first_drive_then_wait_between_stops; |
|
387 | + |
|
388 | + /** |
|
389 | + * The truck height.<br> |
|
390 | + * For routes that have trucking directions enabled, directions generated<br> |
|
391 | + * will ensure compliance of this maximum height of truck when generating |
|
392 | + * road network driving directions. |
|
393 | + * @var double |
|
394 | + */ |
|
395 | + public $truck_height; |
|
396 | + |
|
397 | + /** |
|
398 | + * The truck width.<br> |
|
399 | + * For routes that have trucking directions enabled, directions generated |
|
400 | + * will ensure compliance of this width of the truck when generating road network |
|
401 | + * driving directions. |
|
402 | + * @var double |
|
403 | + */ |
|
404 | + public $truck_width; |
|
405 | + |
|
406 | + /** |
|
407 | + * The truck length.<br> |
|
408 | + * For routes that have trucking directions enabled, directions generated |
|
409 | + * will ensure compliance of this length of the truck when generating |
|
410 | + * road network driving directions. |
|
411 | + * @var double |
|
412 | + */ |
|
413 | + public $truck_length; |
|
414 | + |
|
415 | + /** |
|
416 | + * The optimization quality.<br> |
|
417 | + * Available values: |
|
418 | + * - 1 - Generate Optimized Routes As Quickly as Possible; |
|
419 | + * - 2 - Generate Routes That Look Better On A Map; |
|
420 | + * - 3 - Generate The Shortest And Quickest Possible Routes. |
|
421 | + * @var integer |
|
422 | + */ |
|
423 | + public $optimization_quality; |
|
424 | + |
|
425 | + /** |
|
426 | + * The maximum number of stops permitted per created subroute. |
|
427 | + * @var integer |
|
428 | + */ |
|
429 | + public $max_tour_size; |
|
430 | + |
|
431 | + /** |
|
432 | + * The minimum number of stops permitted per created subroute. |
|
433 | + * @var integer |
|
434 | + */ |
|
435 | + public $min_tour_size; |
|
436 | + |
|
437 | + /** |
|
438 | + * If equal to 1, uturn is allowed for the vehicle. |
|
439 | + * @var integer |
|
440 | + */ |
|
441 | + public $uturn; |
|
442 | + |
|
443 | + /** |
|
444 | + * If equal to 1, leftturn is allowed for the vehicle. |
|
445 | + * @var integer |
|
446 | + */ |
|
447 | + public $leftturn; |
|
448 | + |
|
449 | + /** |
|
450 | + * If equal to 1, rightturn is allowed for the vehicle. |
|
451 | + * @var integer |
|
452 | + */ |
|
453 | + public $rightturn; |
|
454 | + |
|
455 | + /** |
|
456 | + * Route travel time slowdown (e.g. 25 (means 25% slowdown)). |
|
457 | + * @note the parameter is read-only and it can be set |
|
458 | + * with the parameter Slowdowns.TravelTime. |
|
459 | + * @var integer |
|
460 | + */ |
|
461 | + public $route_time_multiplier; |
|
462 | + |
|
463 | + /** |
|
464 | + * Route service time slowdown (e.g. 10 (means 10% slowdown)). |
|
465 | + * @note the parameter is read-only and it can be set |
|
466 | + * with the parameter Slowdowns.TravelTime. |
|
467 | + * @var integer |
|
468 | + */ |
|
469 | + public $route_service_time_multiplier; |
|
470 | + |
|
471 | + /** |
|
472 | + * Optimization engine (e.g. '1','2' etc) |
|
473 | + * @var string |
|
474 | + */ |
|
475 | + public $optimization_engine; |
|
476 | + |
|
477 | + /** |
|
478 | + * Override addresses |
|
479 | + * @var OverrideAddresses |
|
480 | + */ |
|
481 | + public $override_addresses; |
|
482 | + |
|
483 | + /** |
|
484 | + * Address bundling rules |
|
485 | + * @var V5\Addresses\AddressBundling |
|
486 | + */ |
|
487 | + public $bundling; |
|
488 | + |
|
489 | + /** |
|
490 | + * Advanced route constraints |
|
491 | + * @var RouteAdvancedConstraints |
|
492 | + */ |
|
493 | + public $advanced_constraints = []; |
|
494 | + |
|
495 | + /** |
|
496 | + * If true, the time windows ignored. |
|
497 | + * @var Boolean |
|
498 | + */ |
|
499 | + public $ignore_tw; |
|
500 | + |
|
501 | + /** |
|
502 | + * If true, the start time is dynamic. |
|
503 | + * @var Boolean |
|
504 | + */ |
|
505 | + public $is_dynamic_start_time; |
|
506 | + |
|
507 | + /** |
|
508 | + * @deprecated The parameter 'route_type' isn't included in route parameters. |
|
509 | + * @var string |
|
510 | + */ |
|
511 | + public $route_type; |
|
512 | + |
|
513 | + /** |
|
514 | + * Slowdown of the optimization parameters. |
|
515 | + * @note This is only query parameter. |
|
516 | + * @note This parameter is used in the optimization creation/generation process. |
|
517 | + * @var SlowdownParams |
|
518 | + */ |
|
519 | + public $slowdowns; |
|
520 | + |
|
521 | + public function setAddressBundle($addressBundle) |
|
522 | + { |
|
523 | + $this->bundling = $addressBundle; |
|
524 | + } |
|
525 | + |
|
526 | + public function getAddressBundle() |
|
527 | + { |
|
528 | + return $this->bundling; |
|
529 | + } |
|
530 | 530 | } |
@@ -7,107 +7,107 @@ |
||
7 | 7 | |
8 | 8 | class AvoidanceZone extends Common |
9 | 9 | { |
10 | - public $territory_id; // Avoidance zone id |
|
11 | - public $territory_name; |
|
12 | - public $territory_color; |
|
13 | - public $orders; |
|
14 | - public $member_id; |
|
15 | - public $territory; // Territory parameters |
|
16 | - |
|
17 | - public function __construct() |
|
18 | - { |
|
19 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
20 | - } |
|
21 | - |
|
22 | - public static function fromArray(array $params) |
|
23 | - { |
|
24 | - if (!isset($params['territory_name'])) { |
|
25 | - throw new BadParam('Territory name must be provided'); |
|
26 | - } |
|
27 | - |
|
28 | - if (!isset($params['territory_color'])) { |
|
29 | - throw new BadParam('Territory color must be provided'); |
|
30 | - } |
|
31 | - |
|
32 | - if (!isset($params['territory'])) { |
|
33 | - throw new BadParam('Territory must be provided'); |
|
34 | - } |
|
35 | - return parent::fromArray($params); |
|
36 | - } |
|
37 | - |
|
38 | - public static function getAvoidanceZone($territory_id) |
|
39 | - { |
|
40 | - $avoidanceZone = Route4Me::makeRequst([ |
|
41 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
42 | - 'method' => 'GET', |
|
43 | - 'query' => [ |
|
44 | - 'territory_id' => $territory_id, |
|
45 | - ], |
|
46 | - ]); |
|
47 | - |
|
48 | - return $avoidanceZone; |
|
49 | - } |
|
50 | - |
|
51 | - public static function getAvoidanceZones($params) |
|
52 | - { |
|
53 | - $avoidanceZones = Route4Me::makeRequst([ |
|
54 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
55 | - 'method' => 'GET', |
|
56 | - 'query' => [ |
|
57 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
58 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
59 | - ], |
|
60 | - ]); |
|
61 | - |
|
62 | - return $avoidanceZones; |
|
63 | - } |
|
64 | - |
|
65 | - public static function addAvoidanceZone($params) |
|
66 | - { |
|
67 | - $terParams = []; |
|
68 | - |
|
69 | - if (isset($params->territory['type'])) { |
|
70 | - $terParams['type'] = $params->territory['type']; |
|
71 | - } |
|
72 | - |
|
73 | - if (isset($params->territory['data'])) { |
|
74 | - $terParams['data'] = $params->territory['data']; |
|
75 | - } |
|
76 | - |
|
77 | - $abContacts = Route4Me::makeRequst([ |
|
78 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
79 | - 'method' => 'POST', |
|
80 | - 'body' => [ |
|
81 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
82 | - 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
83 | - 'territory' => $terParams, |
|
84 | - ], |
|
85 | - ]); |
|
86 | - |
|
87 | - return $abContacts; |
|
88 | - } |
|
89 | - |
|
90 | - public function deleteAvoidanceZone($territory_id) |
|
91 | - { |
|
92 | - $result = Route4Me::makeRequst([ |
|
93 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
94 | - 'method' => 'DELETEARRAY', |
|
95 | - 'query' => [ |
|
96 | - 'territory_id' => $territory_id, |
|
97 | - ], |
|
98 | - ]); |
|
99 | - |
|
100 | - return $result; |
|
101 | - } |
|
102 | - |
|
103 | - public function updateAvoidanceZone($params) |
|
104 | - { |
|
105 | - $avoidanceZone = Route4Me::makeRequst([ |
|
106 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
107 | - 'method' => 'PUT', |
|
108 | - 'body' => $params, |
|
109 | - ]); |
|
110 | - |
|
111 | - return $avoidanceZone; |
|
112 | - } |
|
10 | + public $territory_id; // Avoidance zone id |
|
11 | + public $territory_name; |
|
12 | + public $territory_color; |
|
13 | + public $orders; |
|
14 | + public $member_id; |
|
15 | + public $territory; // Territory parameters |
|
16 | + |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
20 | + } |
|
21 | + |
|
22 | + public static function fromArray(array $params) |
|
23 | + { |
|
24 | + if (!isset($params['territory_name'])) { |
|
25 | + throw new BadParam('Territory name must be provided'); |
|
26 | + } |
|
27 | + |
|
28 | + if (!isset($params['territory_color'])) { |
|
29 | + throw new BadParam('Territory color must be provided'); |
|
30 | + } |
|
31 | + |
|
32 | + if (!isset($params['territory'])) { |
|
33 | + throw new BadParam('Territory must be provided'); |
|
34 | + } |
|
35 | + return parent::fromArray($params); |
|
36 | + } |
|
37 | + |
|
38 | + public static function getAvoidanceZone($territory_id) |
|
39 | + { |
|
40 | + $avoidanceZone = Route4Me::makeRequst([ |
|
41 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
42 | + 'method' => 'GET', |
|
43 | + 'query' => [ |
|
44 | + 'territory_id' => $territory_id, |
|
45 | + ], |
|
46 | + ]); |
|
47 | + |
|
48 | + return $avoidanceZone; |
|
49 | + } |
|
50 | + |
|
51 | + public static function getAvoidanceZones($params) |
|
52 | + { |
|
53 | + $avoidanceZones = Route4Me::makeRequst([ |
|
54 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
55 | + 'method' => 'GET', |
|
56 | + 'query' => [ |
|
57 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
58 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
59 | + ], |
|
60 | + ]); |
|
61 | + |
|
62 | + return $avoidanceZones; |
|
63 | + } |
|
64 | + |
|
65 | + public static function addAvoidanceZone($params) |
|
66 | + { |
|
67 | + $terParams = []; |
|
68 | + |
|
69 | + if (isset($params->territory['type'])) { |
|
70 | + $terParams['type'] = $params->territory['type']; |
|
71 | + } |
|
72 | + |
|
73 | + if (isset($params->territory['data'])) { |
|
74 | + $terParams['data'] = $params->territory['data']; |
|
75 | + } |
|
76 | + |
|
77 | + $abContacts = Route4Me::makeRequst([ |
|
78 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
79 | + 'method' => 'POST', |
|
80 | + 'body' => [ |
|
81 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
82 | + 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
83 | + 'territory' => $terParams, |
|
84 | + ], |
|
85 | + ]); |
|
86 | + |
|
87 | + return $abContacts; |
|
88 | + } |
|
89 | + |
|
90 | + public function deleteAvoidanceZone($territory_id) |
|
91 | + { |
|
92 | + $result = Route4Me::makeRequst([ |
|
93 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
94 | + 'method' => 'DELETEARRAY', |
|
95 | + 'query' => [ |
|
96 | + 'territory_id' => $territory_id, |
|
97 | + ], |
|
98 | + ]); |
|
99 | + |
|
100 | + return $result; |
|
101 | + } |
|
102 | + |
|
103 | + public function updateAvoidanceZone($params) |
|
104 | + { |
|
105 | + $avoidanceZone = Route4Me::makeRequst([ |
|
106 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
107 | + 'method' => 'PUT', |
|
108 | + 'body' => $params, |
|
109 | + ]); |
|
110 | + |
|
111 | + return $avoidanceZone; |
|
112 | + } |
|
113 | 113 | } |