| @@ 147-170 (lines=24) @@ | ||
| 144 | return $response; |
|
| 145 | } |
|
| 146 | ||
| 147 | public function createVehicle($params) |
|
| 148 | { |
|
| 149 | $body = array(); |
|
| 150 | ||
| 151 | $vehicle= new Vehicle(); |
|
| 152 | ||
| 153 | foreach($params as $key => $value) { |
|
| 154 | if ($key=="vehicle_id") continue; |
|
| 155 | if (property_exists($vehicle, $key)) { |
|
| 156 | if (isset($params->{$key})) { |
|
| 157 | $body[$key] = $params->{$key}; |
|
| 158 | } |
|
| 159 | } |
|
| 160 | } |
|
| 161 | ||
| 162 | $response = Route4Me::makeRequst(array( |
|
| 163 | 'url' => Endpoint::VEHICLE_V4, |
|
| 164 | 'method' => 'POST', |
|
| 165 | 'body' => $body, |
|
| 166 | 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 167 | )); |
|
| 168 | ||
| 169 | return $response; |
|
| 170 | } |
|
| 171 | ||
| 172 | public function removeVehicle($params) |
|
| 173 | { |
|
| @@ 149-170 (lines=22) @@ | ||
| 146 | /** |
|
| 147 | * @param AddressBookLocation $params |
|
| 148 | */ |
|
| 149 | public static function addAdressBookLocation($params) |
|
| 150 | { |
|
| 151 | $body = array(); |
|
| 152 | $abLocations = new AddressBookLocation(); |
|
| 153 | ||
| 154 | foreach ($params as $key => $value) { |
|
| 155 | if ($key=="address_id") { |
|
| 156 | continue; |
|
| 157 | } |
|
| 158 | ||
| 159 | if (property_exists($abLocations, $key)) { |
|
| 160 | if (isset($params->{$key})) { |
|
| 161 | $body[$key] = $params->{$key}; |
|
| 162 | } |
|
| 163 | } |
|
| 164 | } |
|
| 165 | ||
| 166 | $response = Route4Me::makeRequst(array( |
|
| 167 | 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
| 168 | 'method' => 'POST', |
|
| 169 | 'body' => $body |
|
| 170 | )); |
|
| 171 | ||
| 172 | return $response; |
|
| 173 | } |
|
| @@ 188-208 (lines=21) @@ | ||
| 185 | return $result; |
|
| 186 | } |
|
| 187 | ||
| 188 | public function updateAdressBookLocation($params) |
|
| 189 | { |
|
| 190 | $body = array(); |
|
| 191 | $abLocations = new AddressBookLocation(); |
|
| 192 | ||
| 193 | foreach ($params as $key => $value) { |
|
| 194 | if (property_exists($abLocations, $key)) { |
|
| 195 | if (isset($params->{$key})) { |
|
| 196 | $body[$key] = $params->{$key}; |
|
| 197 | } |
|
| 198 | } |
|
| 199 | } |
|
| 200 | ||
| 201 | $response = Route4Me::makeRequst(array( |
|
| 202 | 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
| 203 | 'method' => 'PUT', |
|
| 204 | 'body' => $body, |
|
| 205 | )); |
|
| 206 | ||
| 207 | return $response; |
|
| 208 | } |
|
| 209 | ||
| 210 | public static function get($params) |
|
| 211 | { |
|