@@ -10,24 +10,24 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class ScheduleCalendarResponse extends Common |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * The address book contact quantity by dates |
|
| 15 | - * (dates are in the string format, e.g. 2020-10-18). |
|
| 16 | - * @var array |
|
| 17 | - */ |
|
| 18 | - public $address_book = []; |
|
| 13 | + /** |
|
| 14 | + * The address book contact quantity by dates |
|
| 15 | + * (dates are in the string format, e.g. 2020-10-18). |
|
| 16 | + * @var array |
|
| 17 | + */ |
|
| 18 | + public $address_book = []; |
|
| 19 | 19 | |
| 20 | - /* |
|
| 20 | + /* |
|
| 21 | 21 | * The order quantity by dates |
| 22 | 22 | * (dates are in the string format, e.g. 2020-10-18). |
| 23 | 23 | * @var array |
| 24 | 24 | */ |
| 25 | - public $orders = []; |
|
| 25 | + public $orders = []; |
|
| 26 | 26 | |
| 27 | - /* |
|
| 27 | + /* |
|
| 28 | 28 | * The order quantity by dates |
| 29 | 29 | * (dates are in the string format, e.g. 2020-10-18). |
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - public $routes_count = []; |
|
| 32 | + public $routes_count = []; |
|
| 33 | 33 | } |
@@ -6,317 +6,317 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Order extends Common |
| 8 | 8 | { |
| 9 | - public $address_1; |
|
| 10 | - public $address_2; |
|
| 11 | - public $cached_lat; |
|
| 12 | - public $cached_lng; |
|
| 13 | - public $curbside_lat; |
|
| 14 | - public $curbside_lng; |
|
| 15 | - public $address_alias; |
|
| 16 | - public $address_city; |
|
| 17 | - public $EXT_FIELD_first_name; |
|
| 18 | - public $EXT_FIELD_last_name; |
|
| 19 | - public $EXT_FIELD_email; |
|
| 20 | - public $EXT_FIELD_phone; |
|
| 21 | - public $EXT_FIELD_custom_data; |
|
| 22 | - |
|
| 23 | - public $color; |
|
| 24 | - public $order_icon; |
|
| 25 | - public $local_time_window_start; |
|
| 26 | - public $local_time_window_end; |
|
| 27 | - public $local_time_window_start_2; |
|
| 28 | - public $local_time_window_end_2; |
|
| 29 | - public $service_time; |
|
| 30 | - |
|
| 31 | - public $day_scheduled_for_YYMMDD; |
|
| 32 | - |
|
| 33 | - public $route_id; |
|
| 34 | - public $redirect; |
|
| 35 | - public $optimization_problem_id; |
|
| 36 | - public $order_id; |
|
| 37 | - public $order_ids; |
|
| 38 | - |
|
| 39 | - public $day_added_YYMMDD; |
|
| 40 | - public $scheduled_for_YYMMDD; |
|
| 41 | - public $fields; |
|
| 42 | - public $offset; |
|
| 43 | - public $limit; |
|
| 44 | - public $query; |
|
| 45 | - |
|
| 46 | - public $created_timestamp; |
|
| 47 | - public $order_status_id; |
|
| 48 | - public $member_id; |
|
| 49 | - public $address_state_id; |
|
| 50 | - public $address_country_id; |
|
| 51 | - public $address_zip; |
|
| 52 | - public $in_route_count; |
|
| 53 | - public $last_visited_timestamp; |
|
| 54 | - public $last_routed_timestamp; |
|
| 55 | - public $local_timezone_string; |
|
| 56 | - public $is_validated; |
|
| 57 | - public $is_pending; |
|
| 58 | - public $is_accepted; |
|
| 59 | - public $is_started; |
|
| 60 | - public $is_completed; |
|
| 61 | - public $custom_user_fields; |
|
| 62 | - |
|
| 63 | - public $addresses = []; |
|
| 64 | - |
|
| 65 | - public function __construct() |
|
| 66 | - { |
|
| 67 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @param Order $params |
|
| 72 | - */ |
|
| 73 | - public static function addOrder($params) |
|
| 74 | - { |
|
| 75 | - $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', |
|
| 76 | - 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', ]; |
|
| 77 | - |
|
| 78 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 79 | - |
|
| 80 | - $response = Route4Me::makeRequst([ |
|
| 81 | - 'url' => Endpoint::ORDER_V4, |
|
| 82 | - 'method' => 'POST', |
|
| 83 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 84 | - ]); |
|
| 85 | - |
|
| 86 | - return $response; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public static function addOrder2Route($params) |
|
| 90 | - { |
|
| 91 | - $allQueryFields = ['route_id', 'redirect']; |
|
| 92 | - $allBodyFields = ['addresses']; |
|
| 93 | - |
|
| 94 | - $response = Route4Me::makeRequst([ |
|
| 95 | - 'url' => Endpoint::ROUTE_V4, |
|
| 96 | - 'method' => 'PUT', |
|
| 97 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 98 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 99 | - ]); |
|
| 100 | - |
|
| 101 | - return $response; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - public static function addOrder2Optimization($params) |
|
| 105 | - { |
|
| 106 | - $allQueryFields = ['optimization_problem_id', 'redirect', 'device_type']; |
|
| 107 | - $allBodyFields = ['addresses']; |
|
| 108 | - |
|
| 109 | - $response = Route4Me::makeRequst([ |
|
| 110 | - 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 111 | - 'method' => 'PUT', |
|
| 112 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 113 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 114 | - ]); |
|
| 115 | - |
|
| 116 | - return $response; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - public static function getOrder($params) |
|
| 120 | - { |
|
| 121 | - $allQueryFields = ['order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit']; |
|
| 122 | - |
|
| 123 | - $response = Route4Me::makeRequst([ |
|
| 124 | - 'url' => Endpoint::ORDER_V4, |
|
| 125 | - 'method' => 'GET', |
|
| 126 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 127 | - ]); |
|
| 128 | - |
|
| 129 | - return $response; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - public static function getOrders($params) |
|
| 133 | - { |
|
| 134 | - $allQueryFields = ['offset', 'limit']; |
|
| 135 | - |
|
| 136 | - $response = Route4Me::makeRequst([ |
|
| 137 | - 'url' => Endpoint::ORDER_V4, |
|
| 138 | - 'method' => 'GET', |
|
| 139 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 140 | - ]); |
|
| 141 | - |
|
| 142 | - return $response; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - public function getRandomOrderId($offset, $limit) |
|
| 146 | - { |
|
| 147 | - $randomOrder = $this->getRandomOrder($offset, $limit); |
|
| 148 | - |
|
| 149 | - if (is_null($randomOrder) || !isset($randomOrder)) { |
|
| 150 | - return null; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - return $randomOrder['order_id']; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - public function getRandomOrder($offset, $limit) |
|
| 157 | - { |
|
| 158 | - $params = ['offset' => $offset, 'limit' => $limit]; |
|
| 159 | - |
|
| 160 | - $orders = self::getOrders($params); |
|
| 161 | - |
|
| 162 | - if (is_null($orders) || !isset($orders['results'])) { |
|
| 163 | - return null; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - $randomIndex = rand(0, sizeof($orders['results']) - 1); |
|
| 167 | - |
|
| 168 | - $order = $orders['results'][$randomIndex]; |
|
| 169 | - |
|
| 170 | - return $order; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - public static function removeOrder($params) |
|
| 174 | - { |
|
| 175 | - $allBodyFields = ['order_ids']; |
|
| 176 | - |
|
| 177 | - $response = Route4Me::makeRequst([ |
|
| 178 | - 'url' => Endpoint::ORDER_V4, |
|
| 179 | - 'method' => 'DELETE', |
|
| 180 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 181 | - ]); |
|
| 182 | - |
|
| 183 | - return $response; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - public static function updateOrder($params) |
|
| 187 | - { |
|
| 188 | - $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', |
|
| 189 | - 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', ]; |
|
| 190 | - |
|
| 191 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 192 | - |
|
| 193 | - $response = Route4Me::makeRequst([ |
|
| 194 | - 'url' => Endpoint::ORDER_V4, |
|
| 195 | - 'method' => 'PUT', |
|
| 196 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 197 | - ]); |
|
| 198 | - |
|
| 199 | - return $response; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - public static function searchOrder($params) |
|
| 203 | - { |
|
| 204 | - $allQueryFields = ['fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit']; |
|
| 205 | - |
|
| 206 | - $response = Route4Me::makeRequst([ |
|
| 207 | - 'url' => Endpoint::ORDER_V4, |
|
| 208 | - 'method' => 'GET', |
|
| 209 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 210 | - ]); |
|
| 211 | - |
|
| 212 | - return $response; |
|
| 213 | - } |
|
| 9 | + public $address_1; |
|
| 10 | + public $address_2; |
|
| 11 | + public $cached_lat; |
|
| 12 | + public $cached_lng; |
|
| 13 | + public $curbside_lat; |
|
| 14 | + public $curbside_lng; |
|
| 15 | + public $address_alias; |
|
| 16 | + public $address_city; |
|
| 17 | + public $EXT_FIELD_first_name; |
|
| 18 | + public $EXT_FIELD_last_name; |
|
| 19 | + public $EXT_FIELD_email; |
|
| 20 | + public $EXT_FIELD_phone; |
|
| 21 | + public $EXT_FIELD_custom_data; |
|
| 22 | + |
|
| 23 | + public $color; |
|
| 24 | + public $order_icon; |
|
| 25 | + public $local_time_window_start; |
|
| 26 | + public $local_time_window_end; |
|
| 27 | + public $local_time_window_start_2; |
|
| 28 | + public $local_time_window_end_2; |
|
| 29 | + public $service_time; |
|
| 30 | + |
|
| 31 | + public $day_scheduled_for_YYMMDD; |
|
| 32 | + |
|
| 33 | + public $route_id; |
|
| 34 | + public $redirect; |
|
| 35 | + public $optimization_problem_id; |
|
| 36 | + public $order_id; |
|
| 37 | + public $order_ids; |
|
| 38 | + |
|
| 39 | + public $day_added_YYMMDD; |
|
| 40 | + public $scheduled_for_YYMMDD; |
|
| 41 | + public $fields; |
|
| 42 | + public $offset; |
|
| 43 | + public $limit; |
|
| 44 | + public $query; |
|
| 45 | + |
|
| 46 | + public $created_timestamp; |
|
| 47 | + public $order_status_id; |
|
| 48 | + public $member_id; |
|
| 49 | + public $address_state_id; |
|
| 50 | + public $address_country_id; |
|
| 51 | + public $address_zip; |
|
| 52 | + public $in_route_count; |
|
| 53 | + public $last_visited_timestamp; |
|
| 54 | + public $last_routed_timestamp; |
|
| 55 | + public $local_timezone_string; |
|
| 56 | + public $is_validated; |
|
| 57 | + public $is_pending; |
|
| 58 | + public $is_accepted; |
|
| 59 | + public $is_started; |
|
| 60 | + public $is_completed; |
|
| 61 | + public $custom_user_fields; |
|
| 62 | + |
|
| 63 | + public $addresses = []; |
|
| 64 | + |
|
| 65 | + public function __construct() |
|
| 66 | + { |
|
| 67 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @param Order $params |
|
| 72 | + */ |
|
| 73 | + public static function addOrder($params) |
|
| 74 | + { |
|
| 75 | + $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', |
|
| 76 | + 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', ]; |
|
| 77 | + |
|
| 78 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 79 | + |
|
| 80 | + $response = Route4Me::makeRequst([ |
|
| 81 | + 'url' => Endpoint::ORDER_V4, |
|
| 82 | + 'method' => 'POST', |
|
| 83 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 84 | + ]); |
|
| 85 | + |
|
| 86 | + return $response; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + public static function addOrder2Route($params) |
|
| 90 | + { |
|
| 91 | + $allQueryFields = ['route_id', 'redirect']; |
|
| 92 | + $allBodyFields = ['addresses']; |
|
| 93 | + |
|
| 94 | + $response = Route4Me::makeRequst([ |
|
| 95 | + 'url' => Endpoint::ROUTE_V4, |
|
| 96 | + 'method' => 'PUT', |
|
| 97 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 98 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 99 | + ]); |
|
| 100 | + |
|
| 101 | + return $response; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + public static function addOrder2Optimization($params) |
|
| 105 | + { |
|
| 106 | + $allQueryFields = ['optimization_problem_id', 'redirect', 'device_type']; |
|
| 107 | + $allBodyFields = ['addresses']; |
|
| 108 | + |
|
| 109 | + $response = Route4Me::makeRequst([ |
|
| 110 | + 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 111 | + 'method' => 'PUT', |
|
| 112 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 113 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 114 | + ]); |
|
| 115 | + |
|
| 116 | + return $response; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + public static function getOrder($params) |
|
| 120 | + { |
|
| 121 | + $allQueryFields = ['order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit']; |
|
| 122 | + |
|
| 123 | + $response = Route4Me::makeRequst([ |
|
| 124 | + 'url' => Endpoint::ORDER_V4, |
|
| 125 | + 'method' => 'GET', |
|
| 126 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 127 | + ]); |
|
| 128 | + |
|
| 129 | + return $response; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + public static function getOrders($params) |
|
| 133 | + { |
|
| 134 | + $allQueryFields = ['offset', 'limit']; |
|
| 135 | + |
|
| 136 | + $response = Route4Me::makeRequst([ |
|
| 137 | + 'url' => Endpoint::ORDER_V4, |
|
| 138 | + 'method' => 'GET', |
|
| 139 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 140 | + ]); |
|
| 141 | + |
|
| 142 | + return $response; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + public function getRandomOrderId($offset, $limit) |
|
| 146 | + { |
|
| 147 | + $randomOrder = $this->getRandomOrder($offset, $limit); |
|
| 148 | + |
|
| 149 | + if (is_null($randomOrder) || !isset($randomOrder)) { |
|
| 150 | + return null; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + return $randomOrder['order_id']; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + public function getRandomOrder($offset, $limit) |
|
| 157 | + { |
|
| 158 | + $params = ['offset' => $offset, 'limit' => $limit]; |
|
| 159 | + |
|
| 160 | + $orders = self::getOrders($params); |
|
| 161 | + |
|
| 162 | + if (is_null($orders) || !isset($orders['results'])) { |
|
| 163 | + return null; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + $randomIndex = rand(0, sizeof($orders['results']) - 1); |
|
| 167 | + |
|
| 168 | + $order = $orders['results'][$randomIndex]; |
|
| 169 | + |
|
| 170 | + return $order; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + public static function removeOrder($params) |
|
| 174 | + { |
|
| 175 | + $allBodyFields = ['order_ids']; |
|
| 176 | + |
|
| 177 | + $response = Route4Me::makeRequst([ |
|
| 178 | + 'url' => Endpoint::ORDER_V4, |
|
| 179 | + 'method' => 'DELETE', |
|
| 180 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 181 | + ]); |
|
| 182 | + |
|
| 183 | + return $response; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + public static function updateOrder($params) |
|
| 187 | + { |
|
| 188 | + $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', |
|
| 189 | + 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', ]; |
|
| 190 | + |
|
| 191 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 192 | + |
|
| 193 | + $response = Route4Me::makeRequst([ |
|
| 194 | + 'url' => Endpoint::ORDER_V4, |
|
| 195 | + 'method' => 'PUT', |
|
| 196 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 197 | + ]); |
|
| 198 | + |
|
| 199 | + return $response; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + public static function searchOrder($params) |
|
| 203 | + { |
|
| 204 | + $allQueryFields = ['fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit']; |
|
| 205 | + |
|
| 206 | + $response = Route4Me::makeRequst([ |
|
| 207 | + 'url' => Endpoint::ORDER_V4, |
|
| 208 | + 'method' => 'GET', |
|
| 209 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 210 | + ]); |
|
| 211 | + |
|
| 212 | + return $response; |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - public static function validateCoordinate($coord) |
|
| 216 | - { |
|
| 217 | - $key = key($coord); |
|
| 215 | + public static function validateCoordinate($coord) |
|
| 216 | + { |
|
| 217 | + $key = key($coord); |
|
| 218 | 218 | |
| 219 | - if (!is_numeric($coord[$key])) { |
|
| 220 | - return false; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - switch ($key) { |
|
| 224 | - case 'cached_lat': |
|
| 225 | - case 'curbside_lat': |
|
| 226 | - if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - break; |
|
| 230 | - case 'cached_lng': |
|
| 231 | - case 'curbside_lng': |
|
| 232 | - if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 233 | - return false; |
|
| 234 | - } |
|
| 235 | - break; |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - return true; |
|
| 239 | - } |
|
| 219 | + if (!is_numeric($coord[$key])) { |
|
| 220 | + return false; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + switch ($key) { |
|
| 224 | + case 'cached_lat': |
|
| 225 | + case 'curbside_lat': |
|
| 226 | + if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + break; |
|
| 230 | + case 'cached_lng': |
|
| 231 | + case 'curbside_lng': |
|
| 232 | + if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 233 | + return false; |
|
| 234 | + } |
|
| 235 | + break; |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + return true; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
|
| 242 | - { |
|
| 243 | - $max_line_length = 512; |
|
| 244 | - $delemietr = ','; |
|
| 245 | - |
|
| 246 | - $results = []; |
|
| 247 | - $results['fail'] = []; |
|
| 248 | - $results['success'] = []; |
|
| 249 | - |
|
| 250 | - $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
| 241 | + public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
|
| 242 | + { |
|
| 243 | + $max_line_length = 512; |
|
| 244 | + $delemietr = ','; |
|
| 245 | + |
|
| 246 | + $results = []; |
|
| 247 | + $results['fail'] = []; |
|
| 248 | + $results['success'] = []; |
|
| 249 | + |
|
| 250 | + $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
| 251 | 251 | |
| 252 | - $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', |
|
| 253 | - 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', ]; |
|
| 254 | - |
|
| 255 | - $allOrderFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 256 | - |
|
| 257 | - if (!empty($columns)) { |
|
| 258 | - array_push($results['fail'], 'Empty CSV table'); |
|
| 252 | + $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', |
|
| 253 | + 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', ]; |
|
| 254 | + |
|
| 255 | + $allOrderFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 256 | + |
|
| 257 | + if (!empty($columns)) { |
|
| 258 | + array_push($results['fail'], 'Empty CSV table'); |
|
| 259 | 259 | |
| 260 | - return $results; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - $iRow = 1; |
|
| 264 | - |
|
| 265 | - while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 266 | - if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && [null] !== $rows) { |
|
| 267 | - $cached_lat = 0.000; |
|
| 268 | - $cached_lng = 0.000; |
|
| 269 | - |
|
| 270 | - foreach (['cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng'] as $coord) { |
|
| 271 | - if (!$this->validateCoordinate([$coord => $rows[$ordersFieldsMapping[$coord]]])) { |
|
| 272 | - array_push($results['fail'], "$iRow --> Wrong " + $coord); |
|
| 273 | - ++$iRow; |
|
| 274 | - continue; |
|
| 275 | - } else { |
|
| 276 | - switch ($coord) { |
|
| 277 | - case 'cached_lat': |
|
| 278 | - $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 279 | - break; |
|
| 280 | - case 'cached_lng': |
|
| 281 | - $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 282 | - break; |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - $address = $rows[$ordersFieldsMapping['address_1']]; |
|
| 288 | - |
|
| 289 | - foreach (['order_city', 'order_state_id', 'order_zip_code', 'order_country_id'] as $addressPart) { |
|
| 290 | - if (isset($ordersFieldsMapping[$addressPart])) { |
|
| 291 | - $address .= ', '.$rows[$ordersFieldsMapping[$addressPart]]; |
|
| 292 | - } |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].', '.$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']].'<br>'; |
|
| 296 | - |
|
| 297 | - $parametersArray = []; |
|
| 298 | - |
|
| 299 | - $parametersArray['cached_lat'] = $cached_lat; |
|
| 300 | - $parametersArray['cached_lng'] = $cached_lng; |
|
| 301 | - |
|
| 302 | - foreach ($allOrderFields as $orderField) { |
|
| 303 | - if (isset($ordersFieldsMapping[$orderField])) { |
|
| 304 | - $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]]; |
|
| 305 | - } |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - $orderParameters = self::fromArray($parametersArray); |
|
| 309 | - |
|
| 310 | - $order = new self(); |
|
| 311 | - |
|
| 312 | - $orderResults = $order->addOrder($orderParameters); |
|
| 313 | - |
|
| 314 | - array_push($results['success'], 'The order with order_id = '.strval($orderResults['order_id']).' added successfuly.'); |
|
| 315 | - } else { |
|
| 316 | - array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - ++$iRow; |
|
| 320 | - } |
|
| 321 | - } |
|
| 260 | + return $results; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + $iRow = 1; |
|
| 264 | + |
|
| 265 | + while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 266 | + if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && [null] !== $rows) { |
|
| 267 | + $cached_lat = 0.000; |
|
| 268 | + $cached_lng = 0.000; |
|
| 269 | + |
|
| 270 | + foreach (['cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng'] as $coord) { |
|
| 271 | + if (!$this->validateCoordinate([$coord => $rows[$ordersFieldsMapping[$coord]]])) { |
|
| 272 | + array_push($results['fail'], "$iRow --> Wrong " + $coord); |
|
| 273 | + ++$iRow; |
|
| 274 | + continue; |
|
| 275 | + } else { |
|
| 276 | + switch ($coord) { |
|
| 277 | + case 'cached_lat': |
|
| 278 | + $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 279 | + break; |
|
| 280 | + case 'cached_lng': |
|
| 281 | + $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 282 | + break; |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + $address = $rows[$ordersFieldsMapping['address_1']]; |
|
| 288 | + |
|
| 289 | + foreach (['order_city', 'order_state_id', 'order_zip_code', 'order_country_id'] as $addressPart) { |
|
| 290 | + if (isset($ordersFieldsMapping[$addressPart])) { |
|
| 291 | + $address .= ', '.$rows[$ordersFieldsMapping[$addressPart]]; |
|
| 292 | + } |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].', '.$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']].'<br>'; |
|
| 296 | + |
|
| 297 | + $parametersArray = []; |
|
| 298 | + |
|
| 299 | + $parametersArray['cached_lat'] = $cached_lat; |
|
| 300 | + $parametersArray['cached_lng'] = $cached_lng; |
|
| 301 | + |
|
| 302 | + foreach ($allOrderFields as $orderField) { |
|
| 303 | + if (isset($ordersFieldsMapping[$orderField])) { |
|
| 304 | + $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]]; |
|
| 305 | + } |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + $orderParameters = self::fromArray($parametersArray); |
|
| 309 | + |
|
| 310 | + $order = new self(); |
|
| 311 | + |
|
| 312 | + $orderResults = $order->addOrder($orderParameters); |
|
| 313 | + |
|
| 314 | + array_push($results['success'], 'The order with order_id = '.strval($orderResults['order_id']).' added successfuly.'); |
|
| 315 | + } else { |
|
| 316 | + array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + ++$iRow; |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | 322 | } |
@@ -221,18 +221,18 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | switch ($key) { |
| 224 | - case 'cached_lat': |
|
| 225 | - case 'curbside_lat': |
|
| 226 | - if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - break; |
|
| 230 | - case 'cached_lng': |
|
| 231 | - case 'curbside_lng': |
|
| 232 | - if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 233 | - return false; |
|
| 234 | - } |
|
| 235 | - break; |
|
| 224 | + case 'cached_lat': |
|
| 225 | + case 'curbside_lat': |
|
| 226 | + if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + break; |
|
| 230 | + case 'cached_lng': |
|
| 231 | + case 'curbside_lng': |
|
| 232 | + if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 233 | + return false; |
|
| 234 | + } |
|
| 235 | + break; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return true; |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | continue; |
| 275 | 275 | } else { |
| 276 | 276 | switch ($coord) { |
| 277 | - case 'cached_lat': |
|
| 278 | - $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 279 | - break; |
|
| 280 | - case 'cached_lng': |
|
| 281 | - $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 282 | - break; |
|
| 277 | + case 'cached_lat': |
|
| 278 | + $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 279 | + break; |
|
| 280 | + case 'cached_lng': |
|
| 281 | + $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 282 | + break; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | switch ($key) { |
| 224 | 224 | case 'cached_lat': |
| 225 | 225 | case 'curbside_lat': |
| 226 | - if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 226 | + if ($coord[$key]>90 || $coord[$key]<-90) { |
|
| 227 | 227 | return false; |
| 228 | 228 | } |
| 229 | 229 | break; |
| 230 | 230 | case 'cached_lng': |
| 231 | 231 | case 'curbside_lng': |
| 232 | - if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 232 | + if ($coord[$key]>180 || $coord[$key]<-180) { |
|
| 233 | 233 | return false; |
| 234 | 234 | } |
| 235 | 235 | break; |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | $iRow = 1; |
| 264 | 264 | |
| 265 | - while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 266 | - if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && [null] !== $rows) { |
|
| 265 | + while (false!==($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 266 | + if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && [null]!==$rows) { |
|
| 267 | 267 | $cached_lat = 0.000; |
| 268 | 268 | $cached_lng = 0.000; |
| 269 | 269 | |
| 270 | 270 | foreach (['cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng'] as $coord) { |
| 271 | 271 | if (!$this->validateCoordinate([$coord => $rows[$ordersFieldsMapping[$coord]]])) { |
| 272 | - array_push($results['fail'], "$iRow --> Wrong " + $coord); |
|
| 272 | + array_push($results['fail'], "$iRow --> Wrong " +$coord); |
|
| 273 | 273 | ++$iRow; |
| 274 | 274 | continue; |
| 275 | 275 | } else { |
@@ -7,29 +7,29 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class TelematicsRegisterMemberResponse extends \Route4Me\Common |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * API token |
|
| 12 | - * Use for the operations: |
|
| 13 | - * Get Telematics Connections, Register Telematics Connection |
|
| 14 | - * @var type string |
|
| 15 | - */ |
|
| 16 | - public $api_token; |
|
| 10 | + /** |
|
| 11 | + * API token |
|
| 12 | + * Use for the operations: |
|
| 13 | + * Get Telematics Connections, Register Telematics Connection |
|
| 14 | + * @var type string |
|
| 15 | + */ |
|
| 16 | + public $api_token; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * When the registered member updated |
|
| 20 | - * @var type string |
|
| 21 | - */ |
|
| 22 | - public $updated_at; |
|
| 18 | + /** |
|
| 19 | + * When the registered member updated |
|
| 20 | + * @var type string |
|
| 21 | + */ |
|
| 22 | + public $updated_at; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * When the registered member created |
|
| 26 | - * @var type |
|
| 27 | - */ |
|
| 28 | - public $created_at; |
|
| 24 | + /** |
|
| 25 | + * When the registered member created |
|
| 26 | + * @var type |
|
| 27 | + */ |
|
| 28 | + public $created_at; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Telemetics member ID |
|
| 32 | - * @var type |
|
| 33 | - */ |
|
| 34 | - public $id; |
|
| 30 | + /** |
|
| 31 | + * Telemetics member ID |
|
| 32 | + * @var type |
|
| 33 | + */ |
|
| 34 | + public $id; |
|
| 35 | 35 | } |
@@ -7,99 +7,99 @@ |
||
| 7 | 7 | |
| 8 | 8 | class CreateConnectionResponse extends Common |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Telematics connection access account_id |
|
| 12 | - * @var string |
|
| 13 | - */ |
|
| 14 | - public $account_id; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * Telematics connection access api_key |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - public $api_key; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Telematics connection access token |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 26 | - public $connection_token; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * When the connection created |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 32 | - public $created_at; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Telemetics connection ID |
|
| 36 | - * @var integer |
|
| 37 | - */ |
|
| 38 | - public $id; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Metadata, custom key-value storage. |
|
| 42 | - * @var array |
|
| 43 | - */ |
|
| 44 | - public $metadata; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Telemetics connection name |
|
| 48 | - * @var string |
|
| 49 | - */ |
|
| 50 | - public $name; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Telematics connection access password |
|
| 54 | - * @var string |
|
| 55 | - */ |
|
| 56 | - public $password; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Synchronized vehicles number |
|
| 60 | - * @var integer |
|
| 61 | - */ |
|
| 62 | - public $synced_vehicles_count; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Total vehicles number |
|
| 66 | - * @var integer |
|
| 67 | - */ |
|
| 68 | - public $total_vehicles_count; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * When the connection updated |
|
| 72 | - * @var string |
|
| 73 | - */ |
|
| 74 | - public $updated_at; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Connection user ID |
|
| 78 | - * @var integer |
|
| 79 | - */ |
|
| 80 | - public $user_id; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Telematics connection access username |
|
| 84 | - * @var string |
|
| 85 | - */ |
|
| 86 | - public $username; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Vehicle tracking interval in seconds. |
|
| 90 | - * @var integer |
|
| 91 | - */ |
|
| 92 | - public $vehicle_position_refresh_rate; |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Telemetics connection vendor |
|
| 96 | - * @var string |
|
| 97 | - */ |
|
| 98 | - public $vendor ; |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Telemetics connection type ID |
|
| 102 | - * @var integer |
|
| 103 | - */ |
|
| 104 | - public $vendor_id ; |
|
| 10 | + /** |
|
| 11 | + * Telematics connection access account_id |
|
| 12 | + * @var string |
|
| 13 | + */ |
|
| 14 | + public $account_id; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * Telematics connection access api_key |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + public $api_key; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Telematics connection access token |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | + public $connection_token; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * When the connection created |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | + public $created_at; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Telemetics connection ID |
|
| 36 | + * @var integer |
|
| 37 | + */ |
|
| 38 | + public $id; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Metadata, custom key-value storage. |
|
| 42 | + * @var array |
|
| 43 | + */ |
|
| 44 | + public $metadata; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Telemetics connection name |
|
| 48 | + * @var string |
|
| 49 | + */ |
|
| 50 | + public $name; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Telematics connection access password |
|
| 54 | + * @var string |
|
| 55 | + */ |
|
| 56 | + public $password; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Synchronized vehicles number |
|
| 60 | + * @var integer |
|
| 61 | + */ |
|
| 62 | + public $synced_vehicles_count; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Total vehicles number |
|
| 66 | + * @var integer |
|
| 67 | + */ |
|
| 68 | + public $total_vehicles_count; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * When the connection updated |
|
| 72 | + * @var string |
|
| 73 | + */ |
|
| 74 | + public $updated_at; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Connection user ID |
|
| 78 | + * @var integer |
|
| 79 | + */ |
|
| 80 | + public $user_id; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Telematics connection access username |
|
| 84 | + * @var string |
|
| 85 | + */ |
|
| 86 | + public $username; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Vehicle tracking interval in seconds. |
|
| 90 | + * @var integer |
|
| 91 | + */ |
|
| 92 | + public $vehicle_position_refresh_rate; |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Telemetics connection vendor |
|
| 96 | + * @var string |
|
| 97 | + */ |
|
| 98 | + public $vendor ; |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Telemetics connection type ID |
|
| 102 | + * @var integer |
|
| 103 | + */ |
|
| 104 | + public $vendor_id ; |
|
| 105 | 105 | } |
@@ -95,11 +95,11 @@ |
||
| 95 | 95 | * Telemetics connection vendor |
| 96 | 96 | * @var string |
| 97 | 97 | */ |
| 98 | - public $vendor ; |
|
| 98 | + public $vendor; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Telemetics connection type ID |
| 102 | 102 | * @var integer |
| 103 | 103 | */ |
| 104 | - public $vendor_id ; |
|
| 104 | + public $vendor_id; |
|
| 105 | 105 | } |
@@ -11,266 +11,266 @@ |
||
| 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 | - /** |
|
| 160 | - * Create a telematics connection. |
|
| 161 | - * @param $apiToken string : API token |
|
| 162 | - * @param $params TelematicsConnectionParameters : Telematics connection parameters |
|
| 163 | - * @return array Array from a TelematicsConnection type object |
|
| 164 | - * @throws \Route4Me\Exception\ApiError |
|
| 165 | - */ |
|
| 166 | - public function createTelematicsConnection($apiToken, $params) |
|
| 167 | - { |
|
| 168 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 159 | + /** |
|
| 160 | + * Create a telematics connection. |
|
| 161 | + * @param $apiToken string : API token |
|
| 162 | + * @param $params TelematicsConnectionParameters : Telematics connection parameters |
|
| 163 | + * @return array Array from a TelematicsConnection type object |
|
| 164 | + * @throws \Route4Me\Exception\ApiError |
|
| 165 | + */ |
|
| 166 | + public function createTelematicsConnection($apiToken, $params) |
|
| 167 | + { |
|
| 168 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 169 | 169 | |
| 170 | - $excludeFields = ['id', 'connection_token']; |
|
| 170 | + $excludeFields = ['id', 'connection_token']; |
|
| 171 | 171 | |
| 172 | - $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 172 | + $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 173 | 173 | |
| 174 | - $result = Route4Me::makeRequst([ |
|
| 175 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 176 | - 'method' => 'POST', |
|
| 177 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 178 | - 'query' => ['api_token' => $apiToken], |
|
| 179 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 180 | - ]); |
|
| 174 | + $result = Route4Me::makeRequst([ |
|
| 175 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 176 | + 'method' => 'POST', |
|
| 177 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 178 | + 'query' => ['api_token' => $apiToken], |
|
| 179 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 180 | + ]); |
|
| 181 | 181 | |
| 182 | - return $result; |
|
| 183 | - } |
|
| 182 | + return $result; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - /** |
|
| 186 | - * Delete a telematics connection. |
|
| 187 | - * @param $apiToken string : API token |
|
| 188 | - * @param $connectionToken string : connection token |
|
| 189 | - * @return array Array from a TelematicsConnection type object |
|
| 190 | - * @throws \Route4Me\Exception\ApiError |
|
| 191 | - */ |
|
| 192 | - public function deleteTelematicsConnection($apiToken, $connectionToken) |
|
| 193 | - { |
|
| 194 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 185 | + /** |
|
| 186 | + * Delete a telematics connection. |
|
| 187 | + * @param $apiToken string : API token |
|
| 188 | + * @param $connectionToken string : connection token |
|
| 189 | + * @return array Array from a TelematicsConnection type object |
|
| 190 | + * @throws \Route4Me\Exception\ApiError |
|
| 191 | + */ |
|
| 192 | + public function deleteTelematicsConnection($apiToken, $connectionToken) |
|
| 193 | + { |
|
| 194 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 195 | 195 | |
| 196 | - $result = Route4Me::makeRequst([ |
|
| 197 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 198 | - 'method' => 'DELETE', |
|
| 199 | - 'query' => [ |
|
| 200 | - 'api_token' => $apiToken, |
|
| 201 | - 'connection_token' => $connectionToken |
|
| 202 | - ], |
|
| 203 | - ]); |
|
| 196 | + $result = Route4Me::makeRequst([ |
|
| 197 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 198 | + 'method' => 'DELETE', |
|
| 199 | + 'query' => [ |
|
| 200 | + 'api_token' => $apiToken, |
|
| 201 | + 'connection_token' => $connectionToken |
|
| 202 | + ], |
|
| 203 | + ]); |
|
| 204 | 204 | |
| 205 | - return $result; |
|
| 206 | - } |
|
| 205 | + return $result; |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Get all telematics connections. |
|
| 210 | - * @param $apiToken string : API token |
|
| 211 | - * @return array Array of the TelematicsConnection type objects |
|
| 212 | - * @throws \Route4Me\Exception\ApiError |
|
| 213 | - */ |
|
| 214 | - public function getTelematicsConnections($apiToken) |
|
| 215 | - { |
|
| 216 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 208 | + /** |
|
| 209 | + * Get all telematics connections. |
|
| 210 | + * @param $apiToken string : API token |
|
| 211 | + * @return array Array of the TelematicsConnection type objects |
|
| 212 | + * @throws \Route4Me\Exception\ApiError |
|
| 213 | + */ |
|
| 214 | + public function getTelematicsConnections($apiToken) |
|
| 215 | + { |
|
| 216 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 217 | 217 | |
| 218 | - $result = Route4Me::makeRequst([ |
|
| 219 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 220 | - 'method' => 'GET', |
|
| 221 | - 'query' => [ |
|
| 222 | - 'api_token' => $apiToken |
|
| 223 | - ], |
|
| 224 | - ]); |
|
| 218 | + $result = Route4Me::makeRequst([ |
|
| 219 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 220 | + 'method' => 'GET', |
|
| 221 | + 'query' => [ |
|
| 222 | + 'api_token' => $apiToken |
|
| 223 | + ], |
|
| 224 | + ]); |
|
| 225 | 225 | |
| 226 | - return $result; |
|
| 227 | - } |
|
| 226 | + return $result; |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * Get a telematics connection |
|
| 231 | - * @param $apiToken string : API token |
|
| 232 | - * @param $connectionToken string : connection token |
|
| 233 | - * @return array Array from a TelematicsConnection type object |
|
| 234 | - * @throws \Route4Me\Exception\ApiError |
|
| 235 | - */ |
|
| 236 | - public function getTelematicsConnection($apiToken, $connectionToken) |
|
| 237 | - { |
|
| 238 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 229 | + /** |
|
| 230 | + * Get a telematics connection |
|
| 231 | + * @param $apiToken string : API token |
|
| 232 | + * @param $connectionToken string : connection token |
|
| 233 | + * @return array Array from a TelematicsConnection type object |
|
| 234 | + * @throws \Route4Me\Exception\ApiError |
|
| 235 | + */ |
|
| 236 | + public function getTelematicsConnection($apiToken, $connectionToken) |
|
| 237 | + { |
|
| 238 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 239 | 239 | |
| 240 | - $result = Route4Me::makeRequst([ |
|
| 241 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 242 | - 'method' => 'GET', |
|
| 243 | - 'query' => [ |
|
| 244 | - 'api_token' => $apiToken, |
|
| 245 | - 'connection_token' => $connectionToken |
|
| 246 | - ], |
|
| 247 | - ]); |
|
| 240 | + $result = Route4Me::makeRequst([ |
|
| 241 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 242 | + 'method' => 'GET', |
|
| 243 | + 'query' => [ |
|
| 244 | + 'api_token' => $apiToken, |
|
| 245 | + 'connection_token' => $connectionToken |
|
| 246 | + ], |
|
| 247 | + ]); |
|
| 248 | 248 | |
| 249 | - return $result; |
|
| 250 | - } |
|
| 249 | + return $result; |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Update telematics connection |
|
| 254 | - * @param $apiToken string : API token |
|
| 255 | - * @param $connectionToken string : connection token |
|
| 256 | - * @param $teleConParams TelematicsConnectionParameters : Telematics connection parameters |
|
| 257 | - * @return array Array from a TelematicsConnection type object |
|
| 258 | - * @throws \Route4Me\Exception\ApiError |
|
| 259 | - */ |
|
| 260 | - public function updateTelematicsConnection($apiToken, $connectionToken, $teleConParams) |
|
| 261 | - { |
|
| 262 | - $excludeFields = ['id', 'connection_token']; |
|
| 252 | + /** |
|
| 253 | + * Update telematics connection |
|
| 254 | + * @param $apiToken string : API token |
|
| 255 | + * @param $connectionToken string : connection token |
|
| 256 | + * @param $teleConParams TelematicsConnectionParameters : Telematics connection parameters |
|
| 257 | + * @return array Array from a TelematicsConnection type object |
|
| 258 | + * @throws \Route4Me\Exception\ApiError |
|
| 259 | + */ |
|
| 260 | + public function updateTelematicsConnection($apiToken, $connectionToken, $teleConParams) |
|
| 261 | + { |
|
| 262 | + $excludeFields = ['id', 'connection_token']; |
|
| 263 | 263 | |
| 264 | - $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 264 | + $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 265 | 265 | |
| 266 | - $result = Route4Me::makeRequst([ |
|
| 267 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 268 | - 'method' => 'PUT', |
|
| 269 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $teleConParams), |
|
| 270 | - 'query' => ['api_token' => $apiToken, 'connection_token' => $connectionToken], |
|
| 271 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 272 | - ]); |
|
| 266 | + $result = Route4Me::makeRequst([ |
|
| 267 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 268 | + 'method' => 'PUT', |
|
| 269 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $teleConParams), |
|
| 270 | + 'query' => ['api_token' => $apiToken, 'connection_token' => $connectionToken], |
|
| 271 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 272 | + ]); |
|
| 273 | 273 | |
| 274 | - return $result; |
|
| 275 | - } |
|
| 274 | + return $result; |
|
| 275 | + } |
|
| 276 | 276 | } |
@@ -11,59 +11,59 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class TelematicsVendors extends Common |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Unique ID of a telematics vendor. |
|
| 16 | - * @var type string |
|
| 17 | - */ |
|
| 18 | - public $id; |
|
| 14 | + /** |
|
| 15 | + * Unique ID of a telematics vendor. |
|
| 16 | + * @var type string |
|
| 17 | + */ |
|
| 18 | + public $id; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Vendor name |
|
| 22 | - * @var type string |
|
| 23 | - */ |
|
| 24 | - public $name; |
|
| 20 | + /** |
|
| 21 | + * Vendor name |
|
| 22 | + * @var type string |
|
| 23 | + */ |
|
| 24 | + public $name; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Vendor slug |
|
| 28 | - * @var type string |
|
| 29 | - */ |
|
| 30 | - public $slug; |
|
| 26 | + /** |
|
| 27 | + * Vendor slug |
|
| 28 | + * @var type string |
|
| 29 | + */ |
|
| 30 | + public $slug; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Vendor description |
|
| 34 | - * @var type string |
|
| 35 | - */ |
|
| 36 | - public $description; |
|
| 32 | + /** |
|
| 33 | + * Vendor description |
|
| 34 | + * @var type string |
|
| 35 | + */ |
|
| 36 | + public $description; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * URL to the telematics vendor's logo. |
|
| 40 | - * @var type string |
|
| 41 | - */ |
|
| 42 | - public $logo_url; |
|
| 38 | + /** |
|
| 39 | + * URL to the telematics vendor's logo. |
|
| 40 | + * @var type string |
|
| 41 | + */ |
|
| 42 | + public $logo_url; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Website URL of a telematics vendor. |
|
| 46 | - * @var type string |
|
| 47 | - */ |
|
| 48 | - public $website_url; |
|
| 44 | + /** |
|
| 45 | + * Website URL of a telematics vendor. |
|
| 46 | + * @var type string |
|
| 47 | + */ |
|
| 48 | + public $website_url; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * API URL of a telematics vendor. |
|
| 52 | - * @var type string |
|
| 53 | - */ |
|
| 54 | - public $api_docs_url; |
|
| 50 | + /** |
|
| 51 | + * API URL of a telematics vendor. |
|
| 52 | + * @var type string |
|
| 53 | + */ |
|
| 54 | + public $api_docs_url; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * If 1, the vendor is integrated in Route4Me |
|
| 58 | - * @var type string |
|
| 59 | - */ |
|
| 60 | - public $is_integrated; |
|
| 56 | + /** |
|
| 57 | + * If 1, the vendor is integrated in Route4Me |
|
| 58 | + * @var type string |
|
| 59 | + */ |
|
| 60 | + public $is_integrated; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Vendors size. |
|
| 64 | - * <para>Accepted values:</para> |
|
| 65 | - * <para>global, regional, local. </para> |
|
| 66 | - * @var type string |
|
| 67 | - */ |
|
| 68 | - public $size; |
|
| 62 | + /** |
|
| 63 | + * Vendors size. |
|
| 64 | + * <para>Accepted values:</para> |
|
| 65 | + * <para>global, regional, local. </para> |
|
| 66 | + * @var type string |
|
| 67 | + */ |
|
| 68 | + public $size; |
|
| 69 | 69 | } |
@@ -9,75 +9,75 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class TelematicsConnectionParameters extends Common |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Account ID |
|
| 14 | - * @var type string |
|
| 15 | - */ |
|
| 16 | - public $account_id; |
|
| 12 | + /** |
|
| 13 | + * Account ID |
|
| 14 | + * @var type string |
|
| 15 | + */ |
|
| 16 | + public $account_id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * User name |
|
| 20 | - * @var type string |
|
| 21 | - */ |
|
| 22 | - public $username; |
|
| 18 | + /** |
|
| 19 | + * User name |
|
| 20 | + * @var type string |
|
| 21 | + */ |
|
| 22 | + public $username; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Password |
|
| 26 | - * @var type string |
|
| 27 | - */ |
|
| 28 | - public $password; |
|
| 24 | + /** |
|
| 25 | + * Password |
|
| 26 | + * @var type string |
|
| 27 | + */ |
|
| 28 | + public $password; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Connection host |
|
| 32 | - * @var type string |
|
| 33 | - */ |
|
| 34 | - public $host; |
|
| 30 | + /** |
|
| 31 | + * Connection host |
|
| 32 | + * @var type string |
|
| 33 | + */ |
|
| 34 | + public $host; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * An unique ID of a telematics vendor. |
|
| 38 | - * @var type integer |
|
| 39 | - */ |
|
| 40 | - public $vendor_id; |
|
| 36 | + /** |
|
| 37 | + * An unique ID of a telematics vendor. |
|
| 38 | + * @var type integer |
|
| 39 | + */ |
|
| 40 | + public $vendor_id; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Telematics connection name |
|
| 44 | - * @var type string |
|
| 45 | - */ |
|
| 46 | - public $name; |
|
| 42 | + /** |
|
| 43 | + * Telematics connection name |
|
| 44 | + * @var type string |
|
| 45 | + */ |
|
| 46 | + public $name; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Vehicle tracking interval in seconds |
|
| 50 | - * @var type integer |
|
| 51 | - */ |
|
| 52 | - public $vehicle_position_refresh_rate; |
|
| 48 | + /** |
|
| 49 | + * Vehicle tracking interval in seconds |
|
| 50 | + * @var type integer |
|
| 51 | + */ |
|
| 52 | + public $vehicle_position_refresh_rate; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Connection token |
|
| 56 | - * @var type string |
|
| 57 | - */ |
|
| 58 | - public $connection_token; |
|
| 54 | + /** |
|
| 55 | + * Connection token |
|
| 56 | + * @var type string |
|
| 57 | + */ |
|
| 58 | + public $connection_token; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Connection user ID |
|
| 62 | - * @var type integer |
|
| 63 | - */ |
|
| 64 | - public $user_id; |
|
| 60 | + /** |
|
| 61 | + * Connection user ID |
|
| 62 | + * @var type integer |
|
| 63 | + */ |
|
| 64 | + public $user_id; |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Connection ID |
|
| 68 | - * @var type integer |
|
| 69 | - */ |
|
| 70 | - public $id; |
|
| 66 | + /** |
|
| 67 | + * Connection ID |
|
| 68 | + * @var type integer |
|
| 69 | + */ |
|
| 70 | + public $id; |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Telemetics connection type |
|
| 74 | - * @var type string |
|
| 75 | - */ |
|
| 76 | - public $vendor; |
|
| 72 | + /** |
|
| 73 | + * Telemetics connection type |
|
| 74 | + * @var type string |
|
| 75 | + */ |
|
| 76 | + public $vendor; |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Validate connections credentials. |
|
| 80 | - * @var type Boolean |
|
| 81 | - */ |
|
| 82 | - public $validate_remote_credentials; |
|
| 78 | + /** |
|
| 79 | + * Validate connections credentials. |
|
| 80 | + * @var type Boolean |
|
| 81 | + */ |
|
| 82 | + public $validate_remote_credentials; |
|
| 83 | 83 | } |
@@ -9,81 +9,81 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class TelematicsVendorParameters extends Common |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * An unique ID of a telematics vendor. |
|
| 14 | - * @var type integer |
|
| 15 | - */ |
|
| 16 | - public $vendor_id; |
|
| 12 | + /** |
|
| 13 | + * An unique ID of a telematics vendor. |
|
| 14 | + * @var type integer |
|
| 15 | + */ |
|
| 16 | + public $vendor_id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * If equal to 1, the vendor is integrated in the Route4Me system. |
|
| 20 | - * @var type integer |
|
| 21 | - */ |
|
| 22 | - public $is_integrated; |
|
| 18 | + /** |
|
| 19 | + * If equal to 1, the vendor is integrated in the Route4Me system. |
|
| 20 | + * @var type integer |
|
| 21 | + */ |
|
| 22 | + public $is_integrated; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Current page in the vendors collection |
|
| 26 | - * @var type integer |
|
| 27 | - */ |
|
| 28 | - public $page; |
|
| 24 | + /** |
|
| 25 | + * Current page in the vendors collection |
|
| 26 | + * @var type integer |
|
| 27 | + */ |
|
| 28 | + public $page; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Vendors number per page |
|
| 32 | - * @var type integer |
|
| 33 | - */ |
|
| 34 | - public $per_page; |
|
| 30 | + /** |
|
| 31 | + * Vendors number per page |
|
| 32 | + * @var type integer |
|
| 33 | + */ |
|
| 34 | + public $per_page; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * The vendor's country |
|
| 38 | - * @var type string |
|
| 39 | - */ |
|
| 40 | - public $country; |
|
| 36 | + /** |
|
| 37 | + * The vendor's country |
|
| 38 | + * @var type string |
|
| 39 | + */ |
|
| 40 | + public $country; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Vendor's feature |
|
| 44 | - * @var type string |
|
| 45 | - */ |
|
| 46 | - public $feature; |
|
| 42 | + /** |
|
| 43 | + * Vendor's feature |
|
| 44 | + * @var type string |
|
| 45 | + */ |
|
| 46 | + public $feature; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * A query string |
|
| 50 | - * @var type string |
|
| 51 | - */ |
|
| 52 | - public $search; |
|
| 48 | + /** |
|
| 49 | + * A query string |
|
| 50 | + * @var type string |
|
| 51 | + */ |
|
| 52 | + public $search; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Comma-delimited list of the vendors IDs |
|
| 56 | - * @var type string |
|
| 57 | - */ |
|
| 58 | - public $vendors; |
|
| 54 | + /** |
|
| 55 | + * Comma-delimited list of the vendors IDs |
|
| 56 | + * @var type string |
|
| 57 | + */ |
|
| 58 | + public $vendors; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Owner of a telematicss connection. |
|
| 62 | - * @var type integer |
|
| 63 | - */ |
|
| 64 | - public $member_id; |
|
| 60 | + /** |
|
| 61 | + * Owner of a telematicss connection. |
|
| 62 | + * @var type integer |
|
| 63 | + */ |
|
| 64 | + public $member_id; |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Is a user real or virtual |
|
| 68 | - * @var type integer |
|
| 69 | - */ |
|
| 70 | - public $is_virtual; |
|
| 66 | + /** |
|
| 67 | + * Is a user real or virtual |
|
| 68 | + * @var type integer |
|
| 69 | + */ |
|
| 70 | + public $is_virtual; |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * API key |
|
| 74 | - * @var type string |
|
| 75 | - */ |
|
| 76 | - public $api_key; |
|
| 72 | + /** |
|
| 73 | + * API key |
|
| 74 | + * @var type string |
|
| 75 | + */ |
|
| 76 | + public $api_key; |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * If true, remote credentials validated. |
|
| 80 | - * @var type Boolean |
|
| 81 | - */ |
|
| 82 | - public $validate_remote_credentials; |
|
| 78 | + /** |
|
| 79 | + * If true, remote credentials validated. |
|
| 80 | + * @var type Boolean |
|
| 81 | + */ |
|
| 82 | + public $validate_remote_credentials; |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * API token. |
|
| 86 | - * @var type string |
|
| 87 | - */ |
|
| 88 | - public $api_token; |
|
| 84 | + /** |
|
| 85 | + * API token. |
|
| 86 | + * @var type string |
|
| 87 | + */ |
|
| 88 | + public $api_token; |
|
| 89 | 89 | } |
@@ -11,158 +11,158 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class TelematicsVendor extends Common |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Unique ID of a telematics vendor. |
|
| 16 | - * @var string |
|
| 17 | - */ |
|
| 18 | - public $id; |
|
| 14 | + /** |
|
| 15 | + * Unique ID of a telematics vendor. |
|
| 16 | + * @var string |
|
| 17 | + */ |
|
| 18 | + public $id; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Vendor name |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $name; |
|
| 20 | + /** |
|
| 21 | + * Vendor name |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $name; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Vendor slug |
|
| 28 | - * @var string |
|
| 29 | - */ |
|
| 30 | - public $slug; |
|
| 26 | + /** |
|
| 27 | + * Vendor slug |
|
| 28 | + * @var string |
|
| 29 | + */ |
|
| 30 | + public $slug; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Vendor description |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 36 | - public $description; |
|
| 32 | + /** |
|
| 33 | + * Vendor description |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | + public $description; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * URL to the telematics vendor's logo. |
|
| 40 | - * @var string |
|
| 41 | - */ |
|
| 42 | - public $logo_url; |
|
| 38 | + /** |
|
| 39 | + * URL to the telematics vendor's logo. |
|
| 40 | + * @var string |
|
| 41 | + */ |
|
| 42 | + public $logo_url; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Website URL of a telematics vendor. |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 48 | - public $website_url; |
|
| 44 | + /** |
|
| 45 | + * Website URL of a telematics vendor. |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | + public $website_url; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * API URL of a telematics vendor. |
|
| 52 | - * @var string |
|
| 53 | - */ |
|
| 54 | - public $api_docs_url; |
|
| 50 | + /** |
|
| 51 | + * API URL of a telematics vendor. |
|
| 52 | + * @var string |
|
| 53 | + */ |
|
| 54 | + public $api_docs_url; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * If 1, the vendor is integrated in Route4Me |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 60 | - public $is_integrated; |
|
| 56 | + /** |
|
| 57 | + * If 1, the vendor is integrated in Route4Me |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | + public $is_integrated; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Vendors size. |
|
| 64 | - * <para>Accepted values:</para> |
|
| 65 | - * <para>global, regional, local. </para> |
|
| 66 | - * @var string |
|
| 67 | - */ |
|
| 68 | - public $size; |
|
| 62 | + /** |
|
| 63 | + * Vendors size. |
|
| 64 | + * <para>Accepted values:</para> |
|
| 65 | + * <para>global, regional, local. </para> |
|
| 66 | + * @var string |
|
| 67 | + */ |
|
| 68 | + public $size; |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * An array of the countries, the vendor is operating. |
|
| 72 | - * @var Country[] |
|
| 73 | - */ |
|
| 74 | - public $countries = []; |
|
| 70 | + /** |
|
| 71 | + * An array of the countries, the vendor is operating. |
|
| 72 | + * @var Country[] |
|
| 73 | + */ |
|
| 74 | + public $countries = []; |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * An array the vendor features |
|
| 78 | - * @var TelematicsVendorFeature[] |
|
| 79 | - */ |
|
| 80 | - public $features = []; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Get vendor(s), search for vendors, compare vendors. |
|
| 84 | - * @param TelematicsVendorParameters $params |
|
| 85 | - * @return TelematicsVendorResponse or TelematicsVendorsResponse. |
|
| 86 | - */ |
|
| 87 | - public static function GetTelematicsVendors($params) |
|
| 88 | - { |
|
| 89 | - Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
|
| 90 | - |
|
| 91 | - $allQueryFields = ['vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors']; |
|
| 92 | - |
|
| 93 | - $vendors = Route4Me::makeRequst([ |
|
| 94 | - 'url' => '', |
|
| 95 | - 'method' => 'GET', |
|
| 96 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 97 | - ]); |
|
| 98 | - |
|
| 99 | - return $vendors; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Returns a random telematics vendor (for tests). |
|
| 104 | - * @param $offset integer |
|
| 105 | - * @param $limit integer |
|
| 106 | - * @return Telematics vendor |
|
| 107 | - */ |
|
| 108 | - public static function GetRandomVendorID($offset, $limit) |
|
| 109 | - { |
|
| 110 | - $allVendors = self::GetTelematicsVendors(null); |
|
| 111 | - $vendorsNumber = sizeof($allVendors['vendors']); |
|
| 112 | - |
|
| 113 | - if ($vendorsNumber < $limit) { |
|
| 114 | - if ($vendorsNumber > $offset) { |
|
| 115 | - $limit = $vendorsNumber; |
|
| 116 | - } else { |
|
| 117 | - if ($vendorsNumber == $offset) { |
|
| 118 | - return $allVendors['vendors'][$offset]->{'vendor_id'}; |
|
| 119 | - } else { |
|
| 120 | - echo 'The vendors numbers are less than offset'; |
|
| 121 | - |
|
| 122 | - return null; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $randNumber = rand($offset, $limit); |
|
| 128 | - |
|
| 129 | - return $allVendors['vendors'][$randNumber]['id']; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Register telematics member |
|
| 134 | - * @param TelematicsVendorParameters $params contains: |
|
| 135 | - * @param integer member_id : member ID |
|
| 136 | - * @param string api_key : API key |
|
| 137 | - * @return array from a TelematicsRegisterMemberResponse type object |
|
| 138 | - * @throws \Route4Me\Exception\ApiError |
|
| 139 | - */ |
|
| 140 | - public static function RegisterTelematicsMember($params) |
|
| 141 | - { |
|
| 142 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 143 | - |
|
| 144 | - $allQueryFields = ['member_id', 'api_key']; |
|
| 145 | - |
|
| 146 | - $vendors = Route4Me::makeRequst([ |
|
| 147 | - 'url' => Endpoint::TELEMATICS_REGISTER_MEMBER, |
|
| 148 | - 'method' => 'GET', |
|
| 149 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 150 | - ]); |
|
| 151 | - |
|
| 152 | - return $vendors; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Get a vendor by ID |
|
| 157 | - * @param string $vendorId |
|
| 158 | - * @return TelematicsVendor type object |
|
| 159 | - */ |
|
| 160 | - public static function getVendorById($vendorId) |
|
| 161 | - { |
|
| 162 | - if ($vendorId!=null) { |
|
| 163 | - return self::GetTelematicsVendors($vendorId); |
|
| 164 | - } else { |
|
| 165 | - return null; |
|
| 166 | - } |
|
| 167 | - } |
|
| 76 | + /** |
|
| 77 | + * An array the vendor features |
|
| 78 | + * @var TelematicsVendorFeature[] |
|
| 79 | + */ |
|
| 80 | + public $features = []; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Get vendor(s), search for vendors, compare vendors. |
|
| 84 | + * @param TelematicsVendorParameters $params |
|
| 85 | + * @return TelematicsVendorResponse or TelematicsVendorsResponse. |
|
| 86 | + */ |
|
| 87 | + public static function GetTelematicsVendors($params) |
|
| 88 | + { |
|
| 89 | + Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
|
| 90 | + |
|
| 91 | + $allQueryFields = ['vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors']; |
|
| 92 | + |
|
| 93 | + $vendors = Route4Me::makeRequst([ |
|
| 94 | + 'url' => '', |
|
| 95 | + 'method' => 'GET', |
|
| 96 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 97 | + ]); |
|
| 98 | + |
|
| 99 | + return $vendors; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Returns a random telematics vendor (for tests). |
|
| 104 | + * @param $offset integer |
|
| 105 | + * @param $limit integer |
|
| 106 | + * @return Telematics vendor |
|
| 107 | + */ |
|
| 108 | + public static function GetRandomVendorID($offset, $limit) |
|
| 109 | + { |
|
| 110 | + $allVendors = self::GetTelematicsVendors(null); |
|
| 111 | + $vendorsNumber = sizeof($allVendors['vendors']); |
|
| 112 | + |
|
| 113 | + if ($vendorsNumber < $limit) { |
|
| 114 | + if ($vendorsNumber > $offset) { |
|
| 115 | + $limit = $vendorsNumber; |
|
| 116 | + } else { |
|
| 117 | + if ($vendorsNumber == $offset) { |
|
| 118 | + return $allVendors['vendors'][$offset]->{'vendor_id'}; |
|
| 119 | + } else { |
|
| 120 | + echo 'The vendors numbers are less than offset'; |
|
| 121 | + |
|
| 122 | + return null; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $randNumber = rand($offset, $limit); |
|
| 128 | + |
|
| 129 | + return $allVendors['vendors'][$randNumber]['id']; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Register telematics member |
|
| 134 | + * @param TelematicsVendorParameters $params contains: |
|
| 135 | + * @param integer member_id : member ID |
|
| 136 | + * @param string api_key : API key |
|
| 137 | + * @return array from a TelematicsRegisterMemberResponse type object |
|
| 138 | + * @throws \Route4Me\Exception\ApiError |
|
| 139 | + */ |
|
| 140 | + public static function RegisterTelematicsMember($params) |
|
| 141 | + { |
|
| 142 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 143 | + |
|
| 144 | + $allQueryFields = ['member_id', 'api_key']; |
|
| 145 | + |
|
| 146 | + $vendors = Route4Me::makeRequst([ |
|
| 147 | + 'url' => Endpoint::TELEMATICS_REGISTER_MEMBER, |
|
| 148 | + 'method' => 'GET', |
|
| 149 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 150 | + ]); |
|
| 151 | + |
|
| 152 | + return $vendors; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Get a vendor by ID |
|
| 157 | + * @param string $vendorId |
|
| 158 | + * @return TelematicsVendor type object |
|
| 159 | + */ |
|
| 160 | + public static function getVendorById($vendorId) |
|
| 161 | + { |
|
| 162 | + if ($vendorId!=null) { |
|
| 163 | + return self::GetTelematicsVendors($vendorId); |
|
| 164 | + } else { |
|
| 165 | + return null; |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | 168 | } |