@@ -6,327 +6,327 @@ |
||
6 | 6 | |
7 | 7 | class Member extends Common |
8 | 8 | { |
9 | - public $device_id; |
|
10 | - public $device_type; |
|
11 | - public $format; |
|
9 | + public $device_id; |
|
10 | + public $device_type; |
|
11 | + public $format; |
|
12 | 12 | |
13 | - public $strEmail; |
|
14 | - public $strPassword; |
|
15 | - public $strPassword_1; |
|
16 | - public $strPassword_2; |
|
17 | - public $strFirstName; |
|
18 | - public $strLastName; |
|
19 | - public $strIndustry; |
|
20 | - public $chkTerms; |
|
21 | - public $plan; |
|
13 | + public $strEmail; |
|
14 | + public $strPassword; |
|
15 | + public $strPassword_1; |
|
16 | + public $strPassword_2; |
|
17 | + public $strFirstName; |
|
18 | + public $strLastName; |
|
19 | + public $strIndustry; |
|
20 | + public $chkTerms; |
|
21 | + public $plan; |
|
22 | 22 | |
23 | - public $session_guid; |
|
24 | - public $member_id; |
|
23 | + public $session_guid; |
|
24 | + public $member_id; |
|
25 | 25 | |
26 | - public $email_address; |
|
27 | - public $first_name; |
|
28 | - public $last_name; |
|
29 | - public $phone_number; |
|
30 | - public $company_name; |
|
31 | - public $webinar_date; |
|
26 | + public $email_address; |
|
27 | + public $first_name; |
|
28 | + public $last_name; |
|
29 | + public $phone_number; |
|
30 | + public $company_name; |
|
31 | + public $webinar_date; |
|
32 | 32 | |
33 | - public $subscription_name; |
|
34 | - public $token; |
|
35 | - public $payload; |
|
33 | + public $subscription_name; |
|
34 | + public $token; |
|
35 | + public $payload; |
|
36 | 36 | |
37 | - public $HIDE_ROUTED_ADDRESSES; |
|
38 | - public $member_phone; |
|
39 | - public $member_zipcode; |
|
40 | - public $route_count; |
|
41 | - public $member_email; |
|
42 | - public $HIDE_VISITED_ADDRESSES; |
|
43 | - public $READONLY_USER; |
|
44 | - public $member_type; |
|
45 | - public $date_of_birth; |
|
46 | - public $member_first_name; |
|
47 | - public $member_password; |
|
48 | - public $HIDE_NONFUTURE_ROUTES; |
|
49 | - public $member_last_name; |
|
50 | - public $SHOW_ALL_VEHICLES; |
|
51 | - public $SHOW_ALL_DRIVERS; |
|
37 | + public $HIDE_ROUTED_ADDRESSES; |
|
38 | + public $member_phone; |
|
39 | + public $member_zipcode; |
|
40 | + public $route_count; |
|
41 | + public $member_email; |
|
42 | + public $HIDE_VISITED_ADDRESSES; |
|
43 | + public $READONLY_USER; |
|
44 | + public $member_type; |
|
45 | + public $date_of_birth; |
|
46 | + public $member_first_name; |
|
47 | + public $member_password; |
|
48 | + public $HIDE_NONFUTURE_ROUTES; |
|
49 | + public $member_last_name; |
|
50 | + public $SHOW_ALL_VEHICLES; |
|
51 | + public $SHOW_ALL_DRIVERS; |
|
52 | 52 | |
53 | - public $config_key; |
|
54 | - public $config_value; |
|
53 | + public $config_key; |
|
54 | + public $config_value; |
|
55 | 55 | |
56 | - public $preferred_units; |
|
57 | - public $preferred_language; |
|
58 | - public $timezone; |
|
59 | - public $OWNER_MEMBER_ID; |
|
60 | - public $user_reg_state_id; |
|
61 | - public $user_reg_country_id; |
|
62 | - public $member_picture; |
|
63 | - public $api_key; |
|
64 | - public $custom_data; |
|
56 | + public $preferred_units; |
|
57 | + public $preferred_language; |
|
58 | + public $timezone; |
|
59 | + public $OWNER_MEMBER_ID; |
|
60 | + public $user_reg_state_id; |
|
61 | + public $user_reg_country_id; |
|
62 | + public $member_picture; |
|
63 | + public $api_key; |
|
64 | + public $custom_data; |
|
65 | 65 | |
66 | - public static function fromArray(array $params) |
|
67 | - { |
|
68 | - $member= new Member(); |
|
69 | - |
|
70 | - foreach($params as $key => $value) { |
|
71 | - if (property_exists($member, $key)) { |
|
72 | - $member->{$key} = $value; |
|
73 | - } |
|
74 | - } |
|
75 | - |
|
76 | - return $member; |
|
77 | - } |
|
66 | + public static function fromArray(array $params) |
|
67 | + { |
|
68 | + $member= new Member(); |
|
69 | + |
|
70 | + foreach($params as $key => $value) { |
|
71 | + if (property_exists($member, $key)) { |
|
72 | + $member->{$key} = $value; |
|
73 | + } |
|
74 | + } |
|
75 | + |
|
76 | + return $member; |
|
77 | + } |
|
78 | 78 | |
79 | - public static function getUsers() |
|
80 | - { |
|
81 | - $response = Route4Me::makeRequst(array( |
|
82 | - 'url' => Endpoint::USER_V4, |
|
83 | - 'method' => 'GET' |
|
84 | - )); |
|
79 | + public static function getUsers() |
|
80 | + { |
|
81 | + $response = Route4Me::makeRequst(array( |
|
82 | + 'url' => Endpoint::USER_V4, |
|
83 | + 'method' => 'GET' |
|
84 | + )); |
|
85 | 85 | |
86 | - return $response; |
|
87 | - } |
|
86 | + return $response; |
|
87 | + } |
|
88 | 88 | |
89 | - public static function getUser($params) |
|
90 | - { |
|
91 | - $response = Route4Me::makeRequst(array( |
|
92 | - 'url' => Endpoint::USER_V4, |
|
93 | - 'method' => 'GET', |
|
94 | - 'query' => array( |
|
95 | - 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
96 | - ) |
|
97 | - )); |
|
89 | + public static function getUser($params) |
|
90 | + { |
|
91 | + $response = Route4Me::makeRequst(array( |
|
92 | + 'url' => Endpoint::USER_V4, |
|
93 | + 'method' => 'GET', |
|
94 | + 'query' => array( |
|
95 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
96 | + ) |
|
97 | + )); |
|
98 | 98 | |
99 | - return $response; |
|
100 | - } |
|
99 | + return $response; |
|
100 | + } |
|
101 | 101 | |
102 | - public static function getUserLocations($param) |
|
103 | - { |
|
104 | - $response = Route4Me::makeRequst(array( |
|
105 | - 'url' => Endpoint::VIEW_USER_LOCATIONS, |
|
106 | - 'method' => 'GET', |
|
107 | - 'query' => array( |
|
108 | - 'query' => $param |
|
109 | - ) |
|
110 | - )); |
|
102 | + public static function getUserLocations($param) |
|
103 | + { |
|
104 | + $response = Route4Me::makeRequst(array( |
|
105 | + 'url' => Endpoint::VIEW_USER_LOCATIONS, |
|
106 | + 'method' => 'GET', |
|
107 | + 'query' => array( |
|
108 | + 'query' => $param |
|
109 | + ) |
|
110 | + )); |
|
111 | 111 | |
112 | - return $response; |
|
113 | - } |
|
112 | + return $response; |
|
113 | + } |
|
114 | 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 | - } |
|
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 | 129 | |
130 | - public static function createMember($params) |
|
131 | - { |
|
132 | - $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', |
|
133 | - 'company_name', 'config_key', 'config_value', 'api_key'); |
|
130 | + public static function createMember($params) |
|
131 | + { |
|
132 | + $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', |
|
133 | + 'company_name', 'config_key', 'config_value', 'api_key'); |
|
134 | 134 | |
135 | - $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
135 | + $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
136 | 136 | |
137 | - $response = Route4Me::makeRequst(array( |
|
138 | - 'url' => Endpoint::USER_V4, |
|
139 | - 'method' => 'POST', |
|
140 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
141 | - )); |
|
142 | - |
|
143 | - return $response; |
|
144 | - } |
|
137 | + $response = Route4Me::makeRequst(array( |
|
138 | + 'url' => Endpoint::USER_V4, |
|
139 | + 'method' => 'POST', |
|
140 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
141 | + )); |
|
142 | + |
|
143 | + return $response; |
|
144 | + } |
|
145 | 145 | |
146 | - public static function getRandomMemberByType($memberType) |
|
147 | - { |
|
148 | - $members = self::getUsers(); |
|
146 | + public static function getRandomMemberByType($memberType) |
|
147 | + { |
|
148 | + $members = self::getUsers(); |
|
149 | 149 | |
150 | - if (is_null($members)) { |
|
151 | - return null; |
|
152 | - } |
|
150 | + if (is_null($members)) { |
|
151 | + return null; |
|
152 | + } |
|
153 | 153 | |
154 | - if (!isset($members['results'])) { |
|
155 | - return null; |
|
156 | - } |
|
154 | + if (!isset($members['results'])) { |
|
155 | + return null; |
|
156 | + } |
|
157 | 157 | |
158 | - $memberIDs = array(); |
|
158 | + $memberIDs = array(); |
|
159 | 159 | |
160 | - foreach ($members['results'] as $memb) { |
|
161 | - if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
162 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
163 | - } |
|
164 | - } |
|
160 | + foreach ($members['results'] as $memb) { |
|
161 | + if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
162 | + if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
163 | + } |
|
164 | + } |
|
165 | 165 | |
166 | - if (sizeof($memberIDs)<1) { |
|
167 | - return null; |
|
168 | - } |
|
166 | + if (sizeof($memberIDs)<1) { |
|
167 | + return null; |
|
168 | + } |
|
169 | 169 | |
170 | - $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
170 | + $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
171 | 171 | |
172 | - return $memberIDs[$randomIndex]; |
|
173 | - } |
|
172 | + return $memberIDs[$randomIndex]; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | - public static function updateMember($body) |
|
177 | - { |
|
178 | - $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', |
|
179 | - 'company_name', 'config_key', 'config_value', 'api_key'); |
|
176 | + public static function updateMember($body) |
|
177 | + { |
|
178 | + $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', |
|
179 | + 'company_name', 'config_key', 'config_value', 'api_key'); |
|
180 | 180 | |
181 | - $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
181 | + $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
182 | 182 | |
183 | - $response = Route4Me::makeRequst(array( |
|
184 | - 'url' => Endpoint::USER_V4, |
|
185 | - 'method' => 'PUT', |
|
186 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $body) |
|
187 | - )); |
|
183 | + $response = Route4Me::makeRequst(array( |
|
184 | + 'url' => Endpoint::USER_V4, |
|
185 | + 'method' => 'PUT', |
|
186 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $body) |
|
187 | + )); |
|
188 | 188 | |
189 | - return $response; |
|
190 | - } |
|
189 | + return $response; |
|
190 | + } |
|
191 | 191 | |
192 | - public static function deleteMember($body) |
|
193 | - { |
|
194 | - $response = Route4Me::makeRequst(array( |
|
195 | - 'url' => Endpoint::USER_V4, |
|
196 | - 'method' => 'DELETE', |
|
197 | - 'body' => array( |
|
198 | - 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
199 | - ) |
|
192 | + public static function deleteMember($body) |
|
193 | + { |
|
194 | + $response = Route4Me::makeRequst(array( |
|
195 | + 'url' => Endpoint::USER_V4, |
|
196 | + 'method' => 'DELETE', |
|
197 | + 'body' => array( |
|
198 | + 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
199 | + ) |
|
200 | 200 | |
201 | - )); |
|
201 | + )); |
|
202 | 202 | |
203 | - return $response; |
|
204 | - } |
|
203 | + return $response; |
|
204 | + } |
|
205 | 205 | |
206 | - public static function newAccountRegistration($params) |
|
207 | - { |
|
208 | - $allQueryFields = array('plan'); |
|
209 | - $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', |
|
210 | - 'strLastName', 'format', 'strIndustry', 'chkTerms', |
|
211 | - 'device_type', 'strSubAccountType', 'blDisableMarketing', 'blDisableAccountActivationEmail'); |
|
212 | - |
|
213 | - $response = Route4Me::makeRequst(array( |
|
214 | - 'url' => Endpoint::REGISTER_ACTION, |
|
215 | - 'method' => 'POST', |
|
216 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
217 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
218 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
219 | - )); |
|
220 | - |
|
221 | - return $response; |
|
222 | - } |
|
206 | + public static function newAccountRegistration($params) |
|
207 | + { |
|
208 | + $allQueryFields = array('plan'); |
|
209 | + $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', |
|
210 | + 'strLastName', 'format', 'strIndustry', 'chkTerms', |
|
211 | + 'device_type', 'strSubAccountType', 'blDisableMarketing', 'blDisableAccountActivationEmail'); |
|
212 | + |
|
213 | + $response = Route4Me::makeRequst(array( |
|
214 | + 'url' => Endpoint::REGISTER_ACTION, |
|
215 | + 'method' => 'POST', |
|
216 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
217 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
218 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
219 | + )); |
|
220 | + |
|
221 | + return $response; |
|
222 | + } |
|
223 | 223 | |
224 | - public static function validateSession($params) |
|
225 | - { |
|
226 | - $allQueryFields = array('session_guid', 'member_id', 'format'); |
|
227 | - |
|
228 | - $response = Route4Me::makeRequst(array( |
|
229 | - 'url' => Endpoint::VALIDATE_SESSION, |
|
230 | - 'method' => 'GET', |
|
231 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
232 | - )); |
|
233 | - |
|
234 | - return $response; |
|
235 | - } |
|
224 | + public static function validateSession($params) |
|
225 | + { |
|
226 | + $allQueryFields = array('session_guid', 'member_id', 'format'); |
|
227 | + |
|
228 | + $response = Route4Me::makeRequst(array( |
|
229 | + 'url' => Endpoint::VALIDATE_SESSION, |
|
230 | + 'method' => 'GET', |
|
231 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
232 | + )); |
|
233 | + |
|
234 | + return $response; |
|
235 | + } |
|
236 | 236 | |
237 | - public static function memberAuthentication($params) |
|
238 | - { |
|
239 | - $allBodyFields = array('strEmail', 'strPassword', 'format'); |
|
240 | - |
|
241 | - $response = Route4Me::makeRequst(array( |
|
242 | - 'url' => Endpoint::AUTHENTICATE, |
|
243 | - 'method' => 'POST', |
|
244 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
245 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
246 | - )); |
|
247 | - |
|
248 | - return $response; |
|
249 | - } |
|
237 | + public static function memberAuthentication($params) |
|
238 | + { |
|
239 | + $allBodyFields = array('strEmail', 'strPassword', 'format'); |
|
240 | + |
|
241 | + $response = Route4Me::makeRequst(array( |
|
242 | + 'url' => Endpoint::AUTHENTICATE, |
|
243 | + 'method' => 'POST', |
|
244 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
245 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
246 | + )); |
|
247 | + |
|
248 | + return $response; |
|
249 | + } |
|
250 | 250 | |
251 | - public static function webinarRegistration($params) |
|
252 | - { |
|
253 | - $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', |
|
254 | - 'company_name', 'member_id', 'webinar_date'); |
|
255 | - |
|
256 | - $response = Route4Me::makeRequst(array( |
|
257 | - 'url' => Endpoint::WEBINAR_REGISTER, |
|
258 | - 'method' => 'POST', |
|
259 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
260 | - )); |
|
261 | - |
|
262 | - return $response; |
|
263 | - } |
|
251 | + public static function webinarRegistration($params) |
|
252 | + { |
|
253 | + $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', |
|
254 | + 'company_name', 'member_id', 'webinar_date'); |
|
255 | + |
|
256 | + $response = Route4Me::makeRequst(array( |
|
257 | + 'url' => Endpoint::WEBINAR_REGISTER, |
|
258 | + 'method' => 'POST', |
|
259 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
260 | + )); |
|
261 | + |
|
262 | + return $response; |
|
263 | + } |
|
264 | 264 | |
265 | - public static function purchaseUserLicense($params) |
|
266 | - { |
|
267 | - $allQueryFields = array('device_id'); |
|
268 | - $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', |
|
269 | - 'subscription_name', 'token', 'payload', 'format'); |
|
270 | - |
|
271 | - $response = Route4Me::makeRequst(array( |
|
272 | - 'url' => Endpoint::USER_LICENSE, |
|
273 | - 'method' => 'POST', |
|
274 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
275 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
276 | - )); |
|
277 | - |
|
278 | - return $response; |
|
279 | - } |
|
265 | + public static function purchaseUserLicense($params) |
|
266 | + { |
|
267 | + $allQueryFields = array('device_id'); |
|
268 | + $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', |
|
269 | + 'subscription_name', 'token', 'payload', 'format'); |
|
270 | + |
|
271 | + $response = Route4Me::makeRequst(array( |
|
272 | + 'url' => Endpoint::USER_LICENSE, |
|
273 | + 'method' => 'POST', |
|
274 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
275 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
276 | + )); |
|
277 | + |
|
278 | + return $response; |
|
279 | + } |
|
280 | 280 | |
281 | - public static function newMemberConfigKey($params) |
|
282 | - { |
|
283 | - $allBodyFields = array('config_key', 'config_value'); |
|
284 | - |
|
285 | - $response = Route4Me::makeRequst(array( |
|
286 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
287 | - 'method' => 'POST', |
|
288 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
289 | - )); |
|
290 | - |
|
291 | - return $response; |
|
292 | - } |
|
281 | + public static function newMemberConfigKey($params) |
|
282 | + { |
|
283 | + $allBodyFields = array('config_key', 'config_value'); |
|
284 | + |
|
285 | + $response = Route4Me::makeRequst(array( |
|
286 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
287 | + 'method' => 'POST', |
|
288 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
289 | + )); |
|
290 | + |
|
291 | + return $response; |
|
292 | + } |
|
293 | 293 | |
294 | - public static function removeMemberConfigKey($params) |
|
295 | - { |
|
296 | - $allBodyFields = array('config_key'); |
|
297 | - |
|
298 | - $response = Route4Me::makeRequst(array( |
|
299 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
300 | - 'method' => 'DELETE', |
|
301 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
302 | - )); |
|
303 | - |
|
304 | - return $response; |
|
305 | - } |
|
294 | + public static function removeMemberConfigKey($params) |
|
295 | + { |
|
296 | + $allBodyFields = array('config_key'); |
|
297 | + |
|
298 | + $response = Route4Me::makeRequst(array( |
|
299 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
300 | + 'method' => 'DELETE', |
|
301 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
302 | + )); |
|
303 | + |
|
304 | + return $response; |
|
305 | + } |
|
306 | 306 | |
307 | - public static function getMemberConfigData($params) |
|
308 | - { |
|
309 | - $allQueryFields = array('config_key'); |
|
310 | - |
|
311 | - $response = Route4Me::makeRequst(array( |
|
312 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
313 | - 'method' => 'GET', |
|
314 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
315 | - )); |
|
316 | - |
|
317 | - return $response; |
|
318 | - } |
|
307 | + public static function getMemberConfigData($params) |
|
308 | + { |
|
309 | + $allQueryFields = array('config_key'); |
|
310 | + |
|
311 | + $response = Route4Me::makeRequst(array( |
|
312 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
313 | + 'method' => 'GET', |
|
314 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
315 | + )); |
|
316 | + |
|
317 | + return $response; |
|
318 | + } |
|
319 | 319 | |
320 | - public static function updateMemberConfigKey($params) |
|
321 | - { |
|
322 | - $allBodyFields = array('config_key', 'config_value'); |
|
323 | - |
|
324 | - $response = Route4Me::makeRequst(array( |
|
325 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
326 | - 'method' => 'PUT', |
|
327 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
328 | - )); |
|
329 | - |
|
330 | - return $response; |
|
331 | - } |
|
320 | + public static function updateMemberConfigKey($params) |
|
321 | + { |
|
322 | + $allBodyFields = array('config_key', 'config_value'); |
|
323 | + |
|
324 | + $response = Route4Me::makeRequst(array( |
|
325 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
326 | + 'method' => 'PUT', |
|
327 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
328 | + )); |
|
329 | + |
|
330 | + return $response; |
|
331 | + } |
|
332 | 332 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | public static function fromArray(array $params) |
67 | 67 | { |
68 | - $member= new Member(); |
|
68 | + $member = new Member(); |
|
69 | 69 | |
70 | - foreach($params as $key => $value) { |
|
70 | + foreach ($params as $key => $value) { |
|
71 | 71 | if (property_exists($member, $key)) { |
72 | 72 | $member->{$key} = $value; |
73 | 73 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | foreach ($members['results'] as $memb) { |
161 | 161 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
162 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
162 | + if ($memberType==$memb['member_type']) $memberIDs[] = $memb['member_id']; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 |
@@ -159,7 +159,9 @@ |
||
159 | 159 | |
160 | 160 | foreach ($members['results'] as $memb) { |
161 | 161 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
162 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
162 | + if ($memberType==$memb['member_type']) { |
|
163 | + $memberIDs[]=$memb['member_id']; |
|
164 | + } |
|
163 | 165 | } |
164 | 166 | } |
165 | 167 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | // The example refers to the process of searching for the specified text throughout all routes, belonging to the user's account. |
14 | 14 | |
15 | 15 | $RouteParameters = array( |
16 | - "query" => 'Automated' |
|
16 | + "query" => 'Automated' |
|
17 | 17 | ); |
18 | 18 | |
19 | 19 | $route = new Route(); |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | |
23 | 23 | foreach ($routeResults as $routeResult) |
24 | 24 | { |
25 | - $results = (array)$routeResult; |
|
25 | + $results = (array)$routeResult; |
|
26 | 26 | |
27 | - if (isset($results['route_id'])) { |
|
28 | - echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
29 | - } |
|
27 | + if (isset($results['route_id'])) { |
|
28 | + echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
29 | + } |
|
30 | 30 | |
31 | - if (isset($results['parameters']->route_name)) { |
|
32 | - echo "Route name - > ".$results['parameters']->route_name."<br>"; |
|
33 | - } |
|
31 | + if (isset($results['parameters']->route_name)) { |
|
32 | + echo "Route name - > ".$results['parameters']->route_name."<br>"; |
|
33 | + } |
|
34 | 34 | |
35 | - echo "<br>"; |
|
35 | + echo "<br>"; |
|
36 | 36 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Route4Me; |
3 | 3 | |
4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
5 | 5 | require $root.'/vendor/autoload.php'; |
6 | 6 | |
7 | 7 | use Route4Me\Route4Me; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $results = (array)$routeResult; |
26 | 26 | |
27 | 27 | if (isset($results['route_id'])) { |
28 | - echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
28 | + echo "Route ID - > ".$results['route_id']."<br>"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (isset($results['parameters']->route_name)) { |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | $count = 0; |
26 | 26 | |
27 | 27 | while ($route_id1==$route_id2) { |
28 | - $route_id2 = $route->getRandomRouteId(0, 20); |
|
28 | + $route_id2 = $route->getRandomRouteId(0, 20); |
|
29 | 29 | |
30 | - $count++; |
|
30 | + $count++; |
|
31 | 31 | |
32 | - if ($count>5) { |
|
33 | - break; |
|
34 | - } |
|
32 | + if ($count>5) { |
|
33 | + break; |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | echo "Route ID 1 -> $route_id1 <br> Route ID 2 -> $route_id2 <br>"; |
@@ -43,21 +43,21 @@ discard block |
||
43 | 43 | $depot = null; |
44 | 44 | |
45 | 45 | foreach ($addresses as $address) { |
46 | - if (isset($address->is_depot)) { |
|
47 | - if ($address->is_depot==true) { |
|
48 | - $depot = $address; |
|
49 | - break; |
|
50 | - } |
|
51 | - } |
|
46 | + if (isset($address->is_depot)) { |
|
47 | + if ($address->is_depot==true) { |
|
48 | + $depot = $address; |
|
49 | + break; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // Merge the selected routes |
55 | 55 | $params = array( |
56 | - "route_ids" => $route_id1.",".$route_id2, |
|
57 | - "depot_address" => $depot->address, |
|
58 | - "remove_origin" => false, |
|
59 | - "depot_lat" => $depot->lat, |
|
60 | - "depot_lat" => $depot->lng |
|
56 | + "route_ids" => $route_id1.",".$route_id2, |
|
57 | + "depot_address" => $depot->address, |
|
58 | + "remove_origin" => false, |
|
59 | + "depot_lat" => $depot->lat, |
|
60 | + "depot_lat" => $depot->lng |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $result = $route->mergeRoutes($params); |
@@ -23,26 +23,26 @@ |
||
23 | 23 | |
24 | 24 | // Get a route with the path points |
25 | 25 | $params = array( |
26 | - "route_path_output" => "Points", |
|
27 | - "compress_path_points" => TRUE, |
|
28 | - "route_id" => $route_id |
|
26 | + "route_path_output" => "Points", |
|
27 | + "compress_path_points" => TRUE, |
|
28 | + "route_id" => $route_id |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | $routeResults = (array)$route->getRoutePoints($params); |
32 | 32 | |
33 | 33 | if (isset($routeResults['addresses'])) { |
34 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
35 | - $araddress = (array)$address; |
|
34 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
35 | + $araddress = (array)$address; |
|
36 | 36 | |
37 | - if (isset($araddress['route_destination_id'])) { |
|
38 | - echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
39 | - } |
|
37 | + if (isset($araddress['route_destination_id'])) { |
|
38 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
39 | + } |
|
40 | 40 | |
41 | - if (isset($araddress['path_to_next'])) { |
|
42 | - echo "path_to_next:<br>"; |
|
43 | - Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
44 | - } |
|
41 | + if (isset($araddress['path_to_next'])) { |
|
42 | + echo "path_to_next:<br>"; |
|
43 | + Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
44 | + } |
|
45 | 45 | |
46 | - echo "<br>"; |
|
47 | - } |
|
46 | + echo "<br>"; |
|
47 | + } |
|
48 | 48 | } |
@@ -23,25 +23,25 @@ |
||
23 | 23 | |
24 | 24 | // Get a route with the path points |
25 | 25 | $params = array( |
26 | - "route_path_output" => "Points", |
|
27 | - "route_id" => $route_id |
|
26 | + "route_path_output" => "Points", |
|
27 | + "route_id" => $route_id |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | $routeResults = (array)$route->getRoutePoints($params); |
31 | 31 | |
32 | 32 | if (isset($routeResults['addresses'])) { |
33 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
34 | - $araddress = (array)$address; |
|
33 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
34 | + $araddress = (array)$address; |
|
35 | 35 | |
36 | - if (isset($araddress['route_destination_id'])) { |
|
37 | - echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
38 | - } |
|
36 | + if (isset($araddress['route_destination_id'])) { |
|
37 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
38 | + } |
|
39 | 39 | |
40 | - if (isset($araddress['path_to_next'])) { |
|
41 | - echo "path_to_next:<br>"; |
|
42 | - Route4Me::simplePrint($araddress['path_to_next']); |
|
43 | - } |
|
40 | + if (isset($araddress['path_to_next'])) { |
|
41 | + echo "path_to_next:<br>"; |
|
42 | + Route4Me::simplePrint($araddress['path_to_next']); |
|
43 | + } |
|
44 | 44 | |
45 | - echo "<br>"; |
|
46 | - } |
|
45 | + echo "<br>"; |
|
46 | + } |
|
47 | 47 | } |
@@ -26,22 +26,22 @@ discard block |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | - "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
|
35 | - "route_date" => time() + 24*60*60, |
|
36 | - "route_time" => 60 * 60 * 7, |
|
37 | - "distance_unit" => DistanceUnit::MILES, |
|
38 | - "device_type" => DeviceType::WEB, |
|
39 | - "optimize" => OptimizationType::DISTANCE, |
|
40 | - "metric" => Metric::GEODESIC, |
|
41 | - "route_max_duration" => 86400, |
|
42 | - "travel_mode" => TravelMode::DRIVING, |
|
43 | - "vehicle_capacity" => 1, |
|
44 | - "vehicle_max_distance_mi" => 10000 |
|
33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | + "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
|
35 | + "route_date" => time() + 24*60*60, |
|
36 | + "route_time" => 60 * 60 * 7, |
|
37 | + "distance_unit" => DistanceUnit::MILES, |
|
38 | + "device_type" => DeviceType::WEB, |
|
39 | + "optimize" => OptimizationType::DISTANCE, |
|
40 | + "metric" => Metric::GEODESIC, |
|
41 | + "route_max_duration" => 86400, |
|
42 | + "travel_mode" => TravelMode::DRIVING, |
|
43 | + "vehicle_capacity" => 1, |
|
44 | + "vehicle_max_distance_mi" => 10000 |
|
45 | 45 | )); |
46 | 46 | |
47 | 47 | $optimizationParams = new OptimizationProblemParams; |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $problem = OptimizationProblem::optimize($optimizationParams); |
52 | 52 | |
53 | 53 | foreach ((array)$problem as $key => $value) { |
54 | - if (is_string($value)) { |
|
55 | - echo $key." --> ".$value."<br>"; |
|
56 | - } else { |
|
57 | - echo "************ $key ************* <br>"; |
|
58 | - Route4Me::simplePrint((array)$value, true); |
|
59 | - echo "******************************* <br>"; |
|
60 | - } |
|
54 | + if (is_string($value)) { |
|
55 | + echo $key." --> ".$value."<br>"; |
|
56 | + } else { |
|
57 | + echo "************ $key ************* <br>"; |
|
58 | + Route4Me::simplePrint((array)$value, true); |
|
59 | + echo "******************************* <br>"; |
|
60 | + } |
|
61 | 61 | } |
@@ -24,10 +24,10 @@ |
||
24 | 24 | |
25 | 25 | // Remove an optimization |
26 | 26 | $params = array( |
27 | - "optimization_problem_ids" => array( |
|
28 | - "0" => $optimizationProblemId |
|
29 | - ), |
|
30 | - "redirect" => 0 |
|
27 | + "optimization_problem_ids" => array( |
|
28 | + "0" => $optimizationProblemId |
|
29 | + ), |
|
30 | + "redirect" => 0 |
|
31 | 31 | ); |
32 | 32 | |
33 | 33 | $result = $optimization->removeOptimization($params); |
@@ -18,38 +18,38 @@ |
||
18 | 18 | $vehicle = new Vehicle(); |
19 | 19 | |
20 | 20 | $vehicleParameters = Vehicle::fromArray(array( |
21 | - 'vehicle_alias' => 'Peterbilt 579', |
|
22 | - 'vehicle_vin' => '1NP5DB9X93N507873', |
|
23 | - 'vehicle_license_plate' => 'PPV7516', |
|
24 | - 'license_start_date' => '2017-06-05', |
|
25 | - 'license_end_date' => '2021-08-14', |
|
26 | - 'vehicle_model' => '579', |
|
27 | - 'vehicle_model_year' => 2015, |
|
28 | - 'vehicle_year_acquired' => 2018, |
|
29 | - 'vehicle_reg_country_id' => '223', |
|
30 | - 'vehicle_make' => 'Peterbilt', |
|
31 | - 'vehicle_type_id' => 'tractor_trailer', |
|
32 | - 'has_trailer' => true, |
|
33 | - 'vehicle_axle_count' => 5, |
|
34 | - 'mpg_city' => 6, |
|
35 | - 'mpg_highway' => 12, |
|
36 | - 'fuel_type' => 'diesel', |
|
37 | - 'height_inches' => 114, |
|
38 | - 'height_metric' => 290, |
|
39 | - 'weight_lb' => 50350, |
|
40 | - 'maxWeightPerAxleGroupInPounds' => 40000, |
|
41 | - 'max_weight_per_axle_group_metric' => 18000, |
|
42 | - 'widthInInches' => 102, |
|
43 | - 'width_metric' => 258, |
|
44 | - 'lengthInInches' => 640, |
|
45 | - 'length_metric' => 1625, |
|
46 | - 'Use53FootTrailerRouting' => 'YES', |
|
47 | - 'UseTruckRestrictions' => 'YES', |
|
48 | - 'DividedHighwayAvoidPreference' => 'STRONG_AVOID', |
|
49 | - 'FreewayAvoidPreference' => 'STRONG_AVOID', |
|
50 | - 'truck_config' => '53_SEMI_TRAILER', |
|
51 | - 'InternationalBordersOpen' => 'YES', |
|
52 | - 'purchased_new' => true |
|
21 | + 'vehicle_alias' => 'Peterbilt 579', |
|
22 | + 'vehicle_vin' => '1NP5DB9X93N507873', |
|
23 | + 'vehicle_license_plate' => 'PPV7516', |
|
24 | + 'license_start_date' => '2017-06-05', |
|
25 | + 'license_end_date' => '2021-08-14', |
|
26 | + 'vehicle_model' => '579', |
|
27 | + 'vehicle_model_year' => 2015, |
|
28 | + 'vehicle_year_acquired' => 2018, |
|
29 | + 'vehicle_reg_country_id' => '223', |
|
30 | + 'vehicle_make' => 'Peterbilt', |
|
31 | + 'vehicle_type_id' => 'tractor_trailer', |
|
32 | + 'has_trailer' => true, |
|
33 | + 'vehicle_axle_count' => 5, |
|
34 | + 'mpg_city' => 6, |
|
35 | + 'mpg_highway' => 12, |
|
36 | + 'fuel_type' => 'diesel', |
|
37 | + 'height_inches' => 114, |
|
38 | + 'height_metric' => 290, |
|
39 | + 'weight_lb' => 50350, |
|
40 | + 'maxWeightPerAxleGroupInPounds' => 40000, |
|
41 | + 'max_weight_per_axle_group_metric' => 18000, |
|
42 | + 'widthInInches' => 102, |
|
43 | + 'width_metric' => 258, |
|
44 | + 'lengthInInches' => 640, |
|
45 | + 'length_metric' => 1625, |
|
46 | + 'Use53FootTrailerRouting' => 'YES', |
|
47 | + 'UseTruckRestrictions' => 'YES', |
|
48 | + 'DividedHighwayAvoidPreference' => 'STRONG_AVOID', |
|
49 | + 'FreewayAvoidPreference' => 'STRONG_AVOID', |
|
50 | + 'truck_config' => '53_SEMI_TRAILER', |
|
51 | + 'InternationalBordersOpen' => 'YES', |
|
52 | + 'purchased_new' => true |
|
53 | 53 | )); |
54 | 54 | |
55 | 55 | $result = $vehicle->createVehicle($vehicleParameters); |
@@ -23,17 +23,17 @@ |
||
23 | 23 | |
24 | 24 | // Update the vehicle |
25 | 25 | $vehicleParameters = Vehicle::fromArray(array( |
26 | - 'vehicle_id' => $randomVehicleID, |
|
27 | - 'vehicle_model_year' => 2013, |
|
28 | - 'vehicle_year_acquired' => 2016, |
|
29 | - 'vehicle_reg_country_id' => '223', |
|
30 | - 'vehicle_make' => 'Ford', |
|
31 | - 'vehicle_axle_count' => 3, |
|
32 | - 'mpg_city' => 11, |
|
33 | - 'mpg_highway' => 17, |
|
34 | - 'fuel_type' => 'unleaded 93', |
|
35 | - 'height_inches' => 74, |
|
36 | - 'weight_lb' => 2098 |
|
26 | + 'vehicle_id' => $randomVehicleID, |
|
27 | + 'vehicle_model_year' => 2013, |
|
28 | + 'vehicle_year_acquired' => 2016, |
|
29 | + 'vehicle_reg_country_id' => '223', |
|
30 | + 'vehicle_make' => 'Ford', |
|
31 | + 'vehicle_axle_count' => 3, |
|
32 | + 'mpg_city' => 11, |
|
33 | + 'mpg_highway' => 17, |
|
34 | + 'fuel_type' => 'unleaded 93', |
|
35 | + 'height_inches' => 74, |
|
36 | + 'weight_lb' => 2098 |
|
37 | 37 | )); |
38 | 38 | |
39 | 39 | $result = $vehicle->updateVehicle($vehicleParameters); |