@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class Metric |
6 | 6 | { |
7 | - const EUCLIDEAN = 1; //measures point to point distance as a straight line |
|
8 | - const MANHATTAN = 2; //measures point to point distance as taxicab geometry line |
|
9 | - const GEODESIC = 3; //measures point to point distance approximating curvature of the earth |
|
10 | - const MATRIX = 4; //measures point to point distance by traversing the actual road network |
|
11 | - const EXACT_2D = 5; //measures point to point distance using 2d rectilinear distance |
|
7 | + const EUCLIDEAN = 1; //measures point to point distance as a straight line |
|
8 | + const MANHATTAN = 2; //measures point to point distance as taxicab geometry line |
|
9 | + const GEODESIC = 3; //measures point to point distance approximating curvature of the earth |
|
10 | + const MATRIX = 4; //measures point to point distance by traversing the actual road network |
|
11 | + const EXACT_2D = 5; //measures point to point distance using 2d rectilinear distance |
|
12 | 12 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class DeviceType |
6 | 6 | { |
7 | - const WEB = 'web'; |
|
8 | - const IPHONE = 'iphone'; |
|
9 | - const IPAD = 'ipad'; |
|
10 | - const ANDROID_PHONE = 'android_phone'; |
|
11 | - const ANDROID_TABLET = 'android_tablet'; |
|
7 | + const WEB = 'web'; |
|
8 | + const IPHONE = 'iphone'; |
|
9 | + const IPAD = 'ipad'; |
|
10 | + const ANDROID_PHONE = 'android_phone'; |
|
11 | + const ANDROID_TABLET = 'android_tablet'; |
|
12 | 12 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class TravelMode |
6 | 6 | { |
7 | - const DRIVING = 'Driving'; |
|
8 | - const WALKING = 'Walking'; |
|
9 | - const TRUCKING = 'Trucking'; |
|
10 | - const CYCLING = 'Cycling'; |
|
11 | - const TRANSIT = 'Transit'; |
|
7 | + const DRIVING = 'Driving'; |
|
8 | + const WALKING = 'Walking'; |
|
9 | + const TRUCKING = 'Trucking'; |
|
10 | + const CYCLING = 'Cycling'; |
|
11 | + const TRANSIT = 'Transit'; |
|
12 | 12 | } |
@@ -7,227 +7,227 @@ |
||
7 | 7 | |
8 | 8 | class Address extends Common |
9 | 9 | { |
10 | - public $route_destination_id; |
|
11 | - public $alias; |
|
12 | - public $member_id; |
|
13 | - public $address; |
|
14 | - public $addressUpdate; |
|
15 | - public $is_depot = false; |
|
16 | - public $lat; |
|
17 | - public $lng; |
|
18 | - public $route_id; |
|
19 | - public $original_route_id; |
|
20 | - public $optimization_problem_id; |
|
21 | - public $sequence_no; |
|
22 | - public $geocoded; |
|
23 | - public $preferred_geocoding; |
|
24 | - public $failed_geocoding; |
|
25 | - public $geocodings = []; |
|
26 | - public $contact_id; |
|
27 | - public $is_visited; |
|
28 | - public $customer_po; |
|
29 | - public $invoice_no; |
|
30 | - public $reference_no; |
|
31 | - public $order_no; |
|
32 | - public $weight; |
|
33 | - public $cost; |
|
34 | - public $revenue; |
|
35 | - public $cube; |
|
36 | - public $pieces; |
|
37 | - public $email; |
|
38 | - public $phone; |
|
39 | - public $tracking_number; |
|
40 | - public $destination_note_count; |
|
41 | - public $drive_time_to_next_destination; |
|
42 | - public $distance_to_next_destination; |
|
43 | - public $generated_time_window_start; |
|
44 | - public $generated_time_window_end; |
|
45 | - public $time_window_start; |
|
46 | - public $time_window_end; |
|
47 | - public $time; |
|
48 | - public $notes; |
|
49 | - public $timestamp_last_visited; |
|
50 | - public $custom_fields = []; |
|
51 | - public $manifest = []; |
|
52 | - |
|
53 | - public $first_name; |
|
54 | - public $last_name; |
|
55 | - public $is_departed; |
|
56 | - public $timestamp_last_departed; |
|
57 | - public $order_id; |
|
58 | - public $priority; |
|
59 | - public $curbside_lat; |
|
60 | - public $curbside_lng; |
|
61 | - public $time_window_start_2; |
|
62 | - public $time_window_end_2; |
|
63 | - |
|
64 | - public $timeframe_violation_state; |
|
65 | - public $timeframe_violation_time; |
|
66 | - public $timeframe_violation_rate; |
|
67 | - public $route_name; |
|
68 | - public $address_stop_type; |
|
69 | - public $visited_lat; |
|
70 | - public $visited_lng; |
|
71 | - public $departed_lat; |
|
72 | - public $departed_lng; |
|
73 | - public $group; |
|
74 | - public $abnormal_traffic_time_to_next_destination; |
|
75 | - public $uncongested_time_to_next_destination; |
|
76 | - public $traffic_time_to_next_destination; |
|
77 | - public $channel_name; |
|
78 | - public $pickup; |
|
79 | - public $dropoff; |
|
80 | - public $joint; |
|
81 | - public $geofence_detected_visited_timestamp; |
|
82 | - public $geofence_detected_departed_timestamp; |
|
83 | - public $geofence_detected_service_time; |
|
84 | - public $geofence_detected_visited_lat; |
|
85 | - public $geofence_detected_visited_lng; |
|
86 | - public $geofence_detected_departed_lat; |
|
87 | - public $geofence_detected_departed_lng; |
|
88 | - public $custom_fields_str_json; |
|
89 | - public $custom_fields_config; |
|
90 | - public $custom_fields_config_str_json; |
|
91 | - public $bundle_count; |
|
92 | - public $bundle_items; |
|
93 | - public $order_inventory; |
|
94 | - public $required_skills; |
|
95 | - public $udu_distance_to_next_destination; |
|
96 | - public $wait_time_to_next_destination; |
|
97 | - public $path_to_next = []; |
|
98 | - public $additional_status; |
|
99 | - public $tags = []; |
|
100 | - |
|
101 | - public function __construct() |
|
102 | - { |
|
103 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
104 | - } |
|
105 | - |
|
106 | - public static function fromArray(array $params) |
|
107 | - { |
|
108 | - $address = new self(); |
|
109 | - |
|
110 | - foreach ($params as $key => $value) { |
|
111 | - if (property_exists($address, $key)) { |
|
112 | - $address->{$key} = $value; |
|
113 | - } else { |
|
114 | - throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key"); |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - return $address; |
|
119 | - } |
|
120 | - |
|
121 | - public static function getAddress($routeId, $addressId) |
|
122 | - { |
|
123 | - $address = Route4Me::makeRequst([ |
|
124 | - 'url' => Endpoint::ADDRESS_V4, |
|
125 | - 'method' => 'GET', |
|
126 | - 'query' => [ |
|
127 | - 'route_id' => $routeId, |
|
128 | - 'route_destination_id' => $addressId, |
|
129 | - ], |
|
130 | - ]); |
|
131 | - |
|
132 | - return self::fromArray($address); |
|
133 | - } |
|
134 | - |
|
135 | - public function update() |
|
136 | - { |
|
137 | - $addressUpdate = Route4Me::makeRequst([ |
|
138 | - 'url' => Endpoint::ADDRESS_V4, |
|
139 | - 'method' => 'PUT', |
|
140 | - 'body' => $this->toArray(), |
|
141 | - 'query' => [ |
|
142 | - 'route_id' => $this->route_id, |
|
143 | - 'route_destination_id' => $this->route_destination_id, |
|
144 | - ], |
|
145 | - ]); |
|
146 | - |
|
147 | - return self::fromArray($addressUpdate); |
|
148 | - } |
|
149 | - |
|
150 | - /* |
|
10 | + public $route_destination_id; |
|
11 | + public $alias; |
|
12 | + public $member_id; |
|
13 | + public $address; |
|
14 | + public $addressUpdate; |
|
15 | + public $is_depot = false; |
|
16 | + public $lat; |
|
17 | + public $lng; |
|
18 | + public $route_id; |
|
19 | + public $original_route_id; |
|
20 | + public $optimization_problem_id; |
|
21 | + public $sequence_no; |
|
22 | + public $geocoded; |
|
23 | + public $preferred_geocoding; |
|
24 | + public $failed_geocoding; |
|
25 | + public $geocodings = []; |
|
26 | + public $contact_id; |
|
27 | + public $is_visited; |
|
28 | + public $customer_po; |
|
29 | + public $invoice_no; |
|
30 | + public $reference_no; |
|
31 | + public $order_no; |
|
32 | + public $weight; |
|
33 | + public $cost; |
|
34 | + public $revenue; |
|
35 | + public $cube; |
|
36 | + public $pieces; |
|
37 | + public $email; |
|
38 | + public $phone; |
|
39 | + public $tracking_number; |
|
40 | + public $destination_note_count; |
|
41 | + public $drive_time_to_next_destination; |
|
42 | + public $distance_to_next_destination; |
|
43 | + public $generated_time_window_start; |
|
44 | + public $generated_time_window_end; |
|
45 | + public $time_window_start; |
|
46 | + public $time_window_end; |
|
47 | + public $time; |
|
48 | + public $notes; |
|
49 | + public $timestamp_last_visited; |
|
50 | + public $custom_fields = []; |
|
51 | + public $manifest = []; |
|
52 | + |
|
53 | + public $first_name; |
|
54 | + public $last_name; |
|
55 | + public $is_departed; |
|
56 | + public $timestamp_last_departed; |
|
57 | + public $order_id; |
|
58 | + public $priority; |
|
59 | + public $curbside_lat; |
|
60 | + public $curbside_lng; |
|
61 | + public $time_window_start_2; |
|
62 | + public $time_window_end_2; |
|
63 | + |
|
64 | + public $timeframe_violation_state; |
|
65 | + public $timeframe_violation_time; |
|
66 | + public $timeframe_violation_rate; |
|
67 | + public $route_name; |
|
68 | + public $address_stop_type; |
|
69 | + public $visited_lat; |
|
70 | + public $visited_lng; |
|
71 | + public $departed_lat; |
|
72 | + public $departed_lng; |
|
73 | + public $group; |
|
74 | + public $abnormal_traffic_time_to_next_destination; |
|
75 | + public $uncongested_time_to_next_destination; |
|
76 | + public $traffic_time_to_next_destination; |
|
77 | + public $channel_name; |
|
78 | + public $pickup; |
|
79 | + public $dropoff; |
|
80 | + public $joint; |
|
81 | + public $geofence_detected_visited_timestamp; |
|
82 | + public $geofence_detected_departed_timestamp; |
|
83 | + public $geofence_detected_service_time; |
|
84 | + public $geofence_detected_visited_lat; |
|
85 | + public $geofence_detected_visited_lng; |
|
86 | + public $geofence_detected_departed_lat; |
|
87 | + public $geofence_detected_departed_lng; |
|
88 | + public $custom_fields_str_json; |
|
89 | + public $custom_fields_config; |
|
90 | + public $custom_fields_config_str_json; |
|
91 | + public $bundle_count; |
|
92 | + public $bundle_items; |
|
93 | + public $order_inventory; |
|
94 | + public $required_skills; |
|
95 | + public $udu_distance_to_next_destination; |
|
96 | + public $wait_time_to_next_destination; |
|
97 | + public $path_to_next = []; |
|
98 | + public $additional_status; |
|
99 | + public $tags = []; |
|
100 | + |
|
101 | + public function __construct() |
|
102 | + { |
|
103 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
104 | + } |
|
105 | + |
|
106 | + public static function fromArray(array $params) |
|
107 | + { |
|
108 | + $address = new self(); |
|
109 | + |
|
110 | + foreach ($params as $key => $value) { |
|
111 | + if (property_exists($address, $key)) { |
|
112 | + $address->{$key} = $value; |
|
113 | + } else { |
|
114 | + throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key"); |
|
115 | + } |
|
116 | + } |
|
117 | + |
|
118 | + return $address; |
|
119 | + } |
|
120 | + |
|
121 | + public static function getAddress($routeId, $addressId) |
|
122 | + { |
|
123 | + $address = Route4Me::makeRequst([ |
|
124 | + 'url' => Endpoint::ADDRESS_V4, |
|
125 | + 'method' => 'GET', |
|
126 | + 'query' => [ |
|
127 | + 'route_id' => $routeId, |
|
128 | + 'route_destination_id' => $addressId, |
|
129 | + ], |
|
130 | + ]); |
|
131 | + |
|
132 | + return self::fromArray($address); |
|
133 | + } |
|
134 | + |
|
135 | + public function update() |
|
136 | + { |
|
137 | + $addressUpdate = Route4Me::makeRequst([ |
|
138 | + 'url' => Endpoint::ADDRESS_V4, |
|
139 | + 'method' => 'PUT', |
|
140 | + 'body' => $this->toArray(), |
|
141 | + 'query' => [ |
|
142 | + 'route_id' => $this->route_id, |
|
143 | + 'route_destination_id' => $this->route_destination_id, |
|
144 | + ], |
|
145 | + ]); |
|
146 | + |
|
147 | + return self::fromArray($addressUpdate); |
|
148 | + } |
|
149 | + |
|
150 | + /* |
|
151 | 151 | * Marks an address as marked as visited/as departed |
152 | 152 | * depending on which parameter is specified: 'is_visited' or 'is_departed'. |
153 | 153 | */ |
154 | - public function markAddress($params) |
|
155 | - { |
|
156 | - $allQueryFields = ['route_id', 'route_destination_id']; |
|
157 | - $allBodyFields = ['is_visited', 'is_departed']; |
|
158 | - |
|
159 | - $result = Route4Me::makeRequst([ |
|
160 | - 'url' => Endpoint::ADDRESS_V4, |
|
161 | - 'method' => 'PUT', |
|
162 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
163 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
164 | - ]); |
|
165 | - |
|
166 | - return $result; |
|
167 | - } |
|
168 | - |
|
169 | - /* |
|
154 | + public function markAddress($params) |
|
155 | + { |
|
156 | + $allQueryFields = ['route_id', 'route_destination_id']; |
|
157 | + $allBodyFields = ['is_visited', 'is_departed']; |
|
158 | + |
|
159 | + $result = Route4Me::makeRequst([ |
|
160 | + 'url' => Endpoint::ADDRESS_V4, |
|
161 | + 'method' => 'PUT', |
|
162 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
163 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
164 | + ]); |
|
165 | + |
|
166 | + return $result; |
|
167 | + } |
|
168 | + |
|
169 | + /* |
|
170 | 170 | * Marks an address as departed. |
171 | 171 | */ |
172 | - public function markAsDeparted($params) |
|
173 | - { |
|
174 | - $allQueryFields = ['route_id', 'address_id', 'is_departed', 'member_id']; |
|
172 | + public function markAsDeparted($params) |
|
173 | + { |
|
174 | + $allQueryFields = ['route_id', 'address_id', 'is_departed', 'member_id']; |
|
175 | 175 | |
176 | - $address = Route4Me::makeRequst([ |
|
177 | - 'url' => Endpoint::MARK_ADDRESS_DEPARTED, |
|
178 | - 'method' => 'PUT', |
|
179 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
180 | - ]); |
|
176 | + $address = Route4Me::makeRequst([ |
|
177 | + 'url' => Endpoint::MARK_ADDRESS_DEPARTED, |
|
178 | + 'method' => 'PUT', |
|
179 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
180 | + ]); |
|
181 | 181 | |
182 | - return $address; |
|
183 | - } |
|
182 | + return $address; |
|
183 | + } |
|
184 | 184 | |
185 | - /* |
|
185 | + /* |
|
186 | 186 | * Marks an address as visited. |
187 | 187 | */ |
188 | - public function markAsVisited($params) |
|
189 | - { |
|
190 | - $allQueryFields = ['route_id', 'address_id', 'is_visited', 'member_id']; |
|
191 | - |
|
192 | - $address = Route4Me::makeRequst([ |
|
193 | - 'url' => Endpoint::UPDATE_ADDRESS_VISITED, |
|
194 | - 'method' => 'PUT', |
|
195 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
196 | - ]); |
|
197 | - |
|
198 | - return $address; |
|
199 | - } |
|
200 | - |
|
201 | - public function deleteAddress() |
|
202 | - { |
|
203 | - $address = Route4Me::makeRequst([ |
|
204 | - 'url' => Endpoint::ADDRESS_V4, |
|
205 | - 'method' => 'DELETE', |
|
206 | - 'query' => [ |
|
207 | - 'route_id' => $this->route_id, |
|
208 | - 'route_destination_id' => $this->route_destination_id, |
|
209 | - ], |
|
210 | - ]); |
|
211 | - |
|
212 | - return (bool) $address['deleted']; |
|
213 | - } |
|
214 | - |
|
215 | - public function moveDestinationToRoute($params) |
|
216 | - { |
|
217 | - $allBodyFields = ['to_route_id', 'route_destination_id', 'after_destination_id']; |
|
218 | - |
|
219 | - $result = Route4Me::makeRequst([ |
|
220 | - 'url' => Endpoint::MOVE_ROUTE_DESTINATION, |
|
221 | - 'method' => 'POST', |
|
222 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
223 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
224 | - ]); |
|
225 | - |
|
226 | - return $result; |
|
227 | - } |
|
228 | - |
|
229 | - public function getAddressId() |
|
230 | - { |
|
231 | - return $this->route_destination_id; |
|
232 | - } |
|
188 | + public function markAsVisited($params) |
|
189 | + { |
|
190 | + $allQueryFields = ['route_id', 'address_id', 'is_visited', 'member_id']; |
|
191 | + |
|
192 | + $address = Route4Me::makeRequst([ |
|
193 | + 'url' => Endpoint::UPDATE_ADDRESS_VISITED, |
|
194 | + 'method' => 'PUT', |
|
195 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
196 | + ]); |
|
197 | + |
|
198 | + return $address; |
|
199 | + } |
|
200 | + |
|
201 | + public function deleteAddress() |
|
202 | + { |
|
203 | + $address = Route4Me::makeRequst([ |
|
204 | + 'url' => Endpoint::ADDRESS_V4, |
|
205 | + 'method' => 'DELETE', |
|
206 | + 'query' => [ |
|
207 | + 'route_id' => $this->route_id, |
|
208 | + 'route_destination_id' => $this->route_destination_id, |
|
209 | + ], |
|
210 | + ]); |
|
211 | + |
|
212 | + return (bool) $address['deleted']; |
|
213 | + } |
|
214 | + |
|
215 | + public function moveDestinationToRoute($params) |
|
216 | + { |
|
217 | + $allBodyFields = ['to_route_id', 'route_destination_id', 'after_destination_id']; |
|
218 | + |
|
219 | + $result = Route4Me::makeRequst([ |
|
220 | + 'url' => Endpoint::MOVE_ROUTE_DESTINATION, |
|
221 | + 'method' => 'POST', |
|
222 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
223 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
224 | + ]); |
|
225 | + |
|
226 | + return $result; |
|
227 | + } |
|
228 | + |
|
229 | + public function getAddressId() |
|
230 | + { |
|
231 | + return $this->route_destination_id; |
|
232 | + } |
|
233 | 233 | } |
@@ -11,279 +11,279 @@ |
||
11 | 11 | */ |
12 | 12 | class TelematicsConnection extends \Route4Me\Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Telematics connection access account_id |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - public $account_id; |
|
14 | + /** |
|
15 | + * Telematics connection access account_id |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + public $account_id; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Telematics connection access username |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - public $username; |
|
20 | + /** |
|
21 | + * Telematics connection access username |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + public $username; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Telematics connection access password |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public $password; |
|
26 | + /** |
|
27 | + * Telematics connection access password |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public $password; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Telematics connection access host |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $host; |
|
32 | + /** |
|
33 | + * Telematics connection access host |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $host; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Telematics connection access api_key |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - public $api_key; |
|
38 | + /** |
|
39 | + * Telematics connection access api_key |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + public $api_key; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Telemetics connection type ID |
|
46 | - * @var integer |
|
47 | - */ |
|
48 | - public $vendor_id; |
|
44 | + /** |
|
45 | + * Telemetics connection type ID |
|
46 | + * @var integer |
|
47 | + */ |
|
48 | + public $vendor_id; |
|
49 | 49 | |
50 | - /** |
|
51 | - * Telemetics connection name |
|
52 | - * @var string |
|
53 | - */ |
|
54 | - public $name; |
|
50 | + /** |
|
51 | + * Telemetics connection name |
|
52 | + * @var string |
|
53 | + */ |
|
54 | + public $name; |
|
55 | 55 | |
56 | - /** |
|
57 | - * Vehicle tracking interval in seconds. |
|
58 | - * @var integer |
|
59 | - */ |
|
60 | - public $vehicle_position_refresh_rate; |
|
56 | + /** |
|
57 | + * Vehicle tracking interval in seconds. |
|
58 | + * @var integer |
|
59 | + */ |
|
60 | + public $vehicle_position_refresh_rate; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Maximum idle time |
|
64 | - * @var integer |
|
65 | - */ |
|
66 | - public $max_idle_time; |
|
62 | + /** |
|
63 | + * Maximum idle time |
|
64 | + * @var integer |
|
65 | + */ |
|
66 | + public $max_idle_time; |
|
67 | 67 | |
68 | - /** |
|
69 | - * Disable/enable vehicle tracking |
|
70 | - * @var integer |
|
71 | - */ |
|
72 | - public $is_enabled; |
|
68 | + /** |
|
69 | + * Disable/enable vehicle tracking |
|
70 | + * @var integer |
|
71 | + */ |
|
72 | + public $is_enabled; |
|
73 | 73 | |
74 | - /** |
|
75 | - * The last timestamp, when the vehicles reloaded. |
|
76 | - * @var integer |
|
77 | - */ |
|
78 | - public $last_vehicles_reload; |
|
74 | + /** |
|
75 | + * The last timestamp, when the vehicles reloaded. |
|
76 | + * @var integer |
|
77 | + */ |
|
78 | + public $last_vehicles_reload; |
|
79 | 79 | |
80 | - /** |
|
81 | - * The last timestamp, when the addresses reloaded. |
|
82 | - * @var integer |
|
83 | - */ |
|
84 | - public $last_addresses_reload; |
|
80 | + /** |
|
81 | + * The last timestamp, when the addresses reloaded. |
|
82 | + * @var integer |
|
83 | + */ |
|
84 | + public $last_addresses_reload; |
|
85 | 85 | |
86 | - /** |
|
87 | - * The last timestamp, when the positions reloaded. |
|
88 | - * @var integer |
|
89 | - */ |
|
90 | - public $last_position_reload; |
|
86 | + /** |
|
87 | + * The last timestamp, when the positions reloaded. |
|
88 | + * @var integer |
|
89 | + */ |
|
90 | + public $last_position_reload; |
|
91 | 91 | |
92 | - /** |
|
93 | - * Telematics connection access token |
|
94 | - * @var string |
|
95 | - */ |
|
96 | - public $connection_token; |
|
92 | + /** |
|
93 | + * Telematics connection access token |
|
94 | + * @var string |
|
95 | + */ |
|
96 | + public $connection_token; |
|
97 | 97 | |
98 | - /** |
|
99 | - * Connection user ID |
|
100 | - * @var integer |
|
101 | - */ |
|
102 | - public $user_id; |
|
98 | + /** |
|
99 | + * Connection user ID |
|
100 | + * @var integer |
|
101 | + */ |
|
102 | + public $user_id; |
|
103 | 103 | |
104 | - /** |
|
105 | - * When the connection updated |
|
106 | - * @var string |
|
107 | - */ |
|
108 | - public $updated_at; |
|
104 | + /** |
|
105 | + * When the connection updated |
|
106 | + * @var string |
|
107 | + */ |
|
108 | + public $updated_at; |
|
109 | 109 | |
110 | - /** |
|
111 | - * When the connection created |
|
112 | - * @var string |
|
113 | - */ |
|
114 | - public $created_at; |
|
110 | + /** |
|
111 | + * When the connection created |
|
112 | + * @var string |
|
113 | + */ |
|
114 | + public $created_at; |
|
115 | 115 | |
116 | - /** |
|
117 | - * Telemetics connection ID |
|
118 | - * @var integer |
|
119 | - */ |
|
120 | - public $id; |
|
116 | + /** |
|
117 | + * Telemetics connection ID |
|
118 | + * @var integer |
|
119 | + */ |
|
120 | + public $id; |
|
121 | 121 | |
122 | - /** |
|
123 | - * Metadata, custom key-value storage. |
|
124 | - * @var array |
|
125 | - */ |
|
126 | - public $metadata; |
|
122 | + /** |
|
123 | + * Metadata, custom key-value storage. |
|
124 | + * @var array |
|
125 | + */ |
|
126 | + public $metadata; |
|
127 | 127 | |
128 | - /** |
|
129 | - * Total vehicles number |
|
130 | - * @var integer |
|
131 | - */ |
|
132 | - public $total_vehicles_count; |
|
128 | + /** |
|
129 | + * Total vehicles number |
|
130 | + * @var integer |
|
131 | + */ |
|
132 | + public $total_vehicles_count; |
|
133 | 133 | |
134 | - /** |
|
135 | - * Total addresses number |
|
136 | - * @var integer |
|
137 | - */ |
|
138 | - public $total_addresses_count; |
|
134 | + /** |
|
135 | + * Total addresses number |
|
136 | + * @var integer |
|
137 | + */ |
|
138 | + public $total_addresses_count; |
|
139 | 139 | |
140 | - /** |
|
141 | - * Synchronized vehicles number |
|
142 | - * @var integer |
|
143 | - */ |
|
144 | - public $synced_vehicles_count; |
|
140 | + /** |
|
141 | + * Synchronized vehicles number |
|
142 | + * @var integer |
|
143 | + */ |
|
144 | + public $synced_vehicles_count; |
|
145 | 145 | |
146 | - /** |
|
147 | - * Telemetics connection vendor |
|
148 | - * @var string |
|
149 | - */ |
|
150 | - public $vendor; |
|
146 | + /** |
|
147 | + * Telemetics connection vendor |
|
148 | + * @var string |
|
149 | + */ |
|
150 | + public $vendor; |
|
151 | 151 | |
152 | - /** |
|
153 | - * Validate connections credentials.<br> |
|
154 | - * If true, the connection validated. |
|
155 | - * @var Boolean |
|
156 | - */ |
|
157 | - public $validate_remote_credentials; |
|
152 | + /** |
|
153 | + * Validate connections credentials.<br> |
|
154 | + * If true, the connection validated. |
|
155 | + * @var Boolean |
|
156 | + */ |
|
157 | + public $validate_remote_credentials; |
|
158 | 158 | |
159 | - public static function fromArray(array $params) |
|
160 | - { |
|
161 | - $thisParams = new self(); |
|
159 | + public static function fromArray(array $params) |
|
160 | + { |
|
161 | + $thisParams = new self(); |
|
162 | 162 | |
163 | - foreach ($params as $key => $value) { |
|
164 | - if (property_exists($thisParams, $key)) { |
|
165 | - $thisParams->{$key} = $value; |
|
166 | - } |
|
167 | - } |
|
163 | + foreach ($params as $key => $value) { |
|
164 | + if (property_exists($thisParams, $key)) { |
|
165 | + $thisParams->{$key} = $value; |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - return $thisParams; |
|
170 | - } |
|
169 | + return $thisParams; |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * Create a telematics connection. |
|
174 | - * @param $apiToken string : API token |
|
175 | - * @param $params TelematicsConnectionParameters : Telematics connection parameters |
|
176 | - * @return array Array from a TelematicsConnection type object |
|
177 | - * @throws \Route4Me\Exception\ApiError |
|
178 | - */ |
|
179 | - public function createTelematicsConnection($apiToken, $params) |
|
180 | - { |
|
181 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
172 | + /** |
|
173 | + * Create a telematics connection. |
|
174 | + * @param $apiToken string : API token |
|
175 | + * @param $params TelematicsConnectionParameters : Telematics connection parameters |
|
176 | + * @return array Array from a TelematicsConnection type object |
|
177 | + * @throws \Route4Me\Exception\ApiError |
|
178 | + */ |
|
179 | + public function createTelematicsConnection($apiToken, $params) |
|
180 | + { |
|
181 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
182 | 182 | |
183 | - $excludeFields = ['id', 'connection_token']; |
|
183 | + $excludeFields = ['id', 'connection_token']; |
|
184 | 184 | |
185 | - $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
185 | + $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
186 | 186 | |
187 | - $result = Route4Me::makeRequst([ |
|
188 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
189 | - 'method' => 'POST', |
|
190 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
191 | - 'query' => ['api_token' => $apiToken], |
|
192 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
193 | - ]); |
|
187 | + $result = Route4Me::makeRequst([ |
|
188 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
189 | + 'method' => 'POST', |
|
190 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
191 | + 'query' => ['api_token' => $apiToken], |
|
192 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
193 | + ]); |
|
194 | 194 | |
195 | - return $result; |
|
196 | - } |
|
195 | + return $result; |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * Delete a telematics connection. |
|
200 | - * @param $apiToken string : API token |
|
201 | - * @param $connectionToken string : connection token |
|
202 | - * @return array Array from a TelematicsConnection type object |
|
203 | - * @throws \Route4Me\Exception\ApiError |
|
204 | - */ |
|
205 | - public function deleteTelematicsConnection($apiToken, $connectionToken) |
|
206 | - { |
|
207 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
198 | + /** |
|
199 | + * Delete a telematics connection. |
|
200 | + * @param $apiToken string : API token |
|
201 | + * @param $connectionToken string : connection token |
|
202 | + * @return array Array from a TelematicsConnection type object |
|
203 | + * @throws \Route4Me\Exception\ApiError |
|
204 | + */ |
|
205 | + public function deleteTelematicsConnection($apiToken, $connectionToken) |
|
206 | + { |
|
207 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
208 | 208 | |
209 | - $result = Route4Me::makeRequst([ |
|
210 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
211 | - 'method' => 'DELETE', |
|
212 | - 'query' => [ |
|
213 | - 'api_token' => $apiToken, |
|
214 | - 'connection_token' => $connectionToken |
|
215 | - ], |
|
216 | - ]); |
|
209 | + $result = Route4Me::makeRequst([ |
|
210 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
211 | + 'method' => 'DELETE', |
|
212 | + 'query' => [ |
|
213 | + 'api_token' => $apiToken, |
|
214 | + 'connection_token' => $connectionToken |
|
215 | + ], |
|
216 | + ]); |
|
217 | 217 | |
218 | - return $result; |
|
219 | - } |
|
218 | + return $result; |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * Get all telematics connections. |
|
223 | - * @param $apiToken string : API token |
|
224 | - * @return array Array of the TelematicsConnection type objects |
|
225 | - * @throws \Route4Me\Exception\ApiError |
|
226 | - */ |
|
227 | - public function getTelematicsConnections($apiToken) |
|
228 | - { |
|
229 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
221 | + /** |
|
222 | + * Get all telematics connections. |
|
223 | + * @param $apiToken string : API token |
|
224 | + * @return array Array of the TelematicsConnection type objects |
|
225 | + * @throws \Route4Me\Exception\ApiError |
|
226 | + */ |
|
227 | + public function getTelematicsConnections($apiToken) |
|
228 | + { |
|
229 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
230 | 230 | |
231 | - $result = Route4Me::makeRequst([ |
|
232 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
233 | - 'method' => 'GET', |
|
234 | - 'query' => [ |
|
235 | - 'api_token' => $apiToken |
|
236 | - ], |
|
237 | - ]); |
|
231 | + $result = Route4Me::makeRequst([ |
|
232 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
233 | + 'method' => 'GET', |
|
234 | + 'query' => [ |
|
235 | + 'api_token' => $apiToken |
|
236 | + ], |
|
237 | + ]); |
|
238 | 238 | |
239 | - return $result; |
|
240 | - } |
|
239 | + return $result; |
|
240 | + } |
|
241 | 241 | |
242 | - /** |
|
243 | - * Get a telematics connection |
|
244 | - * @param $apiToken string : API token |
|
245 | - * @param $connectionToken string : connection token |
|
246 | - * @return array Array from a TelematicsConnection type object |
|
247 | - * @throws \Route4Me\Exception\ApiError |
|
248 | - */ |
|
249 | - public function getTelematicsConnection($apiToken, $connectionToken) |
|
250 | - { |
|
251 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
242 | + /** |
|
243 | + * Get a telematics connection |
|
244 | + * @param $apiToken string : API token |
|
245 | + * @param $connectionToken string : connection token |
|
246 | + * @return array Array from a TelematicsConnection type object |
|
247 | + * @throws \Route4Me\Exception\ApiError |
|
248 | + */ |
|
249 | + public function getTelematicsConnection($apiToken, $connectionToken) |
|
250 | + { |
|
251 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
252 | 252 | |
253 | - $result = Route4Me::makeRequst([ |
|
254 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
255 | - 'method' => 'GET', |
|
256 | - 'query' => [ |
|
257 | - 'api_token' => $apiToken, |
|
258 | - 'connection_token' => $connectionToken |
|
259 | - ], |
|
260 | - ]); |
|
253 | + $result = Route4Me::makeRequst([ |
|
254 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
255 | + 'method' => 'GET', |
|
256 | + 'query' => [ |
|
257 | + 'api_token' => $apiToken, |
|
258 | + 'connection_token' => $connectionToken |
|
259 | + ], |
|
260 | + ]); |
|
261 | 261 | |
262 | - return $result; |
|
263 | - } |
|
262 | + return $result; |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * Update telematics connection |
|
267 | - * @param $apiToken string : API token |
|
268 | - * @param $connectionToken string : connection token |
|
269 | - * @param $teleConParams TelematicsConnectionParameters : Telematics connection parameters |
|
270 | - * @return array Array from a TelematicsConnection type object |
|
271 | - * @throws \Route4Me\Exception\ApiError |
|
272 | - */ |
|
273 | - public function updateTelematicsConnection($apiToken, $connectionToken, $teleConParams) |
|
274 | - { |
|
275 | - $excludeFields = ['id', 'connection_token']; |
|
265 | + /** |
|
266 | + * Update telematics connection |
|
267 | + * @param $apiToken string : API token |
|
268 | + * @param $connectionToken string : connection token |
|
269 | + * @param $teleConParams TelematicsConnectionParameters : Telematics connection parameters |
|
270 | + * @return array Array from a TelematicsConnection type object |
|
271 | + * @throws \Route4Me\Exception\ApiError |
|
272 | + */ |
|
273 | + public function updateTelematicsConnection($apiToken, $connectionToken, $teleConParams) |
|
274 | + { |
|
275 | + $excludeFields = ['id', 'connection_token']; |
|
276 | 276 | |
277 | - $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
277 | + $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
278 | 278 | |
279 | - $result = Route4Me::makeRequst([ |
|
280 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
281 | - 'method' => 'PUT', |
|
282 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $teleConParams), |
|
283 | - 'query' => ['api_token' => $apiToken, 'connection_token' => $connectionToken], |
|
284 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
285 | - ]); |
|
279 | + $result = Route4Me::makeRequst([ |
|
280 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
281 | + 'method' => 'PUT', |
|
282 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $teleConParams), |
|
283 | + 'query' => ['api_token' => $apiToken, 'connection_token' => $connectionToken], |
|
284 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
285 | + ]); |
|
286 | 286 | |
287 | - return $result; |
|
288 | - } |
|
287 | + return $result; |
|
288 | + } |
|
289 | 289 | } |
@@ -9,66 +9,66 @@ |
||
9 | 9 | */ |
10 | 10 | class RouteAdvancedConstraints extends \Route4Me\Common |
11 | 11 | { |
12 | - /** Maximum cargo volume per route |
|
13 | - * @var double $max_cargo_volume |
|
14 | - */ |
|
15 | - public $max_cargo_volume; |
|
12 | + /** Maximum cargo volume per route |
|
13 | + * @var double $max_cargo_volume |
|
14 | + */ |
|
15 | + public $max_cargo_volume; |
|
16 | 16 | |
17 | - /** Vehicle capacity. |
|
18 | - * <para>How much total cargo can be transported per route (units, e.g. cubic meters)</para> |
|
19 | - * @var integer $max_capacity |
|
20 | - */ |
|
21 | - public $max_capacity; |
|
17 | + /** Vehicle capacity. |
|
18 | + * <para>How much total cargo can be transported per route (units, e.g. cubic meters)</para> |
|
19 | + * @var integer $max_capacity |
|
20 | + */ |
|
21 | + public $max_capacity; |
|
22 | 22 | |
23 | - /** Legacy feature which permits a user to request an example number of optimized routes. |
|
24 | - * @var integer $members_count |
|
25 | - */ |
|
26 | - public $members_count; |
|
23 | + /** Legacy feature which permits a user to request an example number of optimized routes. |
|
24 | + * @var integer $members_count |
|
25 | + */ |
|
26 | + public $members_count; |
|
27 | 27 | |
28 | - /** An array of the available time windows (e.g. [ [25200, 75000 ] ) |
|
29 | - * @var Array $available_time_windows |
|
30 | - */ |
|
31 | - public $available_time_windows; |
|
28 | + /** An array of the available time windows (e.g. [ [25200, 75000 ] ) |
|
29 | + * @var Array $available_time_windows |
|
30 | + */ |
|
31 | + public $available_time_windows; |
|
32 | 32 | |
33 | - /** The driver tags specified in a team member's custom data. |
|
34 | - * (e.g. "driver skills": |
|
35 | - * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"] |
|
36 | - * @var string[] $tags |
|
37 | - */ |
|
38 | - public $tags; |
|
33 | + /** The driver tags specified in a team member's custom data. |
|
34 | + * (e.g. "driver skills": |
|
35 | + * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"] |
|
36 | + * @var string[] $tags |
|
37 | + */ |
|
38 | + public $tags; |
|
39 | 39 | |
40 | - /** An array of the skilled driver IDs. |
|
41 | - * @var integer[] $route4me_members_id |
|
42 | - */ |
|
43 | - public $route4me_members_id; |
|
40 | + /** An array of the skilled driver IDs. |
|
41 | + * @var integer[] $route4me_members_id |
|
42 | + */ |
|
43 | + public $route4me_members_id; |
|
44 | 44 | |
45 | - /** |
|
46 | - * A depot address. |
|
47 | - * @var Address |
|
48 | - */ |
|
49 | - public $depot_address; |
|
45 | + /** |
|
46 | + * A depot address. |
|
47 | + * @var Address |
|
48 | + */ |
|
49 | + public $depot_address; |
|
50 | 50 | |
51 | - /** |
|
52 | - * An array of locations. |
|
53 | - * @var object[] |
|
54 | - */ |
|
55 | - public $location_sequence_pattern; |
|
51 | + /** |
|
52 | + * An array of locations. |
|
53 | + * @var object[] |
|
54 | + */ |
|
55 | + public $location_sequence_pattern; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Group name of the advanced constraints. |
|
59 | - * @var string |
|
60 | - */ |
|
61 | - public $group; |
|
57 | + /** |
|
58 | + * Group name of the advanced constraints. |
|
59 | + * @var string |
|
60 | + */ |
|
61 | + public $group; |
|
62 | 62 | |
63 | - public static function fromArray(array $params) |
|
64 | - { |
|
65 | - $routeParams = new self(); |
|
66 | - foreach ($params as $key => $value) { |
|
67 | - if (property_exists($routeParams, $key)) { |
|
68 | - $routeParams->{$key} = $value; |
|
69 | - } |
|
70 | - } |
|
63 | + public static function fromArray(array $params) |
|
64 | + { |
|
65 | + $routeParams = new self(); |
|
66 | + foreach ($params as $key => $value) { |
|
67 | + if (property_exists($routeParams, $key)) { |
|
68 | + $routeParams->{$key} = $value; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - return $routeParams; |
|
73 | - } |
|
72 | + return $routeParams; |
|
73 | + } |
|
74 | 74 | } |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | //********************************************************************** |
24 | 24 | // General Route Parameters |
25 | 25 | $parameters = RouteParameters::fromArray([ |
26 | - 'rt' => false, |
|
27 | - 'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW, |
|
28 | - 'route_name' => 'Persistent Location - Single Depot - Multiple Driver '.date('Y-m-d H:i:s', time()), |
|
29 | - 'route_time' => 25200, |
|
30 | - 'distance_unit' => DistanceUnit::MILES, |
|
31 | - 'device_type' => DeviceType::WEB, |
|
32 | - 'optimize' => OptimizationType::DISTANCE, |
|
33 | - 'travel_mode' => TravelMode::DRIVING, |
|
34 | - 'advanced_constraints' => [] |
|
26 | + 'rt' => false, |
|
27 | + 'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW, |
|
28 | + 'route_name' => 'Persistent Location - Single Depot - Multiple Driver '.date('Y-m-d H:i:s', time()), |
|
29 | + 'route_time' => 25200, |
|
30 | + 'distance_unit' => DistanceUnit::MILES, |
|
31 | + 'device_type' => DeviceType::WEB, |
|
32 | + 'optimize' => OptimizationType::DISTANCE, |
|
33 | + 'travel_mode' => TravelMode::DRIVING, |
|
34 | + 'advanced_constraints' => [] |
|
35 | 35 | ]); |
36 | 36 | |
37 | 37 | //********************************************************************** |
38 | 38 | // Persistent Location |
39 | 39 | $persistent_location = [ |
40 | - 'alias' => 'DEPOT END LOCATION', |
|
41 | - 'address' => '4738 BELLEVUE AVE, Louisville, KY, 40215', |
|
42 | - 'lat' => 38.179806, |
|
43 | - 'lng' => -85.775558, |
|
44 | - 'time' => 300 |
|
40 | + 'alias' => 'DEPOT END LOCATION', |
|
41 | + 'address' => '4738 BELLEVUE AVE, Louisville, KY, 40215', |
|
42 | + 'lat' => 38.179806, |
|
43 | + 'lng' => -85.775558, |
|
44 | + 'time' => 300 |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | //********************************************************************** |
@@ -50,22 +50,22 @@ discard block |
||
50 | 50 | // Time Window Start: 2:00 am EST |
51 | 51 | // Time Window End: 15:50 am EST |
52 | 52 | $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([ |
53 | - 'max_cargo_volume' => 0.0, |
|
54 | - 'max_capacity' => 200, |
|
55 | - 'members_count' => 10, |
|
56 | - 'available_time_windows' => [[25200, 75000]], |
|
57 | - 'location_sequence_pattern' => ['', $persistent_location] |
|
53 | + 'max_cargo_volume' => 0.0, |
|
54 | + 'max_capacity' => 200, |
|
55 | + 'members_count' => 10, |
|
56 | + 'available_time_windows' => [[25200, 75000]], |
|
57 | + 'location_sequence_pattern' => ['', $persistent_location] |
|
58 | 58 | ]); |
59 | 59 | |
60 | 60 | // Schedule 2 |
61 | 61 | // Time Window Start: 7:33 am EST |
62 | 62 | // Time Window End: 21:23 am EST |
63 | 63 | $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([ |
64 | - 'max_cargo_volume' => 0.0, |
|
65 | - 'max_capacity' => 200, |
|
66 | - 'members_count' => 10, |
|
67 | - 'available_time_windows' => [[45200, 95000]], |
|
68 | - 'location_sequence_pattern' => ['', $persistent_location] |
|
64 | + 'max_cargo_volume' => 0.0, |
|
65 | + 'max_capacity' => 200, |
|
66 | + 'members_count' => 10, |
|
67 | + 'available_time_windows' => [[45200, 95000]], |
|
68 | + 'location_sequence_pattern' => ['', $persistent_location] |
|
69 | 69 | ]); |
70 | 70 | |
71 | 71 | //********************************************************************** |
@@ -74,25 +74,25 @@ discard block |
||
74 | 74 | |
75 | 75 | // Depot |
76 | 76 | $addresses[] = Address::fromArray([ |
77 | - 'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214', |
|
78 | - 'is_depot' => true, |
|
79 | - 'lat' => 38.141598, |
|
80 | - 'lng' => -85.793846, |
|
81 | - 'time' => 0 |
|
77 | + 'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214', |
|
78 | + 'is_depot' => true, |
|
79 | + 'lat' => 38.141598, |
|
80 | + 'lng' => -85.793846, |
|
81 | + 'time' => 0 |
|
82 | 82 | ]); |
83 | 83 | |
84 | 84 | // Stops |
85 | 85 | foreach ($json as $address) { |
86 | 86 | |
87 | - // skip persistent |
|
88 | - if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue; |
|
87 | + // skip persistent |
|
88 | + if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue; |
|
89 | 89 | |
90 | - $addresses[] = Address::fromArray([ |
|
91 | - 'address' => $address['address'], |
|
92 | - 'lat' => $address['lat'], |
|
93 | - 'lng' => $address['lng'], |
|
94 | - 'time' => $address['time'] |
|
95 | - ]); |
|
90 | + $addresses[] = Address::fromArray([ |
|
91 | + 'address' => $address['address'], |
|
92 | + 'lat' => $address['lat'], |
|
93 | + 'lng' => $address['lng'], |
|
94 | + 'time' => $address['time'] |
|
95 | + ]); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $optimizationParams = new OptimizationProblemParams(); |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | echo "Routes:" . PHP_EOL; |
108 | 108 | foreach($problem->routes as $route) |
109 | 109 | { |
110 | - echo "\tID: " . $route->route_id . PHP_EOL; |
|
111 | - echo "\tDistance: " . $route->trip_distance . PHP_EOL; |
|
112 | - echo "\tAddresses:" . PHP_EOL; |
|
110 | + echo "\tID: " . $route->route_id . PHP_EOL; |
|
111 | + echo "\tDistance: " . $route->trip_distance . PHP_EOL; |
|
112 | + echo "\tAddresses:" . PHP_EOL; |
|
113 | 113 | |
114 | - foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL; |
|
114 | + foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL; |
|
115 | 115 | } |
@@ -18,70 +18,70 @@ |
||
18 | 18 | Route4Me::setApiKey(Constants::API_KEY); |
19 | 19 | |
20 | 20 | try { |
21 | - // get route_id and member_id |
|
22 | - $route = new Route; |
|
23 | - $routes = $route->getRoutes([ |
|
24 | - 'limit' => 1, |
|
25 | - 'offset' => 0 |
|
26 | - ]); |
|
27 | - |
|
28 | - $route_id = null; |
|
29 | - $member_id = null; |
|
30 | - if (is_array($routes) && isset($routes[0])) { |
|
31 | - $route_id = $routes[0]->route_id; |
|
32 | - $member_id = $routes[0]->member_id; |
|
33 | - } |
|
34 | - $route = null; |
|
35 | - |
|
36 | - if ($route_id === null) { |
|
37 | - throw new ApiError('There is no any route.'); |
|
38 | - } |
|
39 | - |
|
40 | - // get vehicle_id |
|
41 | - $vehicle = new Vehicle(); |
|
42 | - $vehicles = $vehicle->getVehiclesPaginatedList([ |
|
43 | - 'with_pagination' => true, |
|
44 | - 'page' => 1, |
|
45 | - 'perPage' => 1 |
|
46 | - ]); |
|
47 | - |
|
48 | - $vehicle_id = null; |
|
49 | - if (is_array($vehicles) && isset($vehicles[0]) && is_array($vehicles[0]) && isset($vehicles[0]['vehicle_id'])) { |
|
50 | - $vehicle_id = $vehicles[0]['vehicle_id']; |
|
51 | - } |
|
52 | - $vehicle = null; |
|
53 | - |
|
54 | - if ($vehicle_id === null) { |
|
55 | - throw new ApiError('There is no any vehicle.'); |
|
56 | - } |
|
57 | - |
|
58 | - // create Schedule |
|
59 | - $schedules = new Schedules; |
|
60 | - |
|
61 | - $schedule = $schedules->createSchedule([ |
|
62 | - 'name' => 'The bestest schedule', |
|
63 | - 'schedule_blacklist' => [], |
|
64 | - 'schedule' => null, |
|
65 | - 'timezone' => 'UTC' |
|
66 | - ]); |
|
67 | - |
|
68 | - // work with RouteSchedule |
|
69 | - $route_schedule = $schedules->createRouteSchedule([ |
|
70 | - 'route_id' => $route_id, |
|
71 | - 'schedule_uid' => $schedule->schedule_uid |
|
72 | - ]); |
|
73 | - |
|
74 | - $route_schedule = $schedules->updateRouteSchedule($route_id, [ |
|
75 | - 'schedule_uid' => $schedule->schedule_uid, |
|
76 | - 'member_id' => $member_id, |
|
77 | - 'vehicle_id' => $vehicle_id |
|
78 | - ]); |
|
79 | - |
|
80 | - $route_schedule = $schedules->getRouteSchedule($route_id); |
|
81 | - |
|
82 | - $schedules->deleteRouteSchedule($route_id); |
|
83 | - |
|
84 | - print_r($route_schedule); |
|
21 | + // get route_id and member_id |
|
22 | + $route = new Route; |
|
23 | + $routes = $route->getRoutes([ |
|
24 | + 'limit' => 1, |
|
25 | + 'offset' => 0 |
|
26 | + ]); |
|
27 | + |
|
28 | + $route_id = null; |
|
29 | + $member_id = null; |
|
30 | + if (is_array($routes) && isset($routes[0])) { |
|
31 | + $route_id = $routes[0]->route_id; |
|
32 | + $member_id = $routes[0]->member_id; |
|
33 | + } |
|
34 | + $route = null; |
|
35 | + |
|
36 | + if ($route_id === null) { |
|
37 | + throw new ApiError('There is no any route.'); |
|
38 | + } |
|
39 | + |
|
40 | + // get vehicle_id |
|
41 | + $vehicle = new Vehicle(); |
|
42 | + $vehicles = $vehicle->getVehiclesPaginatedList([ |
|
43 | + 'with_pagination' => true, |
|
44 | + 'page' => 1, |
|
45 | + 'perPage' => 1 |
|
46 | + ]); |
|
47 | + |
|
48 | + $vehicle_id = null; |
|
49 | + if (is_array($vehicles) && isset($vehicles[0]) && is_array($vehicles[0]) && isset($vehicles[0]['vehicle_id'])) { |
|
50 | + $vehicle_id = $vehicles[0]['vehicle_id']; |
|
51 | + } |
|
52 | + $vehicle = null; |
|
53 | + |
|
54 | + if ($vehicle_id === null) { |
|
55 | + throw new ApiError('There is no any vehicle.'); |
|
56 | + } |
|
57 | + |
|
58 | + // create Schedule |
|
59 | + $schedules = new Schedules; |
|
60 | + |
|
61 | + $schedule = $schedules->createSchedule([ |
|
62 | + 'name' => 'The bestest schedule', |
|
63 | + 'schedule_blacklist' => [], |
|
64 | + 'schedule' => null, |
|
65 | + 'timezone' => 'UTC' |
|
66 | + ]); |
|
67 | + |
|
68 | + // work with RouteSchedule |
|
69 | + $route_schedule = $schedules->createRouteSchedule([ |
|
70 | + 'route_id' => $route_id, |
|
71 | + 'schedule_uid' => $schedule->schedule_uid |
|
72 | + ]); |
|
73 | + |
|
74 | + $route_schedule = $schedules->updateRouteSchedule($route_id, [ |
|
75 | + 'schedule_uid' => $schedule->schedule_uid, |
|
76 | + 'member_id' => $member_id, |
|
77 | + 'vehicle_id' => $vehicle_id |
|
78 | + ]); |
|
79 | + |
|
80 | + $route_schedule = $schedules->getRouteSchedule($route_id); |
|
81 | + |
|
82 | + $schedules->deleteRouteSchedule($route_id); |
|
83 | + |
|
84 | + print_r($route_schedule); |
|
85 | 85 | } catch (\Exception $e) { |
86 | - echo $e->getMessage() . PHP_EOL; |
|
86 | + echo $e->getMessage() . PHP_EOL; |
|
87 | 87 | } |
@@ -15,16 +15,16 @@ |
||
15 | 15 | Route4Me::setApiKey(Constants::API_KEY); |
16 | 16 | |
17 | 17 | try { |
18 | - $route_schedules = new Schedules; |
|
18 | + $route_schedules = new Schedules; |
|
19 | 19 | |
20 | - $params = [ |
|
21 | - 'route_id' => '66C2AC4A323053FF0A40FEB6918ACF5E', |
|
22 | - 'schedule_uid' => '1515E9A65DD2DEF79CAD7A7E68D91515' |
|
23 | - ]; |
|
20 | + $params = [ |
|
21 | + 'route_id' => '66C2AC4A323053FF0A40FEB6918ACF5E', |
|
22 | + 'schedule_uid' => '1515E9A65DD2DEF79CAD7A7E68D91515' |
|
23 | + ]; |
|
24 | 24 | |
25 | - $schedule = $route_schedules->createRouteSchedule($params); |
|
25 | + $schedule = $route_schedules->createRouteSchedule($params); |
|
26 | 26 | |
27 | - print_r($schedule); |
|
27 | + print_r($schedule); |
|
28 | 28 | } catch (\Exception $e) { |
29 | - echo $e->getMessage() . PHP_EOL; |
|
29 | + echo $e->getMessage() . PHP_EOL; |
|
30 | 30 | } |