@@ -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 |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | //$vehicleProfileID = isset($params['vehicle_profile_id']) ? $params['vehicle_profile_id'] : null; |
| 194 | 194 | |
| 195 | 195 | $response = Route4Me::makeRequst([ |
| 196 | - 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
| 196 | + 'url' => Endpoint::VehicleProfiles.'/'.$vehicleProfileId, |
|
| 197 | 197 | 'method' => 'DELETE', |
| 198 | 198 | 'HTTPHEADER' => 'Content-Type: application/json; Accept: application/json', |
| 199 | 199 | ]); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | public function getVehicleProfileById($vehicleProfileId) |
| 243 | 243 | { |
| 244 | 244 | $response = Route4Me::makeRequst([ |
| 245 | - 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
| 245 | + 'url' => Endpoint::VehicleProfiles.'/'.$vehicleProfileId, |
|
| 246 | 246 | 'method' => 'GET', |
| 247 | 247 | ]); |
| 248 | 248 | |
@@ -179,7 +179,9 @@ |
||
| 179 | 179 | $vehicleProfile = new self(); |
| 180 | 180 | |
| 181 | 181 | foreach ($params as $key => $value) { |
| 182 | - if (is_null(Common::getValue($params, $key))) continue; |
|
| 182 | + if (is_null(Common::getValue($params, $key))) { |
|
| 183 | + continue; |
|
| 184 | + } |
|
| 183 | 185 | if (property_exists($vehicleProfile, $key)) { |
| 184 | 186 | $vehicleProfile->$key = $value; |
| 185 | 187 | } |
@@ -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 |
@@ -27,7 +27,9 @@ |
||
| 27 | 27 | $ordParams = new self(); |
| 28 | 28 | |
| 29 | 29 | foreach ($params as $key => $value) { |
| 30 | - if (is_null(Common::getValue($params, $key))) continue; |
|
| 30 | + if (is_null(Common::getValue($params, $key))) { |
|
| 31 | + continue; |
|
| 32 | + } |
|
| 31 | 33 | if (property_exists($ordParams, $key)) { |
| 32 | 34 | $ordParams->$key = $value; |
| 33 | 35 | } |
@@ -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 |
@@ -42,7 +42,9 @@ |
||
| 42 | 42 | $vehicleTemp = new self(); |
| 43 | 43 | |
| 44 | 44 | foreach ($params as $key => $value) { |
| 45 | - if (is_null(Common::getValue($params, $key))) continue; |
|
| 45 | + if (is_null(Common::getValue($params, $key))) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | if (property_exists($vehicleTemp, $key)) { |
| 47 | 49 | $vehicleTemp->$key = $value; |
| 48 | 50 | } |
@@ -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 |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | $vehicleId = $vehicleParams['vehicle_id']; |
| 233 | 233 | |
| 234 | 234 | $response = Route4Me::makeRequst([ |
| 235 | - 'url' => Endpoint::Vehicles . '/' . $vehicleId, |
|
| 235 | + 'url' => Endpoint::Vehicles.'/'.$vehicleId, |
|
| 236 | 236 | 'method' => 'DELETE', |
| 237 | 237 | 'HTTPHEADER' => Constants::DEFAULT_HTTP_HEADER, |
| 238 | 238 | ]); |
@@ -189,7 +189,9 @@ |
||
| 189 | 189 | $vehicle = new self(); |
| 190 | 190 | |
| 191 | 191 | foreach ($params as $key => $value) { |
| 192 | - if (is_null(Common::getValue($params, $key))) continue; |
|
| 192 | + if (is_null(Common::getValue($params, $key))) { |
|
| 193 | + continue; |
|
| 194 | + } |
|
| 193 | 195 | if (property_exists($vehicle, $key)) { |
| 194 | 196 | $vehicle->$key = $value; |
| 195 | 197 | } |
@@ -9,46 +9,46 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class AccountProfile extends Common |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Account profile email |
|
| 14 | - * @var type string |
|
| 15 | - */ |
|
| 16 | - public $email; |
|
| 12 | + /** |
|
| 13 | + * Account profile email |
|
| 14 | + * @var type string |
|
| 15 | + */ |
|
| 16 | + public $email; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Account member ID |
|
| 20 | - * @var type integer |
|
| 21 | - */ |
|
| 22 | - public $member_id; |
|
| 18 | + /** |
|
| 19 | + * Account member ID |
|
| 20 | + * @var type integer |
|
| 21 | + */ |
|
| 22 | + public $member_id; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Account API key |
|
| 26 | - * @var type string |
|
| 27 | - */ |
|
| 28 | - public $api_key; |
|
| 24 | + /** |
|
| 25 | + * Account API key |
|
| 26 | + * @var type string |
|
| 27 | + */ |
|
| 28 | + public $api_key; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Account root member ID |
|
| 32 | - * @var type integer |
|
| 33 | - */ |
|
| 34 | - public $root_member_id; |
|
| 30 | + /** |
|
| 31 | + * Account root member ID |
|
| 32 | + * @var type integer |
|
| 33 | + */ |
|
| 34 | + public $root_member_id; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Preferred units of the account. |
|
| 38 | - * @var type string |
|
| 39 | - */ |
|
| 40 | - public $preferred_units; |
|
| 36 | + /** |
|
| 37 | + * Preferred units of the account. |
|
| 38 | + * @var type string |
|
| 39 | + */ |
|
| 40 | + public $preferred_units; |
|
| 41 | 41 | |
| 42 | - public static function fromArray(array $params) |
|
| 43 | - { |
|
| 44 | - $thisParams = new self(); |
|
| 42 | + public static function fromArray(array $params) |
|
| 43 | + { |
|
| 44 | + $thisParams = new self(); |
|
| 45 | 45 | |
| 46 | - foreach ($params as $key => $value) { |
|
| 47 | - if (property_exists($thisParams, $key)) { |
|
| 48 | - $thisParams->{$key} = $value; |
|
| 49 | - } |
|
| 50 | - } |
|
| 46 | + foreach ($params as $key => $value) { |
|
| 47 | + if (property_exists($thisParams, $key)) { |
|
| 48 | + $thisParams->{$key} = $value; |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - return $thisParams; |
|
| 53 | - } |
|
| 52 | + return $thisParams; |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | class TelematicsVendorFeature extends Common |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Feature ID |
|
| 14 | - * @var type string |
|
| 15 | - */ |
|
| 12 | + /** |
|
| 13 | + * Feature ID |
|
| 14 | + * @var type string |
|
| 15 | + */ |
|
| 16 | 16 | public $id; |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public $feature_group; |
| 35 | 35 | |
| 36 | - public static function fromArray(array $params) |
|
| 37 | - { |
|
| 38 | - $thisParams = new self(); |
|
| 36 | + public static function fromArray(array $params) |
|
| 37 | + { |
|
| 38 | + $thisParams = new self(); |
|
| 39 | 39 | |
| 40 | - foreach ($params as $key => $value) { |
|
| 41 | - if (property_exists($thisParams, $key)) { |
|
| 42 | - $thisParams->{$key} = $value; |
|
| 43 | - } |
|
| 44 | - } |
|
| 40 | + foreach ($params as $key => $value) { |
|
| 41 | + if (property_exists($thisParams, $key)) { |
|
| 42 | + $thisParams->{$key} = $value; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $thisParams; |
|
| 47 | - } |
|
| 46 | + return $thisParams; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -6,33 +6,33 @@ |
||
| 6 | 6 | |
| 7 | 7 | class DataObjectBase extends \Route4Me\Common |
| 8 | 8 | { |
| 9 | - /** @var string $optimization_problem_id |
|
| 10 | - * Optimization problem ID |
|
| 11 | - */ |
|
| 12 | - public $optimization_problem_id; |
|
| 13 | - |
|
| 14 | - /** @var string $smart_optimization_id |
|
| 15 | - * Smart Optimization Problem ID |
|
| 16 | - */ |
|
| 17 | - public $smart_optimization_id; |
|
| 18 | - |
|
| 19 | - /** @var long $created_timestamp |
|
| 20 | - * When the optimization problem was created. |
|
| 21 | - */ |
|
| 22 | - public $created_timestamp; |
|
| 23 | - |
|
| 24 | - /** @var RouteParameters $parameters |
|
| 25 | - * Route Parameters. |
|
| 26 | - */ |
|
| 27 | - public $parameters = []; |
|
| 28 | - |
|
| 29 | - /** @var Address[] $addresses |
|
| 30 | - * An array ot the Address type objects. |
|
| 31 | - */ |
|
| 32 | - public $addresses = []; |
|
| 33 | - |
|
| 34 | - /** @var string[] $links |
|
| 35 | - * The links to the GET operations for the optimization problem. |
|
| 36 | - */ |
|
| 37 | - public $links = []; |
|
| 9 | + /** @var string $optimization_problem_id |
|
| 10 | + * Optimization problem ID |
|
| 11 | + */ |
|
| 12 | + public $optimization_problem_id; |
|
| 13 | + |
|
| 14 | + /** @var string $smart_optimization_id |
|
| 15 | + * Smart Optimization Problem ID |
|
| 16 | + */ |
|
| 17 | + public $smart_optimization_id; |
|
| 18 | + |
|
| 19 | + /** @var long $created_timestamp |
|
| 20 | + * When the optimization problem was created. |
|
| 21 | + */ |
|
| 22 | + public $created_timestamp; |
|
| 23 | + |
|
| 24 | + /** @var RouteParameters $parameters |
|
| 25 | + * Route Parameters. |
|
| 26 | + */ |
|
| 27 | + public $parameters = []; |
|
| 28 | + |
|
| 29 | + /** @var Address[] $addresses |
|
| 30 | + * An array ot the Address type objects. |
|
| 31 | + */ |
|
| 32 | + public $addresses = []; |
|
| 33 | + |
|
| 34 | + /** @var string[] $links |
|
| 35 | + * The links to the GET operations for the optimization problem. |
|
| 36 | + */ |
|
| 37 | + public $links = []; |
|
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -9,101 +9,101 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class ScheduleCalendarParameters extends Common |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Start date to filter the schedules in the string format<br> |
|
| 14 | - * (e.g. 2020-10-27). |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - public $date_from_string; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * End date to filter the schedules in the string format<br> |
|
| 21 | - * (e.g. 2020-10-30). |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $date_to_string; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Member ID |
|
| 28 | - * @var integer |
|
| 29 | - */ |
|
| 30 | - public $member_id; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Timezone offset (in minutes)<br> |
|
| 34 | - * (e.g. NYT: -4*60 = -480, Kiev: 3*60 = 180). |
|
| 35 | - * @var integer |
|
| 36 | - */ |
|
| 37 | - public $timezone_offset_minutes; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * If true, the scheduled orders are included in the calendar. |
|
| 41 | - * @var Boolean |
|
| 42 | - */ |
|
| 43 | - public $orders; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * If true, the scheduled address book contacts |
|
| 47 | - * are included in the calendar. |
|
| 48 | - * @var Boolean |
|
| 49 | - */ |
|
| 50 | - public $ab; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * If true, the scheduled routes are included in the calendar. |
|
| 54 | - * @var Boolean |
|
| 55 | - */ |
|
| 56 | - public $routes_count; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Class constructor. |
|
| 60 | - * @var |
|
| 61 | - */ |
|
| 62 | - public function __construct() |
|
| 63 | - { |
|
| 64 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Convert an array to this object |
|
| 69 | - */ |
|
| 70 | - public static function fromArray(array $params) |
|
| 71 | - { |
|
| 72 | - $scheduleCalendarParameters = new self(); |
|
| 73 | - |
|
| 74 | - foreach ($params as $key => $value) { |
|
| 75 | - if (property_exists($scheduleCalendarParameters, $key)) { |
|
| 76 | - $scheduleCalendarParameters->{$key} = $value; |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - return $scheduleCalendarParameters; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - public function setTimezoneOffsetMinutes($tz) |
|
| 84 | - { |
|
| 85 | - $this->timezone_offset_minutes = -$tz; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - public function getTimezoneOffsetMinutes() |
|
| 89 | - { |
|
| 90 | - if (is_numeric($this->timezone_offset_minutes)) { |
|
| 91 | - return -$this->timezone_offset_minutes; |
|
| 92 | - } else { |
|
| 93 | - return 0; |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - public function getScheduleCalendar($params) |
|
| 98 | - { |
|
| 99 | - $allQueryFields = ['date_from_string', 'date_to_string', 'member_id', 'timezone_offset_minutes', 'orders', 'ab', 'routes_count']; |
|
| 100 | - |
|
| 101 | - $schedCalendar = Route4Me::makeRequst([ |
|
| 102 | - 'url' => Endpoint::SCHEDULE_CALENDAR, |
|
| 103 | - 'method' => 'GET', |
|
| 104 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 105 | - ]); |
|
| 106 | - |
|
| 107 | - return $schedCalendar; |
|
| 108 | - } |
|
| 12 | + /** |
|
| 13 | + * Start date to filter the schedules in the string format<br> |
|
| 14 | + * (e.g. 2020-10-27). |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + public $date_from_string; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * End date to filter the schedules in the string format<br> |
|
| 21 | + * (e.g. 2020-10-30). |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $date_to_string; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Member ID |
|
| 28 | + * @var integer |
|
| 29 | + */ |
|
| 30 | + public $member_id; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Timezone offset (in minutes)<br> |
|
| 34 | + * (e.g. NYT: -4*60 = -480, Kiev: 3*60 = 180). |
|
| 35 | + * @var integer |
|
| 36 | + */ |
|
| 37 | + public $timezone_offset_minutes; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * If true, the scheduled orders are included in the calendar. |
|
| 41 | + * @var Boolean |
|
| 42 | + */ |
|
| 43 | + public $orders; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * If true, the scheduled address book contacts |
|
| 47 | + * are included in the calendar. |
|
| 48 | + * @var Boolean |
|
| 49 | + */ |
|
| 50 | + public $ab; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * If true, the scheduled routes are included in the calendar. |
|
| 54 | + * @var Boolean |
|
| 55 | + */ |
|
| 56 | + public $routes_count; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Class constructor. |
|
| 60 | + * @var |
|
| 61 | + */ |
|
| 62 | + public function __construct() |
|
| 63 | + { |
|
| 64 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Convert an array to this object |
|
| 69 | + */ |
|
| 70 | + public static function fromArray(array $params) |
|
| 71 | + { |
|
| 72 | + $scheduleCalendarParameters = new self(); |
|
| 73 | + |
|
| 74 | + foreach ($params as $key => $value) { |
|
| 75 | + if (property_exists($scheduleCalendarParameters, $key)) { |
|
| 76 | + $scheduleCalendarParameters->{$key} = $value; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + return $scheduleCalendarParameters; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + public function setTimezoneOffsetMinutes($tz) |
|
| 84 | + { |
|
| 85 | + $this->timezone_offset_minutes = -$tz; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + public function getTimezoneOffsetMinutes() |
|
| 89 | + { |
|
| 90 | + if (is_numeric($this->timezone_offset_minutes)) { |
|
| 91 | + return -$this->timezone_offset_minutes; |
|
| 92 | + } else { |
|
| 93 | + return 0; |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + public function getScheduleCalendar($params) |
|
| 98 | + { |
|
| 99 | + $allQueryFields = ['date_from_string', 'date_to_string', 'member_id', 'timezone_offset_minutes', 'orders', 'ab', 'routes_count']; |
|
| 100 | + |
|
| 101 | + $schedCalendar = Route4Me::makeRequst([ |
|
| 102 | + 'url' => Endpoint::SCHEDULE_CALENDAR, |
|
| 103 | + 'method' => 'GET', |
|
| 104 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 105 | + ]); |
|
| 106 | + |
|
| 107 | + return $schedCalendar; |
|
| 108 | + } |
|
| 109 | 109 | } |
| 110 | 110 | \ No newline at end of file |