@@ -10,24 +10,24 @@ |
||
10 | 10 | */ |
11 | 11 | class VehicleLocationItem extends \Route4Me\Common |
12 | 12 | { |
13 | - /** The vehicle ID |
|
14 | - * @var string $vehicle_id |
|
15 | - */ |
|
16 | - public $vehicle_id; |
|
13 | + /** The vehicle ID |
|
14 | + * @var string $vehicle_id |
|
15 | + */ |
|
16 | + public $vehicle_id; |
|
17 | 17 | |
18 | - /** When a vehicle activity was detected. |
|
19 | - * @var integer $activity_timestamp |
|
20 | - */ |
|
21 | - public $activity_timestamp; |
|
18 | + /** When a vehicle activity was detected. |
|
19 | + * @var integer $activity_timestamp |
|
20 | + */ |
|
21 | + public $activity_timestamp; |
|
22 | 22 | |
23 | - /** Latitude of a vehicle position. |
|
24 | - * @var float $lat |
|
25 | - */ |
|
26 | - public $lat; |
|
23 | + /** Latitude of a vehicle position. |
|
24 | + * @var float $lat |
|
25 | + */ |
|
26 | + public $lat; |
|
27 | 27 | |
28 | - /** Longitude of a vehicle position |
|
29 | - * @var float $lng |
|
30 | - */ |
|
31 | - public $lng; |
|
28 | + /** Longitude of a vehicle position |
|
29 | + * @var float $lng |
|
30 | + */ |
|
31 | + public $lng; |
|
32 | 32 | |
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -12,22 +12,22 @@ |
||
12 | 12 | */ |
13 | 13 | class VehicleResponse extends Common |
14 | 14 | { |
15 | - /** Vehicle data |
|
16 | - * @var DataVehicle $data |
|
17 | - */ |
|
18 | - public $data = []; |
|
15 | + /** Vehicle data |
|
16 | + * @var DataVehicle $data |
|
17 | + */ |
|
18 | + public $data = []; |
|
19 | 19 | |
20 | - public static function fromArray(array $params) |
|
21 | - { |
|
22 | - $vehResp = new self(); |
|
20 | + public static function fromArray(array $params) |
|
21 | + { |
|
22 | + $vehResp = new self(); |
|
23 | 23 | |
24 | - foreach ($params as $key => $value) { |
|
25 | - if (is_null(Common::getValue($params, $key))) continue; |
|
26 | - if (property_exists($vehResp, $key)) { |
|
27 | - $vehResp->$key = $value; |
|
28 | - } |
|
29 | - } |
|
24 | + foreach ($params as $key => $value) { |
|
25 | + if (is_null(Common::getValue($params, $key))) continue; |
|
26 | + if (property_exists($vehResp, $key)) { |
|
27 | + $vehResp->$key = $value; |
|
28 | + } |
|
29 | + } |
|
30 | 30 | |
31 | - return $vehResp; |
|
32 | - } |
|
31 | + return $vehResp; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -12,77 +12,77 @@ |
||
12 | 12 | */ |
13 | 13 | class VehicleProfilesResponse extends Common |
14 | 14 | { |
15 | - /** Current page of the paginated vehicle profiles list. |
|
16 | - * @var integer $current_page |
|
17 | - */ |
|
18 | - public $current_page; |
|
19 | - |
|
20 | - /** An array of the vehicle profiles |
|
21 | - * @var VehileProfile[] $data |
|
22 | - */ |
|
23 | - public $data = []; |
|
24 | - |
|
25 | - /** URL to the first page of the paginated vehicle profiles list. |
|
26 | - * @var string $first_page_url |
|
27 | - */ |
|
28 | - public $first_page_url; |
|
29 | - |
|
30 | - /** From which vehicle profile is starting the page |
|
31 | - * @var integer $from |
|
32 | - */ |
|
33 | - public $from; |
|
34 | - |
|
35 | - /** Last page |
|
36 | - * @var integer $last_page |
|
37 | - */ |
|
38 | - public $last_page; |
|
39 | - |
|
40 | - /** URL to the last page of the paginated vehicle profiles list. |
|
41 | - * @var string $last_page_url |
|
42 | - */ |
|
43 | - public $last_page_url; |
|
44 | - |
|
45 | - /** URL to the next page of the paginated vehicle profiles list. |
|
46 | - * @var string $next_page_url |
|
47 | - */ |
|
48 | - public $next_page_url; |
|
49 | - |
|
50 | - /** Path to the API endpoint |
|
51 | - * @var string $path |
|
52 | - */ |
|
53 | - public $path; |
|
54 | - |
|
55 | - /** Vehicles number per page |
|
56 | - * @var integer $per_page |
|
57 | - */ |
|
58 | - public $per_page; |
|
59 | - |
|
60 | - /** URL to the previous page |
|
61 | - * @var string $prev_page_url |
|
62 | - */ |
|
63 | - public $prev_page_url; |
|
64 | - |
|
65 | - /** To which vehicle profile is ending the page |
|
66 | - * @var integer $to |
|
67 | - */ |
|
68 | - public $to; |
|
69 | - |
|
70 | - /** Total number of the vehicles. |
|
71 | - * @var integer $total |
|
72 | - */ |
|
73 | - public $total; |
|
74 | - |
|
75 | - public static function fromArray(array $params) |
|
76 | - { |
|
77 | - $profResp = new self(); |
|
78 | - |
|
79 | - foreach ($params as $key => $value) { |
|
80 | - if (is_null(Common::getValue($params, $key))) continue; |
|
81 | - if (property_exists($profResp, $key)) { |
|
82 | - $profResp->$key = $value; |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - return $profResp; |
|
87 | - } |
|
15 | + /** Current page of the paginated vehicle profiles list. |
|
16 | + * @var integer $current_page |
|
17 | + */ |
|
18 | + public $current_page; |
|
19 | + |
|
20 | + /** An array of the vehicle profiles |
|
21 | + * @var VehileProfile[] $data |
|
22 | + */ |
|
23 | + public $data = []; |
|
24 | + |
|
25 | + /** URL to the first page of the paginated vehicle profiles list. |
|
26 | + * @var string $first_page_url |
|
27 | + */ |
|
28 | + public $first_page_url; |
|
29 | + |
|
30 | + /** From which vehicle profile is starting the page |
|
31 | + * @var integer $from |
|
32 | + */ |
|
33 | + public $from; |
|
34 | + |
|
35 | + /** Last page |
|
36 | + * @var integer $last_page |
|
37 | + */ |
|
38 | + public $last_page; |
|
39 | + |
|
40 | + /** URL to the last page of the paginated vehicle profiles list. |
|
41 | + * @var string $last_page_url |
|
42 | + */ |
|
43 | + public $last_page_url; |
|
44 | + |
|
45 | + /** URL to the next page of the paginated vehicle profiles list. |
|
46 | + * @var string $next_page_url |
|
47 | + */ |
|
48 | + public $next_page_url; |
|
49 | + |
|
50 | + /** Path to the API endpoint |
|
51 | + * @var string $path |
|
52 | + */ |
|
53 | + public $path; |
|
54 | + |
|
55 | + /** Vehicles number per page |
|
56 | + * @var integer $per_page |
|
57 | + */ |
|
58 | + public $per_page; |
|
59 | + |
|
60 | + /** URL to the previous page |
|
61 | + * @var string $prev_page_url |
|
62 | + */ |
|
63 | + public $prev_page_url; |
|
64 | + |
|
65 | + /** To which vehicle profile is ending the page |
|
66 | + * @var integer $to |
|
67 | + */ |
|
68 | + public $to; |
|
69 | + |
|
70 | + /** Total number of the vehicles. |
|
71 | + * @var integer $total |
|
72 | + */ |
|
73 | + public $total; |
|
74 | + |
|
75 | + public static function fromArray(array $params) |
|
76 | + { |
|
77 | + $profResp = new self(); |
|
78 | + |
|
79 | + foreach ($params as $key => $value) { |
|
80 | + if (is_null(Common::getValue($params, $key))) continue; |
|
81 | + if (property_exists($profResp, $key)) { |
|
82 | + $profResp->$key = $value; |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + return $profResp; |
|
87 | + } |
|
88 | 88 | } |
89 | 89 | \ No newline at end of file |
@@ -6,38 +6,38 @@ |
||
6 | 6 | |
7 | 7 | class VehicleTrackItem extends \Route4Me\Common |
8 | 8 | { |
9 | - /** The vehicle ID |
|
10 | - * @var string $vehicle_id |
|
11 | - */ |
|
12 | - public $vehicle_id; |
|
13 | - |
|
14 | - /** The member ID |
|
15 | - * @var integer $member_id |
|
16 | - */ |
|
17 | - public $member_id; |
|
18 | - |
|
19 | - /** Latitude of a vehicle position. |
|
20 | - * @var float $lat |
|
21 | - */ |
|
22 | - public $lat; |
|
23 | - |
|
24 | - /** Longitude of a vehicle position. |
|
25 | - * @var float $lng |
|
26 | - */ |
|
27 | - public $lng; |
|
28 | - |
|
29 | - /** The geographic altitude |
|
30 | - * @var integer $altitude |
|
31 | - */ |
|
32 | - public $altitude; |
|
33 | - |
|
34 | - /** Vehicle speed |
|
35 | - * @var integer $speed |
|
36 | - */ |
|
37 | - public $speed; |
|
38 | - |
|
39 | - /** When a vehicle activity was detected. |
|
40 | - * @var integer $timestamp |
|
41 | - */ |
|
42 | - public $timestamp; |
|
9 | + /** The vehicle ID |
|
10 | + * @var string $vehicle_id |
|
11 | + */ |
|
12 | + public $vehicle_id; |
|
13 | + |
|
14 | + /** The member ID |
|
15 | + * @var integer $member_id |
|
16 | + */ |
|
17 | + public $member_id; |
|
18 | + |
|
19 | + /** Latitude of a vehicle position. |
|
20 | + * @var float $lat |
|
21 | + */ |
|
22 | + public $lat; |
|
23 | + |
|
24 | + /** Longitude of a vehicle position. |
|
25 | + * @var float $lng |
|
26 | + */ |
|
27 | + public $lng; |
|
28 | + |
|
29 | + /** The geographic altitude |
|
30 | + * @var integer $altitude |
|
31 | + */ |
|
32 | + public $altitude; |
|
33 | + |
|
34 | + /** Vehicle speed |
|
35 | + * @var integer $speed |
|
36 | + */ |
|
37 | + public $speed; |
|
38 | + |
|
39 | + /** When a vehicle activity was detected. |
|
40 | + * @var integer $timestamp |
|
41 | + */ |
|
42 | + public $timestamp; |
|
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -16,252 +16,252 @@ |
||
16 | 16 | */ |
17 | 17 | class VehicleProfile extends Common |
18 | 18 | { |
19 | - /** Vehicle profile ID |
|
20 | - * @var integer $vehicle_profile_id |
|
21 | - */ |
|
22 | - public $vehicle_profile_id; |
|
23 | - |
|
24 | - /** Root member ID |
|
25 | - * @var integer $root_member_id |
|
26 | - */ |
|
27 | - public $root_member_id; |
|
28 | - |
|
29 | - /** Vehicle profile name |
|
30 | - * @var string $name |
|
31 | - */ |
|
32 | - public $name; |
|
33 | - |
|
34 | - /** Vehicle height |
|
35 | - * @var float $height |
|
36 | - */ |
|
37 | - public $height; |
|
38 | - |
|
39 | - /** Vehicle width |
|
40 | - * @var float $width |
|
41 | - */ |
|
42 | - public $width; |
|
43 | - |
|
44 | - /** Vehicle length |
|
45 | - * @var float $length |
|
46 | - */ |
|
47 | - public $length; |
|
48 | - |
|
49 | - /** Vehicle weight |
|
50 | - * @var float $weight |
|
51 | - */ |
|
52 | - public $weight; |
|
53 | - |
|
54 | - /** Maximum weight per axle. |
|
55 | - * @var float $max_weight_per_axle |
|
56 | - */ |
|
57 | - public $max_weight_per_axle; |
|
58 | - |
|
59 | - /** When the profile deleted |
|
60 | - * @var string $deleted_at |
|
61 | - */ |
|
62 | - public $deleted_at; |
|
63 | - |
|
64 | - /** When the profile created |
|
65 | - * @var string $created_at |
|
66 | - */ |
|
67 | - public $created_at; |
|
68 | - |
|
69 | - /** When the profile updated |
|
70 | - * @var string $updated_at |
|
71 | - */ |
|
72 | - public $updated_at; |
|
73 | - |
|
74 | - /** A type of the fuel |
|
75 | - * enum: ['unleaded 87','unleaded 89','unleaded 91', |
|
76 | - * 'unleaded 93','diesel','electric','hybrid'] |
|
77 | - * @var string $fuel_type |
|
78 | - */ |
|
79 | - public $fuel_type; |
|
80 | - |
|
81 | - /** Fuel consumption city |
|
82 | - * @var float $fuel_consumption_city |
|
83 | - */ |
|
84 | - public $fuel_consumption_city; |
|
85 | - |
|
86 | - /** Fuel consumption in the highway area |
|
87 | - * @var float $fuel_consumption_highway |
|
88 | - */ |
|
89 | - public $fuel_consumption_highway; |
|
90 | - |
|
91 | - /** Type of a hazardous material. |
|
92 | - * enum: ['general', 'explosives', 'flammable', 'inhalants', 'caustic', 'radioactive'] |
|
93 | - * @var string $hazmat_type |
|
94 | - */ |
|
95 | - public $hazmat_type; |
|
96 | - |
|
97 | - /** If true, the profile is predefined. |
|
98 | - * @var boolean $is_predefined |
|
99 | - */ |
|
100 | - public $is_predefined; |
|
101 | - |
|
102 | - /** If true, the profile is default. |
|
103 | - * @var boolean $is_default |
|
104 | - */ |
|
105 | - public $is_default; |
|
106 | - |
|
107 | - /** Height units (e.g. 'ft', 'm') |
|
108 | - * @var string $height_units |
|
109 | - */ |
|
110 | - public $height_units; |
|
111 | - |
|
112 | - /** Width units (e.g. 'ft', 'm') |
|
113 | - * @var string $width_units |
|
114 | - */ |
|
115 | - public $width_units; |
|
116 | - |
|
117 | - /** Length units (e.g. 'ft', 'm') |
|
118 | - * @var string $length_units |
|
119 | - */ |
|
120 | - public $length_units; |
|
121 | - |
|
122 | - /** Weight units (e.g. 'lb', 'kg') |
|
123 | - * @var string $weight_units |
|
124 | - */ |
|
125 | - public $weight_units; |
|
126 | - |
|
127 | - /** Maximum weight per axle units (e.g. 'lb', 'kg') |
|
128 | - * @var string $max_weight_per_axle_units |
|
129 | - */ |
|
130 | - public $max_weight_per_axle_units; |
|
131 | - |
|
132 | - /** Fuel consumption units in the city area (e.g. mpg) |
|
133 | - * @var string $fuel_consumption_city_unit |
|
134 | - */ |
|
135 | - public $fuel_consumption_city_unit; |
|
136 | - |
|
137 | - /** Fuel consumption units in the highway area (e.g. mpg) |
|
138 | - * @var string $fuel_consumption_highway_unit |
|
139 | - */ |
|
140 | - public $fuel_consumption_highway_unit; |
|
141 | - |
|
142 | - /** Height UF value (e.g. "7'") |
|
143 | - * @var string $height_uf_value |
|
144 | - */ |
|
145 | - public $height_uf_value; |
|
146 | - |
|
147 | - /** Width UF value (e.g. "8'") |
|
148 | - * @var string $width_uf_value |
|
149 | - */ |
|
150 | - public $width_uf_value; |
|
151 | - |
|
152 | - /** Length UF value (e.g. "20'") |
|
153 | - * @var string $length_uf_value |
|
154 | - */ |
|
155 | - public $length_uf_value; |
|
156 | - |
|
157 | - /** Weight UF value (e.g. "8,500lb") |
|
158 | - * @var string $weight_uf_value |
|
159 | - */ |
|
160 | - public $weight_uf_value; |
|
161 | - |
|
162 | - /** Maximum weight per axle (UF value, e.g. "8,500lb") |
|
163 | - * @var string $max_weight_per_axle_uf_value |
|
164 | - */ |
|
165 | - public $max_weight_per_axle_uf_value; |
|
166 | - |
|
167 | - /** Fuel consumption city (UF value, e.g. "20.01 mi/l") |
|
168 | - * @var string $fuel_consumption_city_uf_value |
|
169 | - */ |
|
170 | - public $fuel_consumption_city_uf_value; |
|
171 | - |
|
172 | - /** Fuel consumption highway (UF value, e.g. "2,000.01 mpg") |
|
173 | - * @var string $fuel_consumption_highway_uf_value |
|
174 | - */ |
|
175 | - public $fuel_consumption_highway_uf_value; |
|
176 | - |
|
177 | - public static function fromArray(array $params) |
|
178 | - { |
|
179 | - $vehicleProfile = new self(); |
|
180 | - |
|
181 | - foreach ($params as $key => $value) { |
|
182 | - if (is_null(Common::getValue($params, $key))) continue; |
|
183 | - if (property_exists($vehicleProfile, $key)) { |
|
184 | - $vehicleProfile->$key = $value; |
|
185 | - } |
|
186 | - } |
|
187 | - |
|
188 | - return $vehicleProfile; |
|
189 | - } |
|
190 | - |
|
191 | - public function removeVehicleProfile($vehicleProfileId) |
|
192 | - { |
|
193 | - //$vehicleProfileID = isset($params['vehicle_profile_id']) ? $params['vehicle_profile_id'] : null; |
|
194 | - |
|
195 | - $response = Route4Me::makeRequst([ |
|
196 | - 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
197 | - 'method' => 'DELETE', |
|
198 | - 'HTTPHEADER' => 'Content-Type: application/json; Accept: application/json', |
|
199 | - ]); |
|
200 | - |
|
201 | - return $response; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * @param $profileParams - an array from the VehicleParameters object. |
|
206 | - * @return The data including list of the vehicle profiles. |
|
207 | - * @throws \Route4Me\Exception\ApiError |
|
208 | - */ |
|
209 | - public function getVehicleProfiles($profileParams) |
|
210 | - { |
|
211 | - $allQueryFields = ['with_pagination', 'page', 'perPage']; |
|
212 | - |
|
213 | - $response = Route4Me::makeRequst([ |
|
214 | - 'url' => Endpoint::VehicleProfiles, |
|
215 | - 'method' => 'GET', |
|
216 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $profileParams), |
|
217 | - ]); |
|
218 | - |
|
219 | - return $response; |
|
220 | - } |
|
221 | - |
|
222 | - /** |
|
223 | - * @param $profileParams - Vehicle profile body parameters |
|
224 | - * @return Created vehicle profile |
|
225 | - * @throws \Route4Me\Exception\ApiError |
|
226 | - */ |
|
227 | - public function createVehicleProfile($profileParams) |
|
228 | - { |
|
229 | - $excludeFields = []; |
|
230 | - $allBodyFields = Route4Me::getObjectProperties(new VehicleProfile(), $excludeFields); |
|
231 | - |
|
232 | - $response = Route4Me::makeRequst([ |
|
233 | - 'url' => Endpoint::VehicleProfiles, |
|
234 | - 'method' => 'POST', |
|
235 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $profileParams), |
|
236 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
237 | - ]); |
|
238 | - |
|
239 | - return $response; |
|
240 | - } |
|
241 | - |
|
242 | - public function getVehicleProfileById($vehicleProfileId) |
|
243 | - { |
|
244 | - $response = Route4Me::makeRequst([ |
|
245 | - 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
246 | - 'method' => 'GET', |
|
247 | - ]); |
|
248 | - |
|
249 | - return $response; |
|
250 | - } |
|
251 | - |
|
252 | - public function updateVehicleProfile($vehicleProfile) |
|
253 | - { |
|
254 | - $excludeFields = ['vehicle_profile_id', 'deleted_at', 'created_at', 'updated_at']; |
|
255 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
256 | - |
|
257 | - $response = Route4Me::makeRequst([ |
|
258 | - 'url' => Endpoint::VehicleProfiles.'/'.$vehicleProfile['vehicle_profile_id'], |
|
259 | - 'method' => 'PATCH', |
|
260 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleProfile), |
|
261 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
262 | - ]); |
|
263 | - |
|
264 | - return $response; |
|
265 | - } |
|
19 | + /** Vehicle profile ID |
|
20 | + * @var integer $vehicle_profile_id |
|
21 | + */ |
|
22 | + public $vehicle_profile_id; |
|
23 | + |
|
24 | + /** Root member ID |
|
25 | + * @var integer $root_member_id |
|
26 | + */ |
|
27 | + public $root_member_id; |
|
28 | + |
|
29 | + /** Vehicle profile name |
|
30 | + * @var string $name |
|
31 | + */ |
|
32 | + public $name; |
|
33 | + |
|
34 | + /** Vehicle height |
|
35 | + * @var float $height |
|
36 | + */ |
|
37 | + public $height; |
|
38 | + |
|
39 | + /** Vehicle width |
|
40 | + * @var float $width |
|
41 | + */ |
|
42 | + public $width; |
|
43 | + |
|
44 | + /** Vehicle length |
|
45 | + * @var float $length |
|
46 | + */ |
|
47 | + public $length; |
|
48 | + |
|
49 | + /** Vehicle weight |
|
50 | + * @var float $weight |
|
51 | + */ |
|
52 | + public $weight; |
|
53 | + |
|
54 | + /** Maximum weight per axle. |
|
55 | + * @var float $max_weight_per_axle |
|
56 | + */ |
|
57 | + public $max_weight_per_axle; |
|
58 | + |
|
59 | + /** When the profile deleted |
|
60 | + * @var string $deleted_at |
|
61 | + */ |
|
62 | + public $deleted_at; |
|
63 | + |
|
64 | + /** When the profile created |
|
65 | + * @var string $created_at |
|
66 | + */ |
|
67 | + public $created_at; |
|
68 | + |
|
69 | + /** When the profile updated |
|
70 | + * @var string $updated_at |
|
71 | + */ |
|
72 | + public $updated_at; |
|
73 | + |
|
74 | + /** A type of the fuel |
|
75 | + * enum: ['unleaded 87','unleaded 89','unleaded 91', |
|
76 | + * 'unleaded 93','diesel','electric','hybrid'] |
|
77 | + * @var string $fuel_type |
|
78 | + */ |
|
79 | + public $fuel_type; |
|
80 | + |
|
81 | + /** Fuel consumption city |
|
82 | + * @var float $fuel_consumption_city |
|
83 | + */ |
|
84 | + public $fuel_consumption_city; |
|
85 | + |
|
86 | + /** Fuel consumption in the highway area |
|
87 | + * @var float $fuel_consumption_highway |
|
88 | + */ |
|
89 | + public $fuel_consumption_highway; |
|
90 | + |
|
91 | + /** Type of a hazardous material. |
|
92 | + * enum: ['general', 'explosives', 'flammable', 'inhalants', 'caustic', 'radioactive'] |
|
93 | + * @var string $hazmat_type |
|
94 | + */ |
|
95 | + public $hazmat_type; |
|
96 | + |
|
97 | + /** If true, the profile is predefined. |
|
98 | + * @var boolean $is_predefined |
|
99 | + */ |
|
100 | + public $is_predefined; |
|
101 | + |
|
102 | + /** If true, the profile is default. |
|
103 | + * @var boolean $is_default |
|
104 | + */ |
|
105 | + public $is_default; |
|
106 | + |
|
107 | + /** Height units (e.g. 'ft', 'm') |
|
108 | + * @var string $height_units |
|
109 | + */ |
|
110 | + public $height_units; |
|
111 | + |
|
112 | + /** Width units (e.g. 'ft', 'm') |
|
113 | + * @var string $width_units |
|
114 | + */ |
|
115 | + public $width_units; |
|
116 | + |
|
117 | + /** Length units (e.g. 'ft', 'm') |
|
118 | + * @var string $length_units |
|
119 | + */ |
|
120 | + public $length_units; |
|
121 | + |
|
122 | + /** Weight units (e.g. 'lb', 'kg') |
|
123 | + * @var string $weight_units |
|
124 | + */ |
|
125 | + public $weight_units; |
|
126 | + |
|
127 | + /** Maximum weight per axle units (e.g. 'lb', 'kg') |
|
128 | + * @var string $max_weight_per_axle_units |
|
129 | + */ |
|
130 | + public $max_weight_per_axle_units; |
|
131 | + |
|
132 | + /** Fuel consumption units in the city area (e.g. mpg) |
|
133 | + * @var string $fuel_consumption_city_unit |
|
134 | + */ |
|
135 | + public $fuel_consumption_city_unit; |
|
136 | + |
|
137 | + /** Fuel consumption units in the highway area (e.g. mpg) |
|
138 | + * @var string $fuel_consumption_highway_unit |
|
139 | + */ |
|
140 | + public $fuel_consumption_highway_unit; |
|
141 | + |
|
142 | + /** Height UF value (e.g. "7'") |
|
143 | + * @var string $height_uf_value |
|
144 | + */ |
|
145 | + public $height_uf_value; |
|
146 | + |
|
147 | + /** Width UF value (e.g. "8'") |
|
148 | + * @var string $width_uf_value |
|
149 | + */ |
|
150 | + public $width_uf_value; |
|
151 | + |
|
152 | + /** Length UF value (e.g. "20'") |
|
153 | + * @var string $length_uf_value |
|
154 | + */ |
|
155 | + public $length_uf_value; |
|
156 | + |
|
157 | + /** Weight UF value (e.g. "8,500lb") |
|
158 | + * @var string $weight_uf_value |
|
159 | + */ |
|
160 | + public $weight_uf_value; |
|
161 | + |
|
162 | + /** Maximum weight per axle (UF value, e.g. "8,500lb") |
|
163 | + * @var string $max_weight_per_axle_uf_value |
|
164 | + */ |
|
165 | + public $max_weight_per_axle_uf_value; |
|
166 | + |
|
167 | + /** Fuel consumption city (UF value, e.g. "20.01 mi/l") |
|
168 | + * @var string $fuel_consumption_city_uf_value |
|
169 | + */ |
|
170 | + public $fuel_consumption_city_uf_value; |
|
171 | + |
|
172 | + /** Fuel consumption highway (UF value, e.g. "2,000.01 mpg") |
|
173 | + * @var string $fuel_consumption_highway_uf_value |
|
174 | + */ |
|
175 | + public $fuel_consumption_highway_uf_value; |
|
176 | + |
|
177 | + public static function fromArray(array $params) |
|
178 | + { |
|
179 | + $vehicleProfile = new self(); |
|
180 | + |
|
181 | + foreach ($params as $key => $value) { |
|
182 | + if (is_null(Common::getValue($params, $key))) continue; |
|
183 | + if (property_exists($vehicleProfile, $key)) { |
|
184 | + $vehicleProfile->$key = $value; |
|
185 | + } |
|
186 | + } |
|
187 | + |
|
188 | + return $vehicleProfile; |
|
189 | + } |
|
190 | + |
|
191 | + public function removeVehicleProfile($vehicleProfileId) |
|
192 | + { |
|
193 | + //$vehicleProfileID = isset($params['vehicle_profile_id']) ? $params['vehicle_profile_id'] : null; |
|
194 | + |
|
195 | + $response = Route4Me::makeRequst([ |
|
196 | + 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
197 | + 'method' => 'DELETE', |
|
198 | + 'HTTPHEADER' => 'Content-Type: application/json; Accept: application/json', |
|
199 | + ]); |
|
200 | + |
|
201 | + return $response; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * @param $profileParams - an array from the VehicleParameters object. |
|
206 | + * @return The data including list of the vehicle profiles. |
|
207 | + * @throws \Route4Me\Exception\ApiError |
|
208 | + */ |
|
209 | + public function getVehicleProfiles($profileParams) |
|
210 | + { |
|
211 | + $allQueryFields = ['with_pagination', 'page', 'perPage']; |
|
212 | + |
|
213 | + $response = Route4Me::makeRequst([ |
|
214 | + 'url' => Endpoint::VehicleProfiles, |
|
215 | + 'method' => 'GET', |
|
216 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $profileParams), |
|
217 | + ]); |
|
218 | + |
|
219 | + return $response; |
|
220 | + } |
|
221 | + |
|
222 | + /** |
|
223 | + * @param $profileParams - Vehicle profile body parameters |
|
224 | + * @return Created vehicle profile |
|
225 | + * @throws \Route4Me\Exception\ApiError |
|
226 | + */ |
|
227 | + public function createVehicleProfile($profileParams) |
|
228 | + { |
|
229 | + $excludeFields = []; |
|
230 | + $allBodyFields = Route4Me::getObjectProperties(new VehicleProfile(), $excludeFields); |
|
231 | + |
|
232 | + $response = Route4Me::makeRequst([ |
|
233 | + 'url' => Endpoint::VehicleProfiles, |
|
234 | + 'method' => 'POST', |
|
235 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $profileParams), |
|
236 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
237 | + ]); |
|
238 | + |
|
239 | + return $response; |
|
240 | + } |
|
241 | + |
|
242 | + public function getVehicleProfileById($vehicleProfileId) |
|
243 | + { |
|
244 | + $response = Route4Me::makeRequst([ |
|
245 | + 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
246 | + 'method' => 'GET', |
|
247 | + ]); |
|
248 | + |
|
249 | + return $response; |
|
250 | + } |
|
251 | + |
|
252 | + public function updateVehicleProfile($vehicleProfile) |
|
253 | + { |
|
254 | + $excludeFields = ['vehicle_profile_id', 'deleted_at', 'created_at', 'updated_at']; |
|
255 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
256 | + |
|
257 | + $response = Route4Me::makeRequst([ |
|
258 | + 'url' => Endpoint::VehicleProfiles.'/'.$vehicleProfile['vehicle_profile_id'], |
|
259 | + 'method' => 'PATCH', |
|
260 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleProfile), |
|
261 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
262 | + ]); |
|
263 | + |
|
264 | + return $response; |
|
265 | + } |
|
266 | 266 | |
267 | 267 | } |
268 | 268 | \ No newline at end of file |
@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | class DataVehicle extends Common |
9 | 9 | { |
10 | - /** Reduced vehicle object |
|
11 | - * @var VehicleReduced $vehicle |
|
12 | - */ |
|
13 | - public $vehicle = []; |
|
10 | + /** Reduced vehicle object |
|
11 | + * @var VehicleReduced $vehicle |
|
12 | + */ |
|
13 | + public $vehicle = []; |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -12,27 +12,27 @@ |
||
12 | 12 | */ |
13 | 13 | class VehicleOrderResponse extends Common |
14 | 14 | { |
15 | - /** Vehicle ID |
|
16 | - * @var string $vehicle_id |
|
17 | - */ |
|
18 | - public $vehicle_id; |
|
19 | - |
|
20 | - /** Order ID |
|
21 | - * @var integer $order_id |
|
22 | - */ |
|
23 | - public $order_id; |
|
24 | - |
|
25 | - public static function fromArray(array $params) |
|
26 | - { |
|
27 | - $ordParams = new self(); |
|
28 | - |
|
29 | - foreach ($params as $key => $value) { |
|
30 | - if (is_null(Common::getValue($params, $key))) continue; |
|
31 | - if (property_exists($ordParams, $key)) { |
|
32 | - $ordParams->$key = $value; |
|
33 | - } |
|
34 | - } |
|
35 | - |
|
36 | - return $ordParams; |
|
37 | - } |
|
15 | + /** Vehicle ID |
|
16 | + * @var string $vehicle_id |
|
17 | + */ |
|
18 | + public $vehicle_id; |
|
19 | + |
|
20 | + /** Order ID |
|
21 | + * @var integer $order_id |
|
22 | + */ |
|
23 | + public $order_id; |
|
24 | + |
|
25 | + public static function fromArray(array $params) |
|
26 | + { |
|
27 | + $ordParams = new self(); |
|
28 | + |
|
29 | + foreach ($params as $key => $value) { |
|
30 | + if (is_null(Common::getValue($params, $key))) continue; |
|
31 | + if (property_exists($ordParams, $key)) { |
|
32 | + $ordParams->$key = $value; |
|
33 | + } |
|
34 | + } |
|
35 | + |
|
36 | + return $ordParams; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -12,42 +12,42 @@ |
||
12 | 12 | */ |
13 | 13 | class VehicleTemporary extends Common |
14 | 14 | { |
15 | - /** The vehicle ID |
|
16 | - * @var integer $vehicle_id |
|
17 | - */ |
|
18 | - public $vehicle_id; |
|
19 | - |
|
20 | - /** A license plate of the vehicle. |
|
21 | - * @var string $vehicle_license_plate |
|
22 | - */ |
|
23 | - public $vehicle_license_plate; |
|
24 | - |
|
25 | - /** Member ID assigned to the temporary vehicle. |
|
26 | - * @var string $assigned_member_id |
|
27 | - */ |
|
28 | - public $assigned_member_id; |
|
29 | - |
|
30 | - /** An expiration date of the temporary vehicle. |
|
31 | - * @var string $expires_at |
|
32 | - */ |
|
33 | - public $expires_at; |
|
34 | - |
|
35 | - /** If true, an assignment forced. |
|
36 | - * @var boolean $force_assignment |
|
37 | - */ |
|
38 | - public $force_assignment; |
|
39 | - |
|
40 | - public static function fromArray(array $params) |
|
41 | - { |
|
42 | - $vehicleTemp = new self(); |
|
43 | - |
|
44 | - foreach ($params as $key => $value) { |
|
45 | - if (is_null(Common::getValue($params, $key))) continue; |
|
46 | - if (property_exists($vehicleTemp, $key)) { |
|
47 | - $vehicleTemp->$key = $value; |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - return $vehicleTemp; |
|
52 | - } |
|
15 | + /** The vehicle ID |
|
16 | + * @var integer $vehicle_id |
|
17 | + */ |
|
18 | + public $vehicle_id; |
|
19 | + |
|
20 | + /** A license plate of the vehicle. |
|
21 | + * @var string $vehicle_license_plate |
|
22 | + */ |
|
23 | + public $vehicle_license_plate; |
|
24 | + |
|
25 | + /** Member ID assigned to the temporary vehicle. |
|
26 | + * @var string $assigned_member_id |
|
27 | + */ |
|
28 | + public $assigned_member_id; |
|
29 | + |
|
30 | + /** An expiration date of the temporary vehicle. |
|
31 | + * @var string $expires_at |
|
32 | + */ |
|
33 | + public $expires_at; |
|
34 | + |
|
35 | + /** If true, an assignment forced. |
|
36 | + * @var boolean $force_assignment |
|
37 | + */ |
|
38 | + public $force_assignment; |
|
39 | + |
|
40 | + public static function fromArray(array $params) |
|
41 | + { |
|
42 | + $vehicleTemp = new self(); |
|
43 | + |
|
44 | + foreach ($params as $key => $value) { |
|
45 | + if (is_null(Common::getValue($params, $key))) continue; |
|
46 | + if (property_exists($vehicleTemp, $key)) { |
|
47 | + $vehicleTemp->$key = $value; |
|
48 | + } |
|
49 | + } |
|
50 | + |
|
51 | + return $vehicleTemp; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -18,378 +18,378 @@ |
||
18 | 18 | */ |
19 | 19 | class Vehicle extends Common |
20 | 20 | { |
21 | - /** The vehicle ID |
|
22 | - * @var string $vehicle_id |
|
23 | - */ |
|
24 | - public $vehicle_id; |
|
25 | - |
|
26 | - /** Member ID assigned to the vehicle. |
|
27 | - * @var integer $member_id |
|
28 | - */ |
|
29 | - public $member_id; |
|
30 | - |
|
31 | - /** If true, the vehicle is marked as deleted. |
|
32 | - * @var boolean $is_deleted |
|
33 | - */ |
|
34 | - public $is_deleted; |
|
35 | - |
|
36 | - /** Vehicle alias |
|
37 | - * @var string $vehicle_alias |
|
38 | - */ |
|
39 | - public $vehicle_alias; |
|
40 | - |
|
41 | - /** Vehicle VIN |
|
42 | - * @var string $vehicle_vin |
|
43 | - */ |
|
44 | - public $vehicle_vin; |
|
45 | - |
|
46 | - /** Vehicle registration state ID. |
|
47 | - * @var integer $vehicle_reg_state_id |
|
48 | - */ |
|
49 | - public $vehicle_reg_state_id; |
|
50 | - |
|
51 | - /** Vehicle registration country ID. |
|
52 | - * @var integer $vehicle_reg_country_id |
|
53 | - */ |
|
54 | - public $vehicle_reg_country_id; |
|
55 | - |
|
56 | - /** A license plate of the vehicle. |
|
57 | - * @var string $vehicle_license_plate |
|
58 | - */ |
|
59 | - public $vehicle_license_plate; |
|
60 | - |
|
61 | - /** Vehicle type. |
|
62 | - * <para>Availbale values:</para> |
|
63 | - * sedan', 'suv', 'pickup_truck', 'van', '18wheeler', 'cabin', 'hatchback', |
|
64 | - * '<para>motorcyle', 'waste_disposal', 'tree_cutting', 'bigrig', 'cement_mixer', </para> |
|
65 | - * 'livestock_carrier', 'dairy','tractor_trailer'. |
|
66 | - * @var string $vehicle_type_id |
|
67 | - */ |
|
68 | - public $vehicle_type_id; |
|
69 | - |
|
70 | - /** When the vehicle was added. |
|
71 | - * @var string $timestamp_added |
|
72 | - */ |
|
73 | - public $timestamp_added; |
|
74 | - |
|
75 | - /** Vehicle maker brend. |
|
76 | - * <para>Available values:</para> |
|
77 | - * "american coleman", "bmw", "chevrolet", "ford", "freightliner", "gmc", |
|
78 | - * <para>"hino", "honda", "isuzu", "kenworth", "mack", "mercedes-benz", "mitsubishi", </para> |
|
79 | - * "navistar", "nissan", "peterbilt", "renault", "scania", "sterling", "toyota", |
|
80 | - * <para>"volvo", "western star" </para> |
|
81 | - * </value>" |
|
82 | - * @var string $vehicle_make |
|
83 | - */ |
|
84 | - public $vehicle_make; |
|
85 | - |
|
86 | - /** Vehicle model year |
|
87 | - * @var integer $vehicle_model_year |
|
88 | - */ |
|
89 | - public $vehicle_model_year; |
|
90 | - |
|
91 | - /** Vehicle model |
|
92 | - * @var string $vehicle_model |
|
93 | - */ |
|
94 | - public $vehicle_model; |
|
95 | - |
|
96 | - /** The year, vehicle was acquired |
|
97 | - * @var integer $vehicle_year_acquired |
|
98 | - */ |
|
99 | - public $vehicle_year_acquired; |
|
100 | - |
|
101 | - /** A cost of the new vehicle |
|
102 | - * @var float $vehicle_cost_new |
|
103 | - */ |
|
104 | - public $vehicle_cost_new; |
|
105 | - |
|
106 | - /** If true, the vehicle was purchased new. |
|
107 | - * @var boolean $purchased_new |
|
108 | - */ |
|
109 | - public $purchased_new; |
|
110 | - |
|
111 | - /** Start date of the license |
|
112 | - * @var string $license_start_date |
|
113 | - */ |
|
114 | - public $license_start_date; |
|
115 | - |
|
116 | - /** End date of the license |
|
117 | - * @var string $license_end_date |
|
118 | - */ |
|
119 | - public $license_end_date; |
|
120 | - |
|
121 | - /** If equal to '1', the vehicle is operational. |
|
122 | - * @var boolean $is_operational |
|
123 | - */ |
|
124 | - public $is_operational; |
|
125 | - |
|
126 | - /** A type of the fuel |
|
127 | - * @var string $fuel_type |
|
128 | - * enum: ['unleaded 87','unleaded 89','unleaded 91','unleaded 93','diesel','electric','hybrid'] |
|
129 | - */ |
|
130 | - public $fuel_type; |
|
131 | - |
|
132 | - /** External telematics vehicle IDs |
|
133 | - * @var integer $external_telematics_vehicle_ids |
|
134 | - */ |
|
135 | - public $external_telematics_vehicle_id; |
|
136 | - |
|
137 | - /** When the vehcile was marked as deleted. |
|
138 | - * @var integer $timestamp_removed |
|
139 | - */ |
|
140 | - public $timestamp_removed; |
|
141 | - |
|
142 | - /** Vehicle profile ID |
|
143 | - * @var integer $vehicle_profile_id |
|
144 | - */ |
|
145 | - public $vehicle_profile_id; |
|
146 | - |
|
147 | - /** Fuel consumption city |
|
148 | - * @var float $fuel_consumption_city |
|
149 | - */ |
|
150 | - public $fuel_consumption_city; |
|
151 | - |
|
152 | - /** Fuel consumption in the highway area |
|
153 | - * @var float $fuel_consumption_highway |
|
154 | - */ |
|
155 | - public $fuel_consumption_highway; |
|
156 | - |
|
157 | - /** Fuel consumption units in the city area (e.g. mi/l) |
|
158 | - * @var string $fuel_consumption_city_unit |
|
159 | - */ |
|
160 | - public $fuel_consumption_city_unit; |
|
161 | - |
|
162 | - /** Fuel consumption units in the highway area (e.g. mi/l) |
|
163 | - * @var string $fuel_consumption_highway_unit |
|
164 | - */ |
|
165 | - public $fuel_consumption_highway_unit; |
|
166 | - |
|
167 | - /** Miles per gallon in the city area |
|
168 | - * @var float $mpg_city |
|
169 | - */ |
|
170 | - public $mpg_city; |
|
171 | - |
|
172 | - /** Miles per gallon in the highway area |
|
173 | - * @var float $mpg_highway |
|
174 | - */ |
|
175 | - public $mpg_highway; |
|
176 | - |
|
177 | - /** Fuel consumption UF value in the city area (e.g. '20.01 mi/l') |
|
178 | - * @var string $fuel_consumption_city_uf_value |
|
179 | - */ |
|
180 | - public $fuel_consumption_city_uf_value; |
|
181 | - |
|
182 | - /** Fuel consumption UF value in the highway area (e.g. '2,000.01 mpg') |
|
183 | - * @var string $fuel_consumption_highway_uf_value |
|
184 | - */ |
|
185 | - public $fuel_consumption_highway_uf_value; |
|
186 | - |
|
187 | - public static function fromArray(array $params) |
|
188 | - { |
|
189 | - $vehicle = new self(); |
|
190 | - |
|
191 | - foreach ($params as $key => $value) { |
|
192 | - if (is_null(Common::getValue($params, $key))) continue; |
|
193 | - if (property_exists($vehicle, $key)) { |
|
194 | - $vehicle->$key = $value; |
|
195 | - } |
|
196 | - } |
|
197 | - |
|
198 | - return $vehicle; |
|
199 | - } |
|
200 | - |
|
201 | - public function __construct() |
|
202 | - { |
|
203 | - Route4Me::setBaseUrl(""); |
|
204 | - } |
|
205 | - |
|
206 | - /** Creates a vehicle |
|
207 | - * @param $vehicleParams |
|
208 | - * Returns a vehicle object or failure info. |
|
209 | - */ |
|
210 | - public function createVehicle($vehicleParams) |
|
211 | - { |
|
212 | - $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed']; |
|
213 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
214 | - |
|
215 | - $response = Route4Me::makeRequst([ |
|
216 | - 'url' => Endpoint::Vehicles, |
|
217 | - 'method' => 'POST', |
|
218 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
219 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
220 | - ]); |
|
221 | - |
|
222 | - return $response; |
|
223 | - } |
|
224 | - |
|
225 | - /** Removes a vehicle by specified vehicle ID. |
|
226 | - * @param string $vehicleID - Vehicle ID |
|
227 | - * @return Vehicle object - removed vehicle object. |
|
228 | - * @throws \Route4Me\Exception\ApiError |
|
229 | - */ |
|
230 | - public function removeVehicle($vehicleParams) |
|
231 | - { |
|
232 | - $vehicleId = $vehicleParams['vehicle_id']; |
|
233 | - |
|
234 | - $response = Route4Me::makeRequst([ |
|
235 | - 'url' => Endpoint::Vehicles . '/' . $vehicleId, |
|
236 | - 'method' => 'DELETE', |
|
237 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
238 | - ]); |
|
239 | - |
|
240 | - return $response; |
|
241 | - } |
|
242 | - |
|
243 | - /** Returns the VehiclesPaginated type object containing an array of the vehicles. |
|
244 | - * @param array $params - an array from the VehicleParameters object. |
|
245 | - * @return an array of the Vehicle objects. |
|
246 | - * @throws \Route4Me\Exception\ApiError |
|
247 | - */ |
|
248 | - public function getVehiclesPaginatedList($params) |
|
249 | - { |
|
250 | - $allQueryFields = ['with_pagination', 'page', 'perPage']; |
|
251 | - |
|
252 | - $response = Route4Me::makeRequst([ |
|
253 | - 'url' => Endpoint::Vehicles, |
|
254 | - 'method' => 'GET', |
|
255 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
256 | - ]); |
|
257 | - |
|
258 | - return $response; |
|
259 | - } |
|
260 | - |
|
261 | - /** Creates temporary vehicle in the database. |
|
262 | - * @param $vehicleParams - an array from the VehicleTemporary object. |
|
263 | - * @return an object of the type VehicleTemporary. |
|
264 | - * @throws \Route4Me\Exception\ApiError |
|
265 | - */ |
|
266 | - public function createTemporaryVehicle($vehicleParams) |
|
267 | - { |
|
268 | - $excludeFields = []; |
|
269 | - $allBodyFields = Route4Me::getObjectProperties(new VehicleTemporary(), $excludeFields); |
|
270 | - |
|
271 | - $response = Route4Me::makeRequst([ |
|
272 | - 'url' => Endpoint::VehicleTemporary, |
|
273 | - 'method' => 'POST', |
|
274 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
275 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
276 | - ]); |
|
277 | - |
|
278 | - return $response; |
|
279 | - } |
|
280 | - |
|
281 | - /** Execute a vehicle order. |
|
282 | - * @param $vehicleParams - Vehicle order parameters. |
|
283 | - * @return an object of the type VehicleOrderResponse |
|
284 | - * @throws \Route4Me\Exception\ApiError |
|
285 | - */ |
|
286 | - public function executeVehicleOrder($vehicleParams) |
|
287 | - { |
|
288 | - $excludeFields = []; |
|
289 | - $allBodyFields = Route4Me::getObjectProperties(new VehicleOrderParameters(), $excludeFields); |
|
290 | - |
|
291 | - $response = Route4Me::makeRequst([ |
|
292 | - 'url' => Endpoint::VehicleExecuteOrder, |
|
293 | - 'method' => 'POST', |
|
294 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
295 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
296 | - ]); |
|
297 | - |
|
298 | - return $response; |
|
299 | - } |
|
300 | - |
|
301 | - /** Get latest vehicle locations by specified vehicle IDs. |
|
302 | - * @param $vehicleParams - Vehicle query parameters containing vehicle IDs |
|
303 | - * @return Data with vehicles |
|
304 | - * @throws \Route4Me\Exception\ApiError |
|
305 | - */ |
|
306 | - public function getVehicleLocations($vehicleParams) |
|
307 | - { |
|
308 | - $allQueryFields = ['ids']; |
|
309 | - |
|
310 | - $response = Route4Me::makeRequst([ |
|
311 | - 'url' => Endpoint::VehicleLocation, |
|
312 | - 'method' => 'GET', |
|
313 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams), |
|
314 | - ]); |
|
315 | - |
|
316 | - return $response; |
|
317 | - } |
|
318 | - |
|
319 | - /** Get the Vehicle by specifying vehicle ID. |
|
320 | - * @param $vehicleParams - Vehicle query parameters containing vehicle ID. |
|
321 | - * @return an object of the type Vehicle |
|
322 | - * @throws \Route4Me\Exception\ApiError |
|
323 | - */ |
|
324 | - public function getVehicleById($vehicleParams) |
|
325 | - { |
|
326 | - $allQueryFields = ['vehicle_id']; |
|
327 | - |
|
328 | - $response = Route4Me::makeRequst([ |
|
329 | - 'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'], |
|
330 | - 'method' => 'GET', |
|
331 | - 'query' => null, |
|
332 | - ]); |
|
333 | - |
|
334 | - return $response; |
|
335 | - } |
|
336 | - |
|
337 | - /** Get the Vehicle track by specifying vehicle ID. |
|
338 | - * @param $vehicleParams - Vehicle query parameters containing vehicle ID. |
|
339 | - * @return Vehicle track object |
|
340 | - * @throws \Route4Me\Exception\ApiError |
|
341 | - */ |
|
342 | - public function getVehicleTrack($vehicleParams) |
|
343 | - { |
|
344 | - $response = Route4Me::makeRequst([ |
|
345 | - 'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'].'/track', |
|
346 | - 'method' => 'GET', |
|
347 | - 'query' => null, |
|
348 | - ]); |
|
349 | - |
|
350 | - return $response; |
|
351 | - } |
|
352 | - |
|
353 | - public function getVehicleByLicensePlate($vehicleParams) |
|
354 | - { |
|
355 | - $allQueryFields = ['vehicle_license_plate']; |
|
356 | - |
|
357 | - $response = Route4Me::makeRequst([ |
|
358 | - 'url' => Endpoint::VehicleLicense, |
|
359 | - 'method' => 'GET', |
|
360 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams), |
|
361 | - ]); |
|
362 | - |
|
363 | - return $response; |
|
364 | - } |
|
365 | - |
|
366 | - public function searchVehicles($searchParams) |
|
367 | - { |
|
368 | - $excludeFields = []; |
|
369 | - $allBodyFields = Route4Me::getObjectProperties(new VehicleSearchParameters(), $excludeFields); |
|
370 | - |
|
371 | - $response = Route4Me::makeRequst([ |
|
372 | - 'url' => Endpoint::VehicleSearch, |
|
373 | - 'method' => 'POST', |
|
374 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $searchParams), |
|
375 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
376 | - ]); |
|
377 | - |
|
378 | - return $response; |
|
379 | - } |
|
380 | - |
|
381 | - public function updateVehicle($vehicleParams) |
|
382 | - { |
|
383 | - $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed']; |
|
384 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
385 | - |
|
386 | - $response = Route4Me::makeRequst([ |
|
387 | - 'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'], |
|
388 | - 'method' => 'PATCH', |
|
389 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
390 | - 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
391 | - ]); |
|
392 | - |
|
393 | - return $response; |
|
394 | - } |
|
21 | + /** The vehicle ID |
|
22 | + * @var string $vehicle_id |
|
23 | + */ |
|
24 | + public $vehicle_id; |
|
25 | + |
|
26 | + /** Member ID assigned to the vehicle. |
|
27 | + * @var integer $member_id |
|
28 | + */ |
|
29 | + public $member_id; |
|
30 | + |
|
31 | + /** If true, the vehicle is marked as deleted. |
|
32 | + * @var boolean $is_deleted |
|
33 | + */ |
|
34 | + public $is_deleted; |
|
35 | + |
|
36 | + /** Vehicle alias |
|
37 | + * @var string $vehicle_alias |
|
38 | + */ |
|
39 | + public $vehicle_alias; |
|
40 | + |
|
41 | + /** Vehicle VIN |
|
42 | + * @var string $vehicle_vin |
|
43 | + */ |
|
44 | + public $vehicle_vin; |
|
45 | + |
|
46 | + /** Vehicle registration state ID. |
|
47 | + * @var integer $vehicle_reg_state_id |
|
48 | + */ |
|
49 | + public $vehicle_reg_state_id; |
|
50 | + |
|
51 | + /** Vehicle registration country ID. |
|
52 | + * @var integer $vehicle_reg_country_id |
|
53 | + */ |
|
54 | + public $vehicle_reg_country_id; |
|
55 | + |
|
56 | + /** A license plate of the vehicle. |
|
57 | + * @var string $vehicle_license_plate |
|
58 | + */ |
|
59 | + public $vehicle_license_plate; |
|
60 | + |
|
61 | + /** Vehicle type. |
|
62 | + * <para>Availbale values:</para> |
|
63 | + * sedan', 'suv', 'pickup_truck', 'van', '18wheeler', 'cabin', 'hatchback', |
|
64 | + * '<para>motorcyle', 'waste_disposal', 'tree_cutting', 'bigrig', 'cement_mixer', </para> |
|
65 | + * 'livestock_carrier', 'dairy','tractor_trailer'. |
|
66 | + * @var string $vehicle_type_id |
|
67 | + */ |
|
68 | + public $vehicle_type_id; |
|
69 | + |
|
70 | + /** When the vehicle was added. |
|
71 | + * @var string $timestamp_added |
|
72 | + */ |
|
73 | + public $timestamp_added; |
|
74 | + |
|
75 | + /** Vehicle maker brend. |
|
76 | + * <para>Available values:</para> |
|
77 | + * "american coleman", "bmw", "chevrolet", "ford", "freightliner", "gmc", |
|
78 | + * <para>"hino", "honda", "isuzu", "kenworth", "mack", "mercedes-benz", "mitsubishi", </para> |
|
79 | + * "navistar", "nissan", "peterbilt", "renault", "scania", "sterling", "toyota", |
|
80 | + * <para>"volvo", "western star" </para> |
|
81 | + * </value>" |
|
82 | + * @var string $vehicle_make |
|
83 | + */ |
|
84 | + public $vehicle_make; |
|
85 | + |
|
86 | + /** Vehicle model year |
|
87 | + * @var integer $vehicle_model_year |
|
88 | + */ |
|
89 | + public $vehicle_model_year; |
|
90 | + |
|
91 | + /** Vehicle model |
|
92 | + * @var string $vehicle_model |
|
93 | + */ |
|
94 | + public $vehicle_model; |
|
95 | + |
|
96 | + /** The year, vehicle was acquired |
|
97 | + * @var integer $vehicle_year_acquired |
|
98 | + */ |
|
99 | + public $vehicle_year_acquired; |
|
100 | + |
|
101 | + /** A cost of the new vehicle |
|
102 | + * @var float $vehicle_cost_new |
|
103 | + */ |
|
104 | + public $vehicle_cost_new; |
|
105 | + |
|
106 | + /** If true, the vehicle was purchased new. |
|
107 | + * @var boolean $purchased_new |
|
108 | + */ |
|
109 | + public $purchased_new; |
|
110 | + |
|
111 | + /** Start date of the license |
|
112 | + * @var string $license_start_date |
|
113 | + */ |
|
114 | + public $license_start_date; |
|
115 | + |
|
116 | + /** End date of the license |
|
117 | + * @var string $license_end_date |
|
118 | + */ |
|
119 | + public $license_end_date; |
|
120 | + |
|
121 | + /** If equal to '1', the vehicle is operational. |
|
122 | + * @var boolean $is_operational |
|
123 | + */ |
|
124 | + public $is_operational; |
|
125 | + |
|
126 | + /** A type of the fuel |
|
127 | + * @var string $fuel_type |
|
128 | + * enum: ['unleaded 87','unleaded 89','unleaded 91','unleaded 93','diesel','electric','hybrid'] |
|
129 | + */ |
|
130 | + public $fuel_type; |
|
131 | + |
|
132 | + /** External telematics vehicle IDs |
|
133 | + * @var integer $external_telematics_vehicle_ids |
|
134 | + */ |
|
135 | + public $external_telematics_vehicle_id; |
|
136 | + |
|
137 | + /** When the vehcile was marked as deleted. |
|
138 | + * @var integer $timestamp_removed |
|
139 | + */ |
|
140 | + public $timestamp_removed; |
|
141 | + |
|
142 | + /** Vehicle profile ID |
|
143 | + * @var integer $vehicle_profile_id |
|
144 | + */ |
|
145 | + public $vehicle_profile_id; |
|
146 | + |
|
147 | + /** Fuel consumption city |
|
148 | + * @var float $fuel_consumption_city |
|
149 | + */ |
|
150 | + public $fuel_consumption_city; |
|
151 | + |
|
152 | + /** Fuel consumption in the highway area |
|
153 | + * @var float $fuel_consumption_highway |
|
154 | + */ |
|
155 | + public $fuel_consumption_highway; |
|
156 | + |
|
157 | + /** Fuel consumption units in the city area (e.g. mi/l) |
|
158 | + * @var string $fuel_consumption_city_unit |
|
159 | + */ |
|
160 | + public $fuel_consumption_city_unit; |
|
161 | + |
|
162 | + /** Fuel consumption units in the highway area (e.g. mi/l) |
|
163 | + * @var string $fuel_consumption_highway_unit |
|
164 | + */ |
|
165 | + public $fuel_consumption_highway_unit; |
|
166 | + |
|
167 | + /** Miles per gallon in the city area |
|
168 | + * @var float $mpg_city |
|
169 | + */ |
|
170 | + public $mpg_city; |
|
171 | + |
|
172 | + /** Miles per gallon in the highway area |
|
173 | + * @var float $mpg_highway |
|
174 | + */ |
|
175 | + public $mpg_highway; |
|
176 | + |
|
177 | + /** Fuel consumption UF value in the city area (e.g. '20.01 mi/l') |
|
178 | + * @var string $fuel_consumption_city_uf_value |
|
179 | + */ |
|
180 | + public $fuel_consumption_city_uf_value; |
|
181 | + |
|
182 | + /** Fuel consumption UF value in the highway area (e.g. '2,000.01 mpg') |
|
183 | + * @var string $fuel_consumption_highway_uf_value |
|
184 | + */ |
|
185 | + public $fuel_consumption_highway_uf_value; |
|
186 | + |
|
187 | + public static function fromArray(array $params) |
|
188 | + { |
|
189 | + $vehicle = new self(); |
|
190 | + |
|
191 | + foreach ($params as $key => $value) { |
|
192 | + if (is_null(Common::getValue($params, $key))) continue; |
|
193 | + if (property_exists($vehicle, $key)) { |
|
194 | + $vehicle->$key = $value; |
|
195 | + } |
|
196 | + } |
|
197 | + |
|
198 | + return $vehicle; |
|
199 | + } |
|
200 | + |
|
201 | + public function __construct() |
|
202 | + { |
|
203 | + Route4Me::setBaseUrl(""); |
|
204 | + } |
|
205 | + |
|
206 | + /** Creates a vehicle |
|
207 | + * @param $vehicleParams |
|
208 | + * Returns a vehicle object or failure info. |
|
209 | + */ |
|
210 | + public function createVehicle($vehicleParams) |
|
211 | + { |
|
212 | + $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed']; |
|
213 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
214 | + |
|
215 | + $response = Route4Me::makeRequst([ |
|
216 | + 'url' => Endpoint::Vehicles, |
|
217 | + 'method' => 'POST', |
|
218 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
219 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
220 | + ]); |
|
221 | + |
|
222 | + return $response; |
|
223 | + } |
|
224 | + |
|
225 | + /** Removes a vehicle by specified vehicle ID. |
|
226 | + * @param string $vehicleID - Vehicle ID |
|
227 | + * @return Vehicle object - removed vehicle object. |
|
228 | + * @throws \Route4Me\Exception\ApiError |
|
229 | + */ |
|
230 | + public function removeVehicle($vehicleParams) |
|
231 | + { |
|
232 | + $vehicleId = $vehicleParams['vehicle_id']; |
|
233 | + |
|
234 | + $response = Route4Me::makeRequst([ |
|
235 | + 'url' => Endpoint::Vehicles . '/' . $vehicleId, |
|
236 | + 'method' => 'DELETE', |
|
237 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
238 | + ]); |
|
239 | + |
|
240 | + return $response; |
|
241 | + } |
|
242 | + |
|
243 | + /** Returns the VehiclesPaginated type object containing an array of the vehicles. |
|
244 | + * @param array $params - an array from the VehicleParameters object. |
|
245 | + * @return an array of the Vehicle objects. |
|
246 | + * @throws \Route4Me\Exception\ApiError |
|
247 | + */ |
|
248 | + public function getVehiclesPaginatedList($params) |
|
249 | + { |
|
250 | + $allQueryFields = ['with_pagination', 'page', 'perPage']; |
|
251 | + |
|
252 | + $response = Route4Me::makeRequst([ |
|
253 | + 'url' => Endpoint::Vehicles, |
|
254 | + 'method' => 'GET', |
|
255 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
256 | + ]); |
|
257 | + |
|
258 | + return $response; |
|
259 | + } |
|
260 | + |
|
261 | + /** Creates temporary vehicle in the database. |
|
262 | + * @param $vehicleParams - an array from the VehicleTemporary object. |
|
263 | + * @return an object of the type VehicleTemporary. |
|
264 | + * @throws \Route4Me\Exception\ApiError |
|
265 | + */ |
|
266 | + public function createTemporaryVehicle($vehicleParams) |
|
267 | + { |
|
268 | + $excludeFields = []; |
|
269 | + $allBodyFields = Route4Me::getObjectProperties(new VehicleTemporary(), $excludeFields); |
|
270 | + |
|
271 | + $response = Route4Me::makeRequst([ |
|
272 | + 'url' => Endpoint::VehicleTemporary, |
|
273 | + 'method' => 'POST', |
|
274 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
275 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
276 | + ]); |
|
277 | + |
|
278 | + return $response; |
|
279 | + } |
|
280 | + |
|
281 | + /** Execute a vehicle order. |
|
282 | + * @param $vehicleParams - Vehicle order parameters. |
|
283 | + * @return an object of the type VehicleOrderResponse |
|
284 | + * @throws \Route4Me\Exception\ApiError |
|
285 | + */ |
|
286 | + public function executeVehicleOrder($vehicleParams) |
|
287 | + { |
|
288 | + $excludeFields = []; |
|
289 | + $allBodyFields = Route4Me::getObjectProperties(new VehicleOrderParameters(), $excludeFields); |
|
290 | + |
|
291 | + $response = Route4Me::makeRequst([ |
|
292 | + 'url' => Endpoint::VehicleExecuteOrder, |
|
293 | + 'method' => 'POST', |
|
294 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
295 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
296 | + ]); |
|
297 | + |
|
298 | + return $response; |
|
299 | + } |
|
300 | + |
|
301 | + /** Get latest vehicle locations by specified vehicle IDs. |
|
302 | + * @param $vehicleParams - Vehicle query parameters containing vehicle IDs |
|
303 | + * @return Data with vehicles |
|
304 | + * @throws \Route4Me\Exception\ApiError |
|
305 | + */ |
|
306 | + public function getVehicleLocations($vehicleParams) |
|
307 | + { |
|
308 | + $allQueryFields = ['ids']; |
|
309 | + |
|
310 | + $response = Route4Me::makeRequst([ |
|
311 | + 'url' => Endpoint::VehicleLocation, |
|
312 | + 'method' => 'GET', |
|
313 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams), |
|
314 | + ]); |
|
315 | + |
|
316 | + return $response; |
|
317 | + } |
|
318 | + |
|
319 | + /** Get the Vehicle by specifying vehicle ID. |
|
320 | + * @param $vehicleParams - Vehicle query parameters containing vehicle ID. |
|
321 | + * @return an object of the type Vehicle |
|
322 | + * @throws \Route4Me\Exception\ApiError |
|
323 | + */ |
|
324 | + public function getVehicleById($vehicleParams) |
|
325 | + { |
|
326 | + $allQueryFields = ['vehicle_id']; |
|
327 | + |
|
328 | + $response = Route4Me::makeRequst([ |
|
329 | + 'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'], |
|
330 | + 'method' => 'GET', |
|
331 | + 'query' => null, |
|
332 | + ]); |
|
333 | + |
|
334 | + return $response; |
|
335 | + } |
|
336 | + |
|
337 | + /** Get the Vehicle track by specifying vehicle ID. |
|
338 | + * @param $vehicleParams - Vehicle query parameters containing vehicle ID. |
|
339 | + * @return Vehicle track object |
|
340 | + * @throws \Route4Me\Exception\ApiError |
|
341 | + */ |
|
342 | + public function getVehicleTrack($vehicleParams) |
|
343 | + { |
|
344 | + $response = Route4Me::makeRequst([ |
|
345 | + 'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'].'/track', |
|
346 | + 'method' => 'GET', |
|
347 | + 'query' => null, |
|
348 | + ]); |
|
349 | + |
|
350 | + return $response; |
|
351 | + } |
|
352 | + |
|
353 | + public function getVehicleByLicensePlate($vehicleParams) |
|
354 | + { |
|
355 | + $allQueryFields = ['vehicle_license_plate']; |
|
356 | + |
|
357 | + $response = Route4Me::makeRequst([ |
|
358 | + 'url' => Endpoint::VehicleLicense, |
|
359 | + 'method' => 'GET', |
|
360 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams), |
|
361 | + ]); |
|
362 | + |
|
363 | + return $response; |
|
364 | + } |
|
365 | + |
|
366 | + public function searchVehicles($searchParams) |
|
367 | + { |
|
368 | + $excludeFields = []; |
|
369 | + $allBodyFields = Route4Me::getObjectProperties(new VehicleSearchParameters(), $excludeFields); |
|
370 | + |
|
371 | + $response = Route4Me::makeRequst([ |
|
372 | + 'url' => Endpoint::VehicleSearch, |
|
373 | + 'method' => 'POST', |
|
374 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $searchParams), |
|
375 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
376 | + ]); |
|
377 | + |
|
378 | + return $response; |
|
379 | + } |
|
380 | + |
|
381 | + public function updateVehicle($vehicleParams) |
|
382 | + { |
|
383 | + $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed']; |
|
384 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
385 | + |
|
386 | + $response = Route4Me::makeRequst([ |
|
387 | + 'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'], |
|
388 | + 'method' => 'PATCH', |
|
389 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams), |
|
390 | + 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
|
391 | + ]); |
|
392 | + |
|
393 | + return $response; |
|
394 | + } |
|
395 | 395 | } |
396 | 396 | \ No newline at end of file |