@@ 125-138 (lines=14) @@ | ||
122 | return Address::fromArray($addressUpdate); |
|
123 | } |
|
124 | ||
125 | public function markAddress($params) |
|
126 | { |
|
127 | $allQueryFields = array('route_id', 'route_destination_id'); |
|
128 | $allBodyFields = array('is_visited', 'is_departed'); |
|
129 | ||
130 | $result = Route4Me::makeRequst(array( |
|
131 | 'url' => Endpoint::ADDRESS_V4, |
|
132 | 'method' => 'PUT', |
|
133 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
134 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
135 | )); |
|
136 | ||
137 | return $result; |
|
138 | } |
|
139 | ||
140 | public function markAsDeparted($params) |
|
141 | { |
@@ 115-128 (lines=14) @@ | ||
112 | return $response; |
|
113 | } |
|
114 | ||
115 | public static function addDeviceRecord($params) |
|
116 | { |
|
117 | $allQueryFields = array('device_id', 'device_type'); |
|
118 | $allBodyFields = array('device_id', 'device_type', 'format'); |
|
119 | ||
120 | $response = Route4Me::makeRequst(array( |
|
121 | 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
122 | 'method' => 'POST', |
|
123 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
124 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
125 | )); |
|
126 | ||
127 | return $response; |
|
128 | } |
|
129 | ||
130 | public static function createMember($params) |
|
131 | { |
@@ 118-131 (lines=14) @@ | ||
115 | return self::update((array)$param); |
|
116 | } |
|
117 | ||
118 | public static function update($params) |
|
119 | { |
|
120 | $allQueryFields = array('optimization_problem_id', 'reoptimize'); |
|
121 | $allBodyFields = array('addresses'); |
|
122 | ||
123 | $optimize = Route4Me::makeRequst(array( |
|
124 | 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
125 | 'method' => 'PUT', |
|
126 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
127 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
128 | )); |
|
129 | ||
130 | return $optimize; |
|
131 | } |
|
132 | ||
133 | public function getOptimizationId() |
|
134 | { |
|
@@ 204-217 (lines=14) @@ | ||
201 | return $response; |
|
202 | } |
|
203 | ||
204 | public function removeOptimization($params) |
|
205 | { |
|
206 | $allQueryFields = array('redirect'); |
|
207 | $allBodyFields = array('optimization_problem_ids'); |
|
208 | ||
209 | $response = Route4Me::makeRequst(array( |
|
210 | 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
211 | 'method' => 'DELETE', |
|
212 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
213 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
214 | )); |
|
215 | ||
216 | return $response; |
|
217 | } |
|
218 | ||
219 | public function getHybridOptimization($params) |
|
220 | { |
|
@@ 232-245 (lines=14) @@ | ||
229 | return $optimize; |
|
230 | } |
|
231 | ||
232 | Public function addDepotsToHybrid($params) |
|
233 | { |
|
234 | $allQueryFields = array('optimization_problem_id'); |
|
235 | $allBodyFields = array('optimization_problem_id', 'delete_old_depots', 'new_depots'); |
|
236 | ||
237 | $depots = Route4Me::makeRequst(array( |
|
238 | 'url' => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT, |
|
239 | 'method' => 'POST', |
|
240 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
241 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
242 | )); |
|
243 | ||
244 | return $depots; |
|
245 | } |
|
246 | } |
|
247 |
@@ 95-108 (lines=14) @@ | ||
92 | return $response; |
|
93 | } |
|
94 | ||
95 | public static function addOrder2Route($params) |
|
96 | { |
|
97 | $allQueryFields = array('route_id', 'redirect'); |
|
98 | $allBodyFields = array('addresses'); |
|
99 | ||
100 | $response = Route4Me::makeRequst(array( |
|
101 | 'url' => Endpoint::ROUTE_V4, |
|
102 | 'method' => 'PUT', |
|
103 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
104 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
105 | )); |
|
106 | ||
107 | return $response; |
|
108 | } |
|
109 | ||
110 | public static function addOrder2Optimization($params) |
|
111 | { |
|
@@ 110-123 (lines=14) @@ | ||
107 | return $response; |
|
108 | } |
|
109 | ||
110 | public static function addOrder2Optimization($params) |
|
111 | { |
|
112 | $allQueryFields = array('optimization_problem_id', 'redirect', 'device_type'); |
|
113 | $allBodyFields = array('addresses'); |
|
114 | ||
115 | $response = Route4Me::makeRequst(array( |
|
116 | 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
117 | 'method' => 'PUT', |
|
118 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
119 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
120 | )); |
|
121 | ||
122 | return $response; |
|
123 | } |
|
124 | ||
125 | public static function getOrder($params) |
|
126 | { |
@@ 144-157 (lines=14) @@ | ||
141 | return $result; |
|
142 | } |
|
143 | ||
144 | public function resequenceRoute($params) |
|
145 | { |
|
146 | $allQueryFields = array('route_id', 'route_destination_id'); |
|
147 | $allBodyFields = array('addresses'); |
|
148 | ||
149 | $result = Route4Me::makeRequst(array( |
|
150 | 'url' => Endpoint::ROUTE_V4, |
|
151 | 'method' => 'PUT', |
|
152 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
153 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
154 | )); |
|
155 | ||
156 | return $result; |
|
157 | } |
|
158 | ||
159 | public function resequenceAllAddresses($params) |
|
160 | { |
|
@@ 186-200 (lines=15) @@ | ||
183 | return $result; |
|
184 | } |
|
185 | ||
186 | public function shareRoute($params) |
|
187 | { |
|
188 | $allQueryFields = array('route_id', 'response_format'); |
|
189 | $allBodyFields = array('recipient_email'); |
|
190 | ||
191 | $result = Route4Me::makeRequst(array( |
|
192 | 'url' => Endpoint::ROUTE_SHARE, |
|
193 | 'method' => 'POST', |
|
194 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
195 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
196 | 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
197 | )); |
|
198 | ||
199 | return $result; |
|
200 | } |
|
201 | ||
202 | // Returns random route_id from existing routes between $offset and $offset+$limit |
|
203 | public function getRandomRouteId($offset, $limit) |
|
@@ 293-306 (lines=14) @@ | ||
290 | return Route::fromArray($route); |
|
291 | } |
|
292 | ||
293 | public function insertAddressOptimalPosition(array $params) |
|
294 | { |
|
295 | $allQueryFields = array('route_id'); |
|
296 | $allBodyFields = array('addresses', 'optimal_position'); |
|
297 | ||
298 | $route = Route4Me::makeRequst(array( |
|
299 | 'url' => Endpoint::ROUTE_V4, |
|
300 | 'method' => 'PUT', |
|
301 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
302 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
303 | )); |
|
304 | ||
305 | return Route::fromArray($route); |
|
306 | } |
|
307 | ||
308 | public function addNoteFile($params) |
|
309 | { |
@@ 93-106 (lines=14) @@ | ||
90 | return $result; |
|
91 | } |
|
92 | ||
93 | public function updateTerritory($params) |
|
94 | { |
|
95 | $allQueryFields = array('territory_id'); |
|
96 | $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory'); |
|
97 | ||
98 | $response = Route4Me::makeRequst(array( |
|
99 | 'url' => Endpoint::TERRITORY_V4, |
|
100 | 'method' => 'PUT', |
|
101 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
102 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
103 | )); |
|
104 | ||
105 | return $response; |
|
106 | } |
|
107 | } |
|
108 |