@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 12 | 12 | |
| 13 | 13 | $geocodingParameters = array( |
| 14 | - 'format' => 'xml', |
|
| 15 | - 'addresses' => '42.35863,-71.05670' |
|
| 14 | + 'format' => 'xml', |
|
| 15 | + 'addresses' => '42.35863,-71.05670' |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | $fGeoCoding = new Geocoding(); |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | $fgResult = $fGeoCoding->reverseGeocoding($geocodingParameters); |
| 21 | 21 | |
| 22 | 22 | if ($geocodingParameters['format']=='json') { |
| 23 | - foreach ($fgResult as $dest) { |
|
| 24 | - Route4Me::simplePrint($dest); |
|
| 25 | - echo "<br>"; |
|
| 26 | - } |
|
| 23 | + foreach ($fgResult as $dest) { |
|
| 24 | + Route4Me::simplePrint($dest); |
|
| 25 | + echo "<br>"; |
|
| 26 | + } |
|
| 27 | 27 | } else { |
| 28 | - foreach ($fgResult['destination'] as $dest) { |
|
| 29 | - Route4Me::simplePrint($dest); |
|
| 30 | - echo "<br>"; |
|
| 31 | - } |
|
| 28 | + foreach ($fgResult['destination'] as $dest) { |
|
| 29 | + Route4Me::simplePrint($dest); |
|
| 30 | + echo "<br>"; |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | |
| 19 | 19 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
| 20 | 20 | $territoryParams['data'] = array( |
| 21 | - "37.569752822786455,-77.47833251953125", |
|
| 22 | - "5000" |
|
| 21 | + "37.569752822786455,-77.47833251953125", |
|
| 22 | + "5000" |
|
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | $AvoisanceZoneParameters = AvoidanceZone::fromArray(array( |
| 26 | - "territory_name" => "Test Territory ".strval(rand(10000, 99999)), |
|
| 27 | - "territory_color" => "ff7700", |
|
| 28 | - "territory" => $territoryParams |
|
| 26 | + "territory_name" => "Test Territory ".strval(rand(10000, 99999)), |
|
| 27 | + "territory_color" => "ff7700", |
|
| 28 | + "territory" => $territoryParams |
|
| 29 | 29 | )); |
| 30 | 30 | |
| 31 | 31 | $avoidancezone = new AvoidanceZone(); |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $route = new Route(); |
| 17 | 17 | |
| 18 | 18 | $grParams = array( |
| 19 | - 'offset' => 0, |
|
| 20 | - 'limit' => 10 |
|
| 19 | + 'offset' => 0, |
|
| 20 | + 'limit' => 10 |
|
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | $routes = $route->getRoutes($grParams); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | echo "<br> From the route -> ".$route_id0."<br>"; |
| 33 | 33 | |
| 34 | 34 | if (is_null($route_id0)) { |
| 35 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | - return; |
|
| 35 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | + return; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Get random source destination from selected source route above |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | $to_route_id = $route_id0; |
| 49 | 49 | |
| 50 | 50 | while ($to_route_id==$route_id0) { |
| 51 | - $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
| 51 | + $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | echo "<br> to the route -> ".$to_route_id."<br>"; |
| 55 | 55 | |
| 56 | 56 | if (is_null($to_route_id)) { |
| 57 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | - return; |
|
| 57 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | + return; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Get random destination destination from selected source route above |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | $after_destination_id = $addressRand2['route_destination_id']; |
| 65 | 65 | |
| 66 | 66 | if (is_null($after_destination_id)) { |
| 67 | - echo "can't retrieve random address!.. Try again."; |
|
| 68 | - return; |
|
| 67 | + echo "can't retrieve random address!.. Try again."; |
|
| 68 | + return; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | echo "after_destination_id = $after_destination_id <br>"; |
| 72 | 72 | |
| 73 | 73 | // Move the destination to the route |
| 74 | 74 | $routeparams = array( |
| 75 | - 'to_route_id' => $to_route_id, |
|
| 76 | - 'route_destination_id' => strval($route_destination_id), |
|
| 77 | - 'after_destination_id' => strval($after_destination_id) |
|
| 75 | + 'to_route_id' => $to_route_id, |
|
| 76 | + 'route_destination_id' => strval($route_destination_id), |
|
| 77 | + 'after_destination_id' => strval($after_destination_id) |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | $address = new Address(); |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | assert(!is_null($addressRand), "Can't retrieve random address"); |
| 28 | 28 | |
| 29 | 29 | if (isset($addressRand['is_depot'])) { |
| 30 | - if ($addressRand['is_depot']) { |
|
| 31 | - echo "This address is depot!.. Try again."; |
|
| 32 | - return; |
|
| 33 | - } |
|
| 30 | + if ($addressRand['is_depot']) { |
|
| 31 | + echo "This address is depot!.. Try again."; |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $route_destination_id = $addressRand['route_destination_id']; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Remove the destination from the optimization |
| 41 | 41 | $params = array( |
| 42 | - "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | - "route_destination_id" => $route_destination_id |
|
| 42 | + "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | + "route_destination_id" => $route_destination_id |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | $result = $optimization->removeAddress($params); |
@@ -11,236 +11,236 @@ |
||
| 11 | 11 | |
| 12 | 12 | class OptimizationProblem extends Common |
| 13 | 13 | { |
| 14 | - public $optimization_problem_id; |
|
| 15 | - public $user_errors = array(); |
|
| 16 | - public $state; |
|
| 17 | - public $optimization_errors = array(); |
|
| 18 | - public $parameters; |
|
| 19 | - public $sent_to_background; |
|
| 20 | - public $created_timestamp; |
|
| 21 | - public $scheduled_for; |
|
| 22 | - public $optimization_completed_timestamp; |
|
| 23 | - public $addresses = array(); |
|
| 24 | - public $routes = array(); |
|
| 25 | - public $links = array(); |
|
| 26 | - |
|
| 27 | - function __construct() |
|
| 28 | - { |
|
| 29 | - $this->parameters = new RouteParameters; |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - public static function fromArray(array $params) |
|
| 33 | - { |
|
| 34 | - $problem = new OptimizationProblem; |
|
| 35 | - $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id'); |
|
| 36 | - $problem->user_errors = Common::getValue($params, 'user_errors', array()); |
|
| 37 | - $problem->state = Common::getValue($params, 'state', array()); |
|
| 38 | - $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array()); |
|
| 39 | - $problem->links = Common::getValue($params, 'links', array()); |
|
| 40 | - |
|
| 41 | - if (isset($params['parameters'])) { |
|
| 42 | - $problem->parameters = RouteParameters::fromArray($params['parameters']); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if (isset($params['addresses'])) { |
|
| 46 | - $addresses = array(); |
|
| 14 | + public $optimization_problem_id; |
|
| 15 | + public $user_errors = array(); |
|
| 16 | + public $state; |
|
| 17 | + public $optimization_errors = array(); |
|
| 18 | + public $parameters; |
|
| 19 | + public $sent_to_background; |
|
| 20 | + public $created_timestamp; |
|
| 21 | + public $scheduled_for; |
|
| 22 | + public $optimization_completed_timestamp; |
|
| 23 | + public $addresses = array(); |
|
| 24 | + public $routes = array(); |
|
| 25 | + public $links = array(); |
|
| 26 | + |
|
| 27 | + function __construct() |
|
| 28 | + { |
|
| 29 | + $this->parameters = new RouteParameters; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + public static function fromArray(array $params) |
|
| 33 | + { |
|
| 34 | + $problem = new OptimizationProblem; |
|
| 35 | + $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id'); |
|
| 36 | + $problem->user_errors = Common::getValue($params, 'user_errors', array()); |
|
| 37 | + $problem->state = Common::getValue($params, 'state', array()); |
|
| 38 | + $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array()); |
|
| 39 | + $problem->links = Common::getValue($params, 'links', array()); |
|
| 40 | + |
|
| 41 | + if (isset($params['parameters'])) { |
|
| 42 | + $problem->parameters = RouteParameters::fromArray($params['parameters']); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if (isset($params['addresses'])) { |
|
| 46 | + $addresses = array(); |
|
| 47 | 47 | |
| 48 | - foreach ($params['addresses'] as $address) { |
|
| 49 | - $addresses[] = Address::fromArray($address); |
|
| 50 | - } |
|
| 48 | + foreach ($params['addresses'] as $address) { |
|
| 49 | + $addresses[] = Address::fromArray($address); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - $problem->addresses = $addresses; |
|
| 53 | - } |
|
| 52 | + $problem->addresses = $addresses; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (isset($params['routes'])) { |
|
| 56 | - $routes = array(); |
|
| 55 | + if (isset($params['routes'])) { |
|
| 56 | + $routes = array(); |
|
| 57 | 57 | |
| 58 | - foreach ($params['routes'] as $route) { |
|
| 59 | - $routes[] = Route::fromArray($route); |
|
| 60 | - } |
|
| 58 | + foreach ($params['routes'] as $route) { |
|
| 59 | + $routes[] = Route::fromArray($route); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $problem->routes = $routes; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - return $problem; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - public static function optimize(OptimizationProblemParams $params) |
|
| 69 | - { |
|
| 70 | - $allQueryFields = array('redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'); |
|
| 71 | - |
|
| 72 | - $optimize = Route4Me::makeRequst(array( |
|
| 73 | - 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 74 | - 'method' => 'POST', |
|
| 75 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 76 | - 'body' => array( |
|
| 77 | - 'addresses' => $params->getAddressesArray(), |
|
| 78 | - 'parameters' => $params->getParametersArray() |
|
| 79 | - ) |
|
| 80 | - )); |
|
| 81 | - |
|
| 82 | - return OptimizationProblem::fromArray($optimize); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - public static function get($params) |
|
| 86 | - { |
|
| 87 | - $allQueryFields = array('state', 'limit', 'format', 'offset', |
|
| 88 | - 'optimization_problem_id', 'wait_for_final_state'); |
|
| 89 | - |
|
| 90 | - $optimize = Route4Me::makeRequst(array( |
|
| 91 | - 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 92 | - 'method' => 'GET', |
|
| 93 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 94 | - )); |
|
| 95 | - |
|
| 96 | - if (isset($optimize['optimizations'])) { |
|
| 97 | - $problems = array(); |
|
| 62 | + $problem->routes = $routes; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + return $problem; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + public static function optimize(OptimizationProblemParams $params) |
|
| 69 | + { |
|
| 70 | + $allQueryFields = array('redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'); |
|
| 71 | + |
|
| 72 | + $optimize = Route4Me::makeRequst(array( |
|
| 73 | + 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 74 | + 'method' => 'POST', |
|
| 75 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 76 | + 'body' => array( |
|
| 77 | + 'addresses' => $params->getAddressesArray(), |
|
| 78 | + 'parameters' => $params->getParametersArray() |
|
| 79 | + ) |
|
| 80 | + )); |
|
| 81 | + |
|
| 82 | + return OptimizationProblem::fromArray($optimize); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + public static function get($params) |
|
| 86 | + { |
|
| 87 | + $allQueryFields = array('state', 'limit', 'format', 'offset', |
|
| 88 | + 'optimization_problem_id', 'wait_for_final_state'); |
|
| 89 | + |
|
| 90 | + $optimize = Route4Me::makeRequst(array( |
|
| 91 | + 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 92 | + 'method' => 'GET', |
|
| 93 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 94 | + )); |
|
| 95 | + |
|
| 96 | + if (isset($optimize['optimizations'])) { |
|
| 97 | + $problems = array(); |
|
| 98 | 98 | |
| 99 | - foreach ($optimize['optimizations'] as $problem) { |
|
| 100 | - $problems[] = OptimizationProblem::fromArray($problem); |
|
| 101 | - } |
|
| 99 | + foreach ($optimize['optimizations'] as $problem) { |
|
| 100 | + $problems[] = OptimizationProblem::fromArray($problem); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - return $problems; |
|
| 104 | - } else { |
|
| 105 | - return OptimizationProblem::fromArray($optimize); |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - public static function reoptimize($params) |
|
| 110 | - { |
|
| 111 | - $param = new OptimizationProblemParams; |
|
| 112 | - $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null; |
|
| 113 | - $param->reoptimize = 1; |
|
| 114 | - |
|
| 115 | - return self::update((array)$param); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - public static function update($params) |
|
| 119 | - { |
|
| 120 | - $allQueryFields = array('optimization_problem_id', 'reoptimize'); |
|
| 121 | - $allBodyFields = array('addresses'); |
|
| 122 | - |
|
| 123 | - $optimize = Route4Me::makeRequst(array( |
|
| 124 | - 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 125 | - 'method' => 'PUT', |
|
| 126 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 127 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 128 | - )); |
|
| 129 | - |
|
| 130 | - return $optimize; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - public function getOptimizationId() |
|
| 134 | - { |
|
| 135 | - return $this->optimization_problem_id; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - public function getRoutes() |
|
| 139 | - { |
|
| 140 | - return $this->routes; |
|
| 141 | - } |
|
| 103 | + return $problems; |
|
| 104 | + } else { |
|
| 105 | + return OptimizationProblem::fromArray($optimize); |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + public static function reoptimize($params) |
|
| 110 | + { |
|
| 111 | + $param = new OptimizationProblemParams; |
|
| 112 | + $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null; |
|
| 113 | + $param->reoptimize = 1; |
|
| 114 | + |
|
| 115 | + return self::update((array)$param); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + public static function update($params) |
|
| 119 | + { |
|
| 120 | + $allQueryFields = array('optimization_problem_id', 'reoptimize'); |
|
| 121 | + $allBodyFields = array('addresses'); |
|
| 122 | + |
|
| 123 | + $optimize = Route4Me::makeRequst(array( |
|
| 124 | + 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 125 | + 'method' => 'PUT', |
|
| 126 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 127 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 128 | + )); |
|
| 129 | + |
|
| 130 | + return $optimize; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + public function getOptimizationId() |
|
| 134 | + { |
|
| 135 | + return $this->optimization_problem_id; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + public function getRoutes() |
|
| 139 | + { |
|
| 140 | + return $this->routes; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - public function getRandomOptimizationId($offset, $limit) |
|
| 144 | - { |
|
| 145 | - $optimizations = self::get(array('offset' => $offset, 'limit' => $limit)); |
|
| 143 | + public function getRandomOptimizationId($offset, $limit) |
|
| 144 | + { |
|
| 145 | + $optimizations = self::get(array('offset' => $offset, 'limit' => $limit)); |
|
| 146 | 146 | |
| 147 | - $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)]; |
|
| 148 | - |
|
| 149 | - if(!isset($rOptimization->optimization_problem_id)) { |
|
| 150 | - if (sizeof($optimizations)>9) { |
|
| 151 | - $this->getRandomOptimizationId($offset, $limit); |
|
| 152 | - } else { |
|
| 153 | - return null; |
|
| 154 | - } |
|
| 155 | - } |
|
| 147 | + $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)]; |
|
| 148 | + |
|
| 149 | + if(!isset($rOptimization->optimization_problem_id)) { |
|
| 150 | + if (sizeof($optimizations)>9) { |
|
| 151 | + $this->getRandomOptimizationId($offset, $limit); |
|
| 152 | + } else { |
|
| 153 | + return null; |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - return $rOptimization->optimization_problem_id; |
|
| 158 | - } |
|
| 157 | + return $rOptimization->optimization_problem_id; |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - public function getAddresses($opt_id) |
|
| 161 | - { |
|
| 162 | - if ($opt_id==null) { |
|
| 163 | - return null; |
|
| 164 | - } |
|
| 160 | + public function getAddresses($opt_id) |
|
| 161 | + { |
|
| 162 | + if ($opt_id==null) { |
|
| 163 | + return null; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - $params = array("optimization_problem_id" => $opt_id); |
|
| 166 | + $params = array("optimization_problem_id" => $opt_id); |
|
| 167 | 167 | |
| 168 | - $optimization = (array)$this->get($params); |
|
| 168 | + $optimization = (array)$this->get($params); |
|
| 169 | 169 | |
| 170 | - $addresses = $optimization["addresses"]; |
|
| 170 | + $addresses = $optimization["addresses"]; |
|
| 171 | 171 | |
| 172 | - return $addresses; |
|
| 173 | - } |
|
| 172 | + return $addresses; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - public function getRandomAddressFromOptimization($opt_id) |
|
| 176 | - { |
|
| 177 | - $addresses = (array)$this->getAddresses($opt_id); |
|
| 175 | + public function getRandomAddressFromOptimization($opt_id) |
|
| 176 | + { |
|
| 177 | + $addresses = (array)$this->getAddresses($opt_id); |
|
| 178 | 178 | |
| 179 | - if ($addresses==null) { |
|
| 180 | - echo "There are no addresses in this optimization!.. Try again."; |
|
| 181 | - return null; |
|
| 182 | - } |
|
| 179 | + if ($addresses==null) { |
|
| 180 | + echo "There are no addresses in this optimization!.. Try again."; |
|
| 181 | + return null; |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - $num = rand(0, sizeof($addresses) - 1); |
|
| 184 | + $num = rand(0, sizeof($addresses) - 1); |
|
| 185 | 185 | |
| 186 | - $rAddress = $addresses[$num]; |
|
| 186 | + $rAddress = $addresses[$num]; |
|
| 187 | 187 | |
| 188 | - return $rAddress; |
|
| 189 | - } |
|
| 188 | + return $rAddress; |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - public function removeAddress($params) |
|
| 192 | - { |
|
| 193 | - $allQueryFields = array('optimization_problem_id', 'route_destination_id'); |
|
| 194 | - |
|
| 195 | - $response = Route4Me::makeRequst(array( |
|
| 196 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 197 | - 'method' => 'DELETE', |
|
| 198 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 199 | - )); |
|
| 200 | - |
|
| 201 | - return $response; |
|
| 202 | - } |
|
| 191 | + public function removeAddress($params) |
|
| 192 | + { |
|
| 193 | + $allQueryFields = array('optimization_problem_id', 'route_destination_id'); |
|
| 194 | + |
|
| 195 | + $response = Route4Me::makeRequst(array( |
|
| 196 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 197 | + 'method' => 'DELETE', |
|
| 198 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 199 | + )); |
|
| 200 | + |
|
| 201 | + return $response; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - public function removeOptimization($params) |
|
| 205 | - { |
|
| 206 | - $allQueryFields = array('redirect'); |
|
| 207 | - $allBodyFields = array('optimization_problem_ids'); |
|
| 208 | - |
|
| 209 | - $response = Route4Me::makeRequst(array( |
|
| 210 | - 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 211 | - 'method' => 'DELETE', |
|
| 212 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 213 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 214 | - )); |
|
| 215 | - |
|
| 216 | - return $response; |
|
| 217 | - } |
|
| 204 | + public function removeOptimization($params) |
|
| 205 | + { |
|
| 206 | + $allQueryFields = array('redirect'); |
|
| 207 | + $allBodyFields = array('optimization_problem_ids'); |
|
| 208 | + |
|
| 209 | + $response = Route4Me::makeRequst(array( |
|
| 210 | + 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 211 | + 'method' => 'DELETE', |
|
| 212 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 213 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 214 | + )); |
|
| 215 | + |
|
| 216 | + return $response; |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - public function getHybridOptimization($params) |
|
| 220 | - { |
|
| 221 | - $allQueryFields = array('target_date_string', 'timezone_offset_minutes'); |
|
| 222 | - |
|
| 223 | - $optimize = Route4Me::makeRequst(array( |
|
| 224 | - 'url' => Endpoint::HYBRID_DATE_OPTIMIZATION, |
|
| 225 | - 'method' => 'GET', |
|
| 226 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 227 | - )); |
|
| 228 | - |
|
| 229 | - return $optimize; |
|
| 230 | - } |
|
| 219 | + public function getHybridOptimization($params) |
|
| 220 | + { |
|
| 221 | + $allQueryFields = array('target_date_string', 'timezone_offset_minutes'); |
|
| 222 | + |
|
| 223 | + $optimize = Route4Me::makeRequst(array( |
|
| 224 | + 'url' => Endpoint::HYBRID_DATE_OPTIMIZATION, |
|
| 225 | + 'method' => 'GET', |
|
| 226 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 227 | + )); |
|
| 228 | + |
|
| 229 | + return $optimize; |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - Public function addDepotsToHybrid($params) |
|
| 233 | - { |
|
| 234 | - $allQueryFields = array('optimization_problem_id'); |
|
| 235 | - $allBodyFields = array('optimization_problem_id', 'delete_old_depots', 'new_depots'); |
|
| 236 | - |
|
| 237 | - $depots = Route4Me::makeRequst(array( |
|
| 238 | - 'url' => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT, |
|
| 239 | - 'method' => 'POST', |
|
| 240 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 241 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 242 | - )); |
|
| 243 | - |
|
| 244 | - return $depots; |
|
| 245 | - } |
|
| 232 | + Public function addDepotsToHybrid($params) |
|
| 233 | + { |
|
| 234 | + $allQueryFields = array('optimization_problem_id'); |
|
| 235 | + $allBodyFields = array('optimization_problem_id', 'delete_old_depots', 'new_depots'); |
|
| 236 | + |
|
| 237 | + $depots = Route4Me::makeRequst(array( |
|
| 238 | + 'url' => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT, |
|
| 239 | + 'method' => 'POST', |
|
| 240 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 241 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 242 | + )); |
|
| 243 | + |
|
| 244 | + return $depots; |
|
| 245 | + } |
|
| 246 | 246 | } |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | |
| 147 | 147 | $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)]; |
| 148 | 148 | |
| 149 | - if(!isset($rOptimization->optimization_problem_id)) { |
|
| 149 | + if (!isset($rOptimization->optimization_problem_id)) { |
|
| 150 | 150 | if (sizeof($optimizations)>9) { |
| 151 | 151 | $this->getRandomOptimizationId($offset, $limit); |
| 152 | 152 | } else { |
@@ -6,325 +6,325 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Member extends Common |
| 8 | 8 | { |
| 9 | - public $device_id; |
|
| 10 | - public $device_type; |
|
| 11 | - public $format; |
|
| 9 | + public $device_id; |
|
| 10 | + public $device_type; |
|
| 11 | + public $format; |
|
| 12 | 12 | |
| 13 | - public $strEmail; |
|
| 14 | - public $strPassword; |
|
| 15 | - public $strPassword_1; |
|
| 16 | - public $strPassword_2; |
|
| 17 | - public $strFirstName; |
|
| 18 | - public $strLastName; |
|
| 19 | - public $strIndustry; |
|
| 20 | - public $chkTerms; |
|
| 21 | - public $plan; |
|
| 13 | + public $strEmail; |
|
| 14 | + public $strPassword; |
|
| 15 | + public $strPassword_1; |
|
| 16 | + public $strPassword_2; |
|
| 17 | + public $strFirstName; |
|
| 18 | + public $strLastName; |
|
| 19 | + public $strIndustry; |
|
| 20 | + public $chkTerms; |
|
| 21 | + public $plan; |
|
| 22 | 22 | |
| 23 | - public $session_guid; |
|
| 24 | - public $member_id; |
|
| 23 | + public $session_guid; |
|
| 24 | + public $member_id; |
|
| 25 | 25 | |
| 26 | - public $email_address; |
|
| 27 | - public $first_name; |
|
| 28 | - public $last_name; |
|
| 29 | - public $phone_number; |
|
| 30 | - public $company_name; |
|
| 31 | - public $webinar_date; |
|
| 26 | + public $email_address; |
|
| 27 | + public $first_name; |
|
| 28 | + public $last_name; |
|
| 29 | + public $phone_number; |
|
| 30 | + public $company_name; |
|
| 31 | + public $webinar_date; |
|
| 32 | 32 | |
| 33 | - public $subscription_name; |
|
| 34 | - public $token; |
|
| 35 | - public $payload; |
|
| 33 | + public $subscription_name; |
|
| 34 | + public $token; |
|
| 35 | + public $payload; |
|
| 36 | 36 | |
| 37 | - public $HIDE_ROUTED_ADDRESSES; |
|
| 38 | - public $member_phone; |
|
| 39 | - public $member_zipcode; |
|
| 40 | - public $route_count; |
|
| 41 | - public $member_email; |
|
| 42 | - public $HIDE_VISITED_ADDRESSES; |
|
| 43 | - public $READONLY_USER; |
|
| 44 | - public $member_type; |
|
| 45 | - public $date_of_birth; |
|
| 46 | - public $member_first_name; |
|
| 47 | - public $member_password; |
|
| 48 | - public $HIDE_NONFUTURE_ROUTES; |
|
| 49 | - public $member_last_name; |
|
| 50 | - public $SHOW_ALL_VEHICLES; |
|
| 51 | - public $SHOW_ALL_DRIVERS; |
|
| 37 | + public $HIDE_ROUTED_ADDRESSES; |
|
| 38 | + public $member_phone; |
|
| 39 | + public $member_zipcode; |
|
| 40 | + public $route_count; |
|
| 41 | + public $member_email; |
|
| 42 | + public $HIDE_VISITED_ADDRESSES; |
|
| 43 | + public $READONLY_USER; |
|
| 44 | + public $member_type; |
|
| 45 | + public $date_of_birth; |
|
| 46 | + public $member_first_name; |
|
| 47 | + public $member_password; |
|
| 48 | + public $HIDE_NONFUTURE_ROUTES; |
|
| 49 | + public $member_last_name; |
|
| 50 | + public $SHOW_ALL_VEHICLES; |
|
| 51 | + public $SHOW_ALL_DRIVERS; |
|
| 52 | 52 | |
| 53 | - public $config_key; |
|
| 54 | - public $config_value; |
|
| 53 | + public $config_key; |
|
| 54 | + public $config_value; |
|
| 55 | 55 | |
| 56 | - public $preferred_units; |
|
| 57 | - public $preferred_language; |
|
| 58 | - public $timezone; |
|
| 59 | - public $OWNER_MEMBER_ID; |
|
| 60 | - public $user_reg_state_id; |
|
| 61 | - public $user_reg_country_id; |
|
| 62 | - public $member_picture; |
|
| 63 | - public $api_key; |
|
| 64 | - public $custom_data; |
|
| 56 | + public $preferred_units; |
|
| 57 | + public $preferred_language; |
|
| 58 | + public $timezone; |
|
| 59 | + public $OWNER_MEMBER_ID; |
|
| 60 | + public $user_reg_state_id; |
|
| 61 | + public $user_reg_country_id; |
|
| 62 | + public $member_picture; |
|
| 63 | + public $api_key; |
|
| 64 | + public $custom_data; |
|
| 65 | 65 | |
| 66 | - public static function fromArray(array $params) |
|
| 67 | - { |
|
| 68 | - $member= new Member(); |
|
| 69 | - |
|
| 70 | - foreach($params as $key => $value) { |
|
| 71 | - if (property_exists($member, $key)) { |
|
| 72 | - $member->{$key} = $value; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return $member; |
|
| 77 | - } |
|
| 66 | + public static function fromArray(array $params) |
|
| 67 | + { |
|
| 68 | + $member= new Member(); |
|
| 69 | + |
|
| 70 | + foreach($params as $key => $value) { |
|
| 71 | + if (property_exists($member, $key)) { |
|
| 72 | + $member->{$key} = $value; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return $member; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - public static function getUsers() |
|
| 80 | - { |
|
| 81 | - $response = Route4Me::makeRequst(array( |
|
| 82 | - 'url' => Endpoint::USER_V4, |
|
| 83 | - 'method' => 'GET' |
|
| 84 | - )); |
|
| 79 | + public static function getUsers() |
|
| 80 | + { |
|
| 81 | + $response = Route4Me::makeRequst(array( |
|
| 82 | + 'url' => Endpoint::USER_V4, |
|
| 83 | + 'method' => 'GET' |
|
| 84 | + )); |
|
| 85 | 85 | |
| 86 | - return $response; |
|
| 87 | - } |
|
| 86 | + return $response; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public static function getUser($params) |
|
| 90 | - { |
|
| 91 | - $response = Route4Me::makeRequst(array( |
|
| 92 | - 'url' => Endpoint::USER_V4, |
|
| 93 | - 'method' => 'GET', |
|
| 94 | - 'query' => array( |
|
| 95 | - 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
| 96 | - ) |
|
| 97 | - )); |
|
| 89 | + public static function getUser($params) |
|
| 90 | + { |
|
| 91 | + $response = Route4Me::makeRequst(array( |
|
| 92 | + 'url' => Endpoint::USER_V4, |
|
| 93 | + 'method' => 'GET', |
|
| 94 | + 'query' => array( |
|
| 95 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
| 96 | + ) |
|
| 97 | + )); |
|
| 98 | 98 | |
| 99 | - return $response; |
|
| 100 | - } |
|
| 99 | + return $response; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - public static function getUserLocations($param) |
|
| 103 | - { |
|
| 104 | - $response = Route4Me::makeRequst(array( |
|
| 105 | - 'url' => Endpoint::VIEW_USER_LOCATIONS, |
|
| 106 | - 'method' => 'GET', |
|
| 107 | - 'query' => array( |
|
| 108 | - 'query' => $param |
|
| 109 | - ) |
|
| 110 | - )); |
|
| 102 | + public static function getUserLocations($param) |
|
| 103 | + { |
|
| 104 | + $response = Route4Me::makeRequst(array( |
|
| 105 | + 'url' => Endpoint::VIEW_USER_LOCATIONS, |
|
| 106 | + 'method' => 'GET', |
|
| 107 | + 'query' => array( |
|
| 108 | + 'query' => $param |
|
| 109 | + ) |
|
| 110 | + )); |
|
| 111 | 111 | |
| 112 | - return $response; |
|
| 113 | - } |
|
| 112 | + return $response; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - public static function addDeviceRecord($params) |
|
| 116 | - { |
|
| 117 | - $allQueryFields = array('device_id', 'device_type'); |
|
| 118 | - $allBodyFields = array('device_id', 'device_type', 'format'); |
|
| 119 | - |
|
| 120 | - $response = Route4Me::makeRequst(array( |
|
| 121 | - 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
| 122 | - 'method' => 'POST', |
|
| 123 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 124 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 125 | - )); |
|
| 126 | - |
|
| 127 | - return $response; |
|
| 128 | - } |
|
| 115 | + public static function addDeviceRecord($params) |
|
| 116 | + { |
|
| 117 | + $allQueryFields = array('device_id', 'device_type'); |
|
| 118 | + $allBodyFields = array('device_id', 'device_type', 'format'); |
|
| 119 | + |
|
| 120 | + $response = Route4Me::makeRequst(array( |
|
| 121 | + 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
| 122 | + 'method' => 'POST', |
|
| 123 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 124 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 125 | + )); |
|
| 126 | + |
|
| 127 | + return $response; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - public static function createMember($params) |
|
| 131 | - { |
|
| 132 | - $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', |
|
| 133 | - 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 130 | + public static function createMember($params) |
|
| 131 | + { |
|
| 132 | + $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', |
|
| 133 | + 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 134 | 134 | |
| 135 | - $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 135 | + $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 136 | 136 | |
| 137 | - $response = Route4Me::makeRequst(array( |
|
| 138 | - 'url' => Endpoint::USER_V4, |
|
| 139 | - 'method' => 'POST', |
|
| 140 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 141 | - )); |
|
| 142 | - |
|
| 143 | - return $response; |
|
| 144 | - } |
|
| 137 | + $response = Route4Me::makeRequst(array( |
|
| 138 | + 'url' => Endpoint::USER_V4, |
|
| 139 | + 'method' => 'POST', |
|
| 140 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 141 | + )); |
|
| 142 | + |
|
| 143 | + return $response; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - public static function getRandomMemberByType($memberType) |
|
| 147 | - { |
|
| 148 | - $members = self::getUsers(); |
|
| 146 | + public static function getRandomMemberByType($memberType) |
|
| 147 | + { |
|
| 148 | + $members = self::getUsers(); |
|
| 149 | 149 | |
| 150 | - if (is_null($members) || !isset($members['results'])) { |
|
| 151 | - return null; |
|
| 152 | - } |
|
| 150 | + if (is_null($members) || !isset($members['results'])) { |
|
| 151 | + return null; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $memberIDs = array(); |
|
| 154 | + $memberIDs = array(); |
|
| 155 | 155 | |
| 156 | - foreach ($members['results'] as $memb) { |
|
| 157 | - if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
| 158 | - if ($memberType==$memb['member_type']) { |
|
| 159 | - $memberIDs[]=$memb['member_id']; |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - } |
|
| 156 | + foreach ($members['results'] as $memb) { |
|
| 157 | + if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
| 158 | + if ($memberType==$memb['member_type']) { |
|
| 159 | + $memberIDs[]=$memb['member_id']; |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - if (sizeof($memberIDs)<1) { |
|
| 165 | - return null; |
|
| 166 | - } |
|
| 164 | + if (sizeof($memberIDs)<1) { |
|
| 165 | + return null; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
| 168 | + $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
| 169 | 169 | |
| 170 | - return $memberIDs[$randomIndex]; |
|
| 171 | - } |
|
| 170 | + return $memberIDs[$randomIndex]; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | - public static function updateMember($body) |
|
| 175 | - { |
|
| 176 | - $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', |
|
| 177 | - 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 174 | + public static function updateMember($body) |
|
| 175 | + { |
|
| 176 | + $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', |
|
| 177 | + 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 178 | 178 | |
| 179 | - $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 179 | + $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 180 | 180 | |
| 181 | - $response = Route4Me::makeRequst(array( |
|
| 182 | - 'url' => Endpoint::USER_V4, |
|
| 183 | - 'method' => 'PUT', |
|
| 184 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $body) |
|
| 185 | - )); |
|
| 181 | + $response = Route4Me::makeRequst(array( |
|
| 182 | + 'url' => Endpoint::USER_V4, |
|
| 183 | + 'method' => 'PUT', |
|
| 184 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $body) |
|
| 185 | + )); |
|
| 186 | 186 | |
| 187 | - return $response; |
|
| 188 | - } |
|
| 187 | + return $response; |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | - public static function deleteMember($body) |
|
| 191 | - { |
|
| 192 | - $response = Route4Me::makeRequst(array( |
|
| 193 | - 'url' => Endpoint::USER_V4, |
|
| 194 | - 'method' => 'DELETE', |
|
| 195 | - 'body' => array( |
|
| 196 | - 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
| 197 | - ) |
|
| 190 | + public static function deleteMember($body) |
|
| 191 | + { |
|
| 192 | + $response = Route4Me::makeRequst(array( |
|
| 193 | + 'url' => Endpoint::USER_V4, |
|
| 194 | + 'method' => 'DELETE', |
|
| 195 | + 'body' => array( |
|
| 196 | + 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
| 197 | + ) |
|
| 198 | 198 | |
| 199 | - )); |
|
| 199 | + )); |
|
| 200 | 200 | |
| 201 | - return $response; |
|
| 202 | - } |
|
| 201 | + return $response; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - public static function newAccountRegistration($params) |
|
| 205 | - { |
|
| 206 | - $allQueryFields = array('plan'); |
|
| 207 | - $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', |
|
| 208 | - 'strLastName', 'format', 'strIndustry', 'chkTerms', 'device_type', 'strSubAccountType', |
|
| 209 | - 'blDisableMarketing', 'blDisableAccountActivationEmail'); |
|
| 210 | - |
|
| 211 | - $response = Route4Me::makeRequst(array( |
|
| 212 | - 'url' => Endpoint::REGISTER_ACTION, |
|
| 213 | - 'method' => 'POST', |
|
| 214 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 215 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 216 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 217 | - )); |
|
| 218 | - |
|
| 219 | - return $response; |
|
| 220 | - } |
|
| 204 | + public static function newAccountRegistration($params) |
|
| 205 | + { |
|
| 206 | + $allQueryFields = array('plan'); |
|
| 207 | + $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', |
|
| 208 | + 'strLastName', 'format', 'strIndustry', 'chkTerms', 'device_type', 'strSubAccountType', |
|
| 209 | + 'blDisableMarketing', 'blDisableAccountActivationEmail'); |
|
| 210 | + |
|
| 211 | + $response = Route4Me::makeRequst(array( |
|
| 212 | + 'url' => Endpoint::REGISTER_ACTION, |
|
| 213 | + 'method' => 'POST', |
|
| 214 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 215 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 216 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 217 | + )); |
|
| 218 | + |
|
| 219 | + return $response; |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - public static function validateSession($params) |
|
| 223 | - { |
|
| 224 | - $allQueryFields = array('session_guid', 'member_id', 'format'); |
|
| 225 | - |
|
| 226 | - $response = Route4Me::makeRequst(array( |
|
| 227 | - 'url' => Endpoint::VALIDATE_SESSION, |
|
| 228 | - 'method' => 'GET', |
|
| 229 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 230 | - )); |
|
| 231 | - |
|
| 232 | - return $response; |
|
| 233 | - } |
|
| 222 | + public static function validateSession($params) |
|
| 223 | + { |
|
| 224 | + $allQueryFields = array('session_guid', 'member_id', 'format'); |
|
| 225 | + |
|
| 226 | + $response = Route4Me::makeRequst(array( |
|
| 227 | + 'url' => Endpoint::VALIDATE_SESSION, |
|
| 228 | + 'method' => 'GET', |
|
| 229 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 230 | + )); |
|
| 231 | + |
|
| 232 | + return $response; |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - public static function memberAuthentication($params) |
|
| 236 | - { |
|
| 237 | - $allBodyFields = array('strEmail', 'strPassword', 'format'); |
|
| 238 | - |
|
| 239 | - $response = Route4Me::makeRequst(array( |
|
| 240 | - 'url' => Endpoint::AUTHENTICATE, |
|
| 241 | - 'method' => 'POST', |
|
| 242 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 243 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 244 | - )); |
|
| 245 | - |
|
| 246 | - return $response; |
|
| 247 | - } |
|
| 235 | + public static function memberAuthentication($params) |
|
| 236 | + { |
|
| 237 | + $allBodyFields = array('strEmail', 'strPassword', 'format'); |
|
| 238 | + |
|
| 239 | + $response = Route4Me::makeRequst(array( |
|
| 240 | + 'url' => Endpoint::AUTHENTICATE, |
|
| 241 | + 'method' => 'POST', |
|
| 242 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 243 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 244 | + )); |
|
| 245 | + |
|
| 246 | + return $response; |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - public static function webinarRegistration($params) |
|
| 250 | - { |
|
| 251 | - $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', |
|
| 252 | - 'company_name', 'member_id', 'webinar_date'); |
|
| 253 | - |
|
| 254 | - $response = Route4Me::makeRequst(array( |
|
| 255 | - 'url' => Endpoint::WEBINAR_REGISTER, |
|
| 256 | - 'method' => 'POST', |
|
| 257 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 258 | - )); |
|
| 259 | - |
|
| 260 | - return $response; |
|
| 261 | - } |
|
| 249 | + public static function webinarRegistration($params) |
|
| 250 | + { |
|
| 251 | + $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', |
|
| 252 | + 'company_name', 'member_id', 'webinar_date'); |
|
| 253 | + |
|
| 254 | + $response = Route4Me::makeRequst(array( |
|
| 255 | + 'url' => Endpoint::WEBINAR_REGISTER, |
|
| 256 | + 'method' => 'POST', |
|
| 257 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 258 | + )); |
|
| 259 | + |
|
| 260 | + return $response; |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - public static function purchaseUserLicense($params) |
|
| 264 | - { |
|
| 265 | - $allQueryFields = array('device_id'); |
|
| 266 | - $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', |
|
| 267 | - 'subscription_name', 'token', 'payload', 'format'); |
|
| 268 | - |
|
| 269 | - $response = Route4Me::makeRequst(array( |
|
| 270 | - 'url' => Endpoint::USER_LICENSE, |
|
| 271 | - 'method' => 'POST', |
|
| 272 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 273 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 274 | - )); |
|
| 275 | - |
|
| 276 | - return $response; |
|
| 277 | - } |
|
| 263 | + public static function purchaseUserLicense($params) |
|
| 264 | + { |
|
| 265 | + $allQueryFields = array('device_id'); |
|
| 266 | + $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', |
|
| 267 | + 'subscription_name', 'token', 'payload', 'format'); |
|
| 268 | + |
|
| 269 | + $response = Route4Me::makeRequst(array( |
|
| 270 | + 'url' => Endpoint::USER_LICENSE, |
|
| 271 | + 'method' => 'POST', |
|
| 272 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 273 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 274 | + )); |
|
| 275 | + |
|
| 276 | + return $response; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - public static function newMemberConfigKey($params) |
|
| 280 | - { |
|
| 281 | - $allBodyFields = array('config_key', 'config_value'); |
|
| 282 | - |
|
| 283 | - $response = Route4Me::makeRequst(array( |
|
| 284 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 285 | - 'method' => 'POST', |
|
| 286 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 287 | - )); |
|
| 288 | - |
|
| 289 | - return $response; |
|
| 290 | - } |
|
| 279 | + public static function newMemberConfigKey($params) |
|
| 280 | + { |
|
| 281 | + $allBodyFields = array('config_key', 'config_value'); |
|
| 282 | + |
|
| 283 | + $response = Route4Me::makeRequst(array( |
|
| 284 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 285 | + 'method' => 'POST', |
|
| 286 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 287 | + )); |
|
| 288 | + |
|
| 289 | + return $response; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - public static function removeMemberConfigKey($params) |
|
| 293 | - { |
|
| 294 | - $allBodyFields = array('config_key'); |
|
| 295 | - |
|
| 296 | - $response = Route4Me::makeRequst(array( |
|
| 297 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 298 | - 'method' => 'DELETE', |
|
| 299 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 300 | - )); |
|
| 301 | - |
|
| 302 | - return $response; |
|
| 303 | - } |
|
| 292 | + public static function removeMemberConfigKey($params) |
|
| 293 | + { |
|
| 294 | + $allBodyFields = array('config_key'); |
|
| 295 | + |
|
| 296 | + $response = Route4Me::makeRequst(array( |
|
| 297 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 298 | + 'method' => 'DELETE', |
|
| 299 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 300 | + )); |
|
| 301 | + |
|
| 302 | + return $response; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - public static function getMemberConfigData($params) |
|
| 306 | - { |
|
| 307 | - $allQueryFields = array('config_key'); |
|
| 308 | - |
|
| 309 | - $response = Route4Me::makeRequst(array( |
|
| 310 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 311 | - 'method' => 'GET', |
|
| 312 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 313 | - )); |
|
| 314 | - |
|
| 315 | - return $response; |
|
| 316 | - } |
|
| 305 | + public static function getMemberConfigData($params) |
|
| 306 | + { |
|
| 307 | + $allQueryFields = array('config_key'); |
|
| 308 | + |
|
| 309 | + $response = Route4Me::makeRequst(array( |
|
| 310 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 311 | + 'method' => 'GET', |
|
| 312 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 313 | + )); |
|
| 314 | + |
|
| 315 | + return $response; |
|
| 316 | + } |
|
| 317 | 317 | |
| 318 | - public static function updateMemberConfigKey($params) |
|
| 319 | - { |
|
| 320 | - $allBodyFields = array('config_key', 'config_value'); |
|
| 321 | - |
|
| 322 | - $response = Route4Me::makeRequst(array( |
|
| 323 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 324 | - 'method' => 'PUT', |
|
| 325 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 326 | - )); |
|
| 327 | - |
|
| 328 | - return $response; |
|
| 329 | - } |
|
| 318 | + public static function updateMemberConfigKey($params) |
|
| 319 | + { |
|
| 320 | + $allBodyFields = array('config_key', 'config_value'); |
|
| 321 | + |
|
| 322 | + $response = Route4Me::makeRequst(array( |
|
| 323 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 324 | + 'method' => 'PUT', |
|
| 325 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 326 | + )); |
|
| 327 | + |
|
| 328 | + return $response; |
|
| 329 | + } |
|
| 330 | 330 | } |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public static function fromArray(array $params) |
| 67 | 67 | { |
| 68 | - $member= new Member(); |
|
| 68 | + $member = new Member(); |
|
| 69 | 69 | |
| 70 | - foreach($params as $key => $value) { |
|
| 70 | + foreach ($params as $key => $value) { |
|
| 71 | 71 | if (property_exists($member, $key)) { |
| 72 | 72 | $member->{$key} = $value; |
| 73 | 73 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | foreach ($members['results'] as $memb) { |
| 157 | 157 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
| 158 | 158 | if ($memberType==$memb['member_type']) { |
| 159 | - $memberIDs[]=$memb['member_id']; |
|
| 159 | + $memberIDs[] = $memb['member_id']; |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -6,157 +6,157 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Vehicle extends Common |
| 8 | 8 | { |
| 9 | - public $vehicle_id; |
|
| 10 | - public $member_id; |
|
| 11 | - public $is_deleted; |
|
| 12 | - public $vehicle_alias; |
|
| 13 | - public $vehicle_vin; |
|
| 14 | - public $vehicle_reg_state_id; |
|
| 15 | - public $vehicle_reg_country_id; |
|
| 16 | - public $vehicle_license_plate; |
|
| 17 | - public $vehicle_type_id; |
|
| 18 | - public $vehicle_make; |
|
| 19 | - public $vehicle_model_year; |
|
| 20 | - public $vehicle_model; |
|
| 21 | - public $vehicle_year_acquired; |
|
| 22 | - public $vehicle_cost_new; |
|
| 23 | - public $purchased_new; |
|
| 24 | - public $license_start_date; |
|
| 25 | - public $license_end_date; |
|
| 26 | - public $vehicle_axle_count; |
|
| 27 | - public $is_operational; |
|
| 28 | - public $mpg_city; |
|
| 29 | - public $mpg_highway; |
|
| 30 | - public $fuel_type; |
|
| 31 | - public $height_inches; |
|
| 32 | - public $weight_lb; |
|
| 33 | - public $external_telematics_vehicle_id; |
|
| 34 | - public $has_trailer; |
|
| 35 | - public $heightInInches; |
|
| 36 | - public $lengthInInches; |
|
| 37 | - public $widthInInches; |
|
| 38 | - public $maxWeightPerAxleGroupInPounds; |
|
| 39 | - public $numAxles; |
|
| 40 | - public $weightInPounds; |
|
| 41 | - public $HazmatType; |
|
| 42 | - public $LowEmissionZonePref; |
|
| 43 | - public $Use53FootTrailerRouting; |
|
| 44 | - public $UseNationalNetwork; |
|
| 45 | - public $UseTruckRestrictions; |
|
| 46 | - public $AvoidFerries; |
|
| 47 | - public $DividedHighwayAvoidPreference; |
|
| 48 | - public $FreewayAvoidPreference; |
|
| 49 | - public $InternationalBordersOpen; |
|
| 50 | - public $TollRoadUsage; |
|
| 51 | - public $hwy_only; |
|
| 52 | - public $long_combination_vehicle; |
|
| 53 | - public $avoid_highways; |
|
| 54 | - public $side_street_adherence; |
|
| 55 | - public $truck_config; |
|
| 56 | - public $height_metric; |
|
| 57 | - public $length_metric; |
|
| 58 | - public $width_metric; |
|
| 59 | - public $weight_metric; |
|
| 60 | - public $max_weight_per_axle_group_metric; |
|
| 9 | + public $vehicle_id; |
|
| 10 | + public $member_id; |
|
| 11 | + public $is_deleted; |
|
| 12 | + public $vehicle_alias; |
|
| 13 | + public $vehicle_vin; |
|
| 14 | + public $vehicle_reg_state_id; |
|
| 15 | + public $vehicle_reg_country_id; |
|
| 16 | + public $vehicle_license_plate; |
|
| 17 | + public $vehicle_type_id; |
|
| 18 | + public $vehicle_make; |
|
| 19 | + public $vehicle_model_year; |
|
| 20 | + public $vehicle_model; |
|
| 21 | + public $vehicle_year_acquired; |
|
| 22 | + public $vehicle_cost_new; |
|
| 23 | + public $purchased_new; |
|
| 24 | + public $license_start_date; |
|
| 25 | + public $license_end_date; |
|
| 26 | + public $vehicle_axle_count; |
|
| 27 | + public $is_operational; |
|
| 28 | + public $mpg_city; |
|
| 29 | + public $mpg_highway; |
|
| 30 | + public $fuel_type; |
|
| 31 | + public $height_inches; |
|
| 32 | + public $weight_lb; |
|
| 33 | + public $external_telematics_vehicle_id; |
|
| 34 | + public $has_trailer; |
|
| 35 | + public $heightInInches; |
|
| 36 | + public $lengthInInches; |
|
| 37 | + public $widthInInches; |
|
| 38 | + public $maxWeightPerAxleGroupInPounds; |
|
| 39 | + public $numAxles; |
|
| 40 | + public $weightInPounds; |
|
| 41 | + public $HazmatType; |
|
| 42 | + public $LowEmissionZonePref; |
|
| 43 | + public $Use53FootTrailerRouting; |
|
| 44 | + public $UseNationalNetwork; |
|
| 45 | + public $UseTruckRestrictions; |
|
| 46 | + public $AvoidFerries; |
|
| 47 | + public $DividedHighwayAvoidPreference; |
|
| 48 | + public $FreewayAvoidPreference; |
|
| 49 | + public $InternationalBordersOpen; |
|
| 50 | + public $TollRoadUsage; |
|
| 51 | + public $hwy_only; |
|
| 52 | + public $long_combination_vehicle; |
|
| 53 | + public $avoid_highways; |
|
| 54 | + public $side_street_adherence; |
|
| 55 | + public $truck_config; |
|
| 56 | + public $height_metric; |
|
| 57 | + public $length_metric; |
|
| 58 | + public $width_metric; |
|
| 59 | + public $weight_metric; |
|
| 60 | + public $max_weight_per_axle_group_metric; |
|
| 61 | 61 | |
| 62 | - public function __construct () |
|
| 63 | - { |
|
| 64 | - Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
|
| 65 | - } |
|
| 62 | + public function __construct () |
|
| 63 | + { |
|
| 64 | + Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - public static function fromArray(array $params) { |
|
| 68 | - $vehicle= new Vehicle(); |
|
| 69 | - foreach ($params as $key => $value) { |
|
| 70 | - if (property_exists($vehicle, $key)) { |
|
| 71 | - $vehicle->{$key} = $value; |
|
| 72 | - } |
|
| 73 | - } |
|
| 67 | + public static function fromArray(array $params) { |
|
| 68 | + $vehicle= new Vehicle(); |
|
| 69 | + foreach ($params as $key => $value) { |
|
| 70 | + if (property_exists($vehicle, $key)) { |
|
| 71 | + $vehicle->{$key} = $value; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $vehicle; |
|
| 76 | - } |
|
| 75 | + return $vehicle; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - public static function getVehicles($params) |
|
| 79 | - { |
|
| 80 | - $allQueryFields = array('with_pagination', 'page', 'perPage'); |
|
| 78 | + public static function getVehicles($params) |
|
| 79 | + { |
|
| 80 | + $allQueryFields = array('with_pagination', 'page', 'perPage'); |
|
| 81 | 81 | |
| 82 | - $response = Route4Me::makeRequst(array( |
|
| 83 | - 'url' => Endpoint::VEHICLE_V4, |
|
| 84 | - 'method' => 'GET', |
|
| 85 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 86 | - )); |
|
| 82 | + $response = Route4Me::makeRequst(array( |
|
| 83 | + 'url' => Endpoint::VEHICLE_V4, |
|
| 84 | + 'method' => 'GET', |
|
| 85 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 86 | + )); |
|
| 87 | 87 | |
| 88 | - return $response; |
|
| 89 | - } |
|
| 88 | + return $response; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - public function getRandomVehicleId($page,$perPage) |
|
| 92 | - { |
|
| 93 | - $params = array( |
|
| 94 | - 'page' => isset($page) ? $page : 1, |
|
| 95 | - 'perPage' => isset($perPage) ? $perPage : 10, |
|
| 96 | - 'with_pagination' => true |
|
| 97 | - ); |
|
| 91 | + public function getRandomVehicleId($page,$perPage) |
|
| 92 | + { |
|
| 93 | + $params = array( |
|
| 94 | + 'page' => isset($page) ? $page : 1, |
|
| 95 | + 'perPage' => isset($perPage) ? $perPage : 10, |
|
| 96 | + 'with_pagination' => true |
|
| 97 | + ); |
|
| 98 | 98 | |
| 99 | - $vehicles = $this->getVehicles($params); |
|
| 99 | + $vehicles = $this->getVehicles($params); |
|
| 100 | 100 | |
| 101 | - if (is_null($vehicles) || !isset($vehicles['data']) || sizeof($vehicles['data'])<1) { |
|
| 102 | - return null; |
|
| 103 | - } |
|
| 101 | + if (is_null($vehicles) || !isset($vehicles['data']) || sizeof($vehicles['data'])<1) { |
|
| 102 | + return null; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - $randomIndex = rand(0, sizeof($vehicles['data']) - 1); |
|
| 105 | + $randomIndex = rand(0, sizeof($vehicles['data']) - 1); |
|
| 106 | 106 | |
| 107 | - return $vehicles['data'][$randomIndex]['vehicle_id']; |
|
| 108 | - } |
|
| 107 | + return $vehicles['data'][$randomIndex]['vehicle_id']; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - public function getVehicleByID($vehicleID) |
|
| 111 | - { |
|
| 112 | - $response = Route4Me::makeRequst(array( |
|
| 113 | - 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 114 | - 'method' => 'GET' |
|
| 115 | - )); |
|
| 110 | + public function getVehicleByID($vehicleID) |
|
| 111 | + { |
|
| 112 | + $response = Route4Me::makeRequst(array( |
|
| 113 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 114 | + 'method' => 'GET' |
|
| 115 | + )); |
|
| 116 | 116 | |
| 117 | - return $response; |
|
| 118 | - } |
|
| 117 | + return $response; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - public function updateVehicle($params) |
|
| 121 | - { |
|
| 122 | - $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
| 120 | + public function updateVehicle($params) |
|
| 121 | + { |
|
| 122 | + $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
| 123 | 123 | |
| 124 | - $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
| 124 | + $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
| 125 | 125 | |
| 126 | - $response = Route4Me::makeRequst(array( |
|
| 127 | - 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 128 | - 'method' => 'PUT', |
|
| 129 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 130 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 131 | - )); |
|
| 126 | + $response = Route4Me::makeRequst(array( |
|
| 127 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 128 | + 'method' => 'PUT', |
|
| 129 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 130 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 131 | + )); |
|
| 132 | 132 | |
| 133 | - return $response; |
|
| 134 | - } |
|
| 133 | + return $response; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - public function createVehicle($params) |
|
| 137 | - { |
|
| 138 | - $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
| 136 | + public function createVehicle($params) |
|
| 137 | + { |
|
| 138 | + $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
| 139 | 139 | |
| 140 | - $response = Route4Me::makeRequst(array( |
|
| 141 | - 'url' => Endpoint::VEHICLE_V4, |
|
| 142 | - 'method' => 'POST', |
|
| 143 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 144 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 145 | - )); |
|
| 140 | + $response = Route4Me::makeRequst(array( |
|
| 141 | + 'url' => Endpoint::VEHICLE_V4, |
|
| 142 | + 'method' => 'POST', |
|
| 143 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 144 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 145 | + )); |
|
| 146 | 146 | |
| 147 | - return $response; |
|
| 148 | - } |
|
| 147 | + return $response; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - public function removeVehicle($params) |
|
| 151 | - { |
|
| 152 | - $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
| 150 | + public function removeVehicle($params) |
|
| 151 | + { |
|
| 152 | + $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
| 153 | 153 | |
| 154 | - $response = Route4Me::makeRequst(array( |
|
| 155 | - 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 156 | - 'method' => 'DELETE', |
|
| 157 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 158 | - )); |
|
| 154 | + $response = Route4Me::makeRequst(array( |
|
| 155 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 156 | + 'method' => 'DELETE', |
|
| 157 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
| 158 | + )); |
|
| 159 | 159 | |
| 160 | - return $response; |
|
| 161 | - } |
|
| 160 | + return $response; |
|
| 161 | + } |
|
| 162 | 162 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | public $weight_metric; |
| 60 | 60 | public $max_weight_per_axle_group_metric; |
| 61 | 61 | |
| 62 | - public function __construct () |
|
| 62 | + public function __construct() |
|
| 63 | 63 | { |
| 64 | 64 | Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public static function fromArray(array $params) { |
| 68 | - $vehicle= new Vehicle(); |
|
| 68 | + $vehicle = new Vehicle(); |
|
| 69 | 69 | foreach ($params as $key => $value) { |
| 70 | 70 | if (property_exists($vehicle, $key)) { |
| 71 | 71 | $vehicle->{$key} = $value; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return $response; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function getRandomVehicleId($page,$perPage) |
|
| 91 | + public function getRandomVehicleId($page, $perPage) |
|
| 92 | 92 | { |
| 93 | 93 | $params = array( |
| 94 | 94 | 'page' => isset($page) ? $page : 1, |
@@ -5,74 +5,74 @@ |
||
| 5 | 5 | |
| 6 | 6 | class RouteParameters extends Common |
| 7 | 7 | { |
| 8 | - public $is_upload; |
|
| 9 | - public $rt; |
|
| 10 | - public $route_name; |
|
| 11 | - public $route_date; |
|
| 12 | - public $route_time; |
|
| 13 | - public $shared_publicly; |
|
| 14 | - public $disable_optimization; |
|
| 15 | - public $optimize; |
|
| 16 | - public $lock_last; |
|
| 17 | - public $vehicle_capacity; |
|
| 18 | - public $vehicle_max_distance_mi; |
|
| 19 | - public $distance_unit; |
|
| 20 | - public $travel_mode; |
|
| 21 | - public $avoid; |
|
| 22 | - public $vehicle_id; |
|
| 23 | - public $dev_lat; |
|
| 24 | - public $dev_lng; |
|
| 25 | - public $route_max_duration; |
|
| 26 | - public $route_email; |
|
| 27 | - public $route_type = "api"; |
|
| 28 | - public $store_route = true; |
|
| 29 | - public $metric; |
|
| 30 | - public $algorithm_type; |
|
| 31 | - public $member_id; |
|
| 32 | - public $ip; |
|
| 33 | - public $dm; |
|
| 34 | - public $dirm; |
|
| 35 | - public $parts; |
|
| 36 | - public $device_id; |
|
| 37 | - public $device_type; |
|
| 38 | - public $has_trailer; |
|
| 39 | - public $trailer_weight_t; |
|
| 40 | - public $limited_weight_t; |
|
| 41 | - public $weight_per_axle_t; |
|
| 42 | - public $truck_height_meters; |
|
| 43 | - public $truck_width_meters; |
|
| 44 | - public $truck_length_meters; |
|
| 45 | - public $truck_hazardous_goods; |
|
| 8 | + public $is_upload; |
|
| 9 | + public $rt; |
|
| 10 | + public $route_name; |
|
| 11 | + public $route_date; |
|
| 12 | + public $route_time; |
|
| 13 | + public $shared_publicly; |
|
| 14 | + public $disable_optimization; |
|
| 15 | + public $optimize; |
|
| 16 | + public $lock_last; |
|
| 17 | + public $vehicle_capacity; |
|
| 18 | + public $vehicle_max_distance_mi; |
|
| 19 | + public $distance_unit; |
|
| 20 | + public $travel_mode; |
|
| 21 | + public $avoid; |
|
| 22 | + public $vehicle_id; |
|
| 23 | + public $dev_lat; |
|
| 24 | + public $dev_lng; |
|
| 25 | + public $route_max_duration; |
|
| 26 | + public $route_email; |
|
| 27 | + public $route_type = "api"; |
|
| 28 | + public $store_route = true; |
|
| 29 | + public $metric; |
|
| 30 | + public $algorithm_type; |
|
| 31 | + public $member_id; |
|
| 32 | + public $ip; |
|
| 33 | + public $dm; |
|
| 34 | + public $dirm; |
|
| 35 | + public $parts; |
|
| 36 | + public $device_id; |
|
| 37 | + public $device_type; |
|
| 38 | + public $has_trailer; |
|
| 39 | + public $trailer_weight_t; |
|
| 40 | + public $limited_weight_t; |
|
| 41 | + public $weight_per_axle_t; |
|
| 42 | + public $truck_height_meters; |
|
| 43 | + public $truck_width_meters; |
|
| 44 | + public $truck_length_meters; |
|
| 45 | + public $truck_hazardous_goods; |
|
| 46 | 46 | |
| 47 | - public $vehicle_max_cargo_weight; |
|
| 48 | - public $vehicle_max_cargo_volume; |
|
| 49 | - public $subtour_max_revenue; |
|
| 50 | - public $avoidance_zones; |
|
| 51 | - public $driver_id; |
|
| 52 | - public $parts_min; |
|
| 53 | - public $first_drive_then_wait_between_stops; |
|
| 54 | - public $truck_height; |
|
| 55 | - public $truck_width; |
|
| 56 | - public $truck_length; |
|
| 57 | - public $optimization_quality; |
|
| 58 | - public $override_addresses; |
|
| 59 | - public $max_tour_size; |
|
| 60 | - public $min_tour_size; |
|
| 61 | - public $uturn; |
|
| 62 | - public $leftturn; |
|
| 63 | - public $rightturn; |
|
| 47 | + public $vehicle_max_cargo_weight; |
|
| 48 | + public $vehicle_max_cargo_volume; |
|
| 49 | + public $subtour_max_revenue; |
|
| 50 | + public $avoidance_zones; |
|
| 51 | + public $driver_id; |
|
| 52 | + public $parts_min; |
|
| 53 | + public $first_drive_then_wait_between_stops; |
|
| 54 | + public $truck_height; |
|
| 55 | + public $truck_width; |
|
| 56 | + public $truck_length; |
|
| 57 | + public $optimization_quality; |
|
| 58 | + public $override_addresses; |
|
| 59 | + public $max_tour_size; |
|
| 60 | + public $min_tour_size; |
|
| 61 | + public $uturn; |
|
| 62 | + public $leftturn; |
|
| 63 | + public $rightturn; |
|
| 64 | 64 | |
| 65 | - public $optimized_callback_url; |
|
| 65 | + public $optimized_callback_url; |
|
| 66 | 66 | |
| 67 | - public static function fromArray(array $params) |
|
| 68 | - { |
|
| 69 | - $routeParams = new RouteParameters(); |
|
| 70 | - foreach ($params as $key => $value) { |
|
| 71 | - if (property_exists($routeParams, $key)) { |
|
| 72 | - $routeParams->{$key} = $value; |
|
| 73 | - } |
|
| 74 | - } |
|
| 67 | + public static function fromArray(array $params) |
|
| 68 | + { |
|
| 69 | + $routeParams = new RouteParameters(); |
|
| 70 | + foreach ($params as $key => $value) { |
|
| 71 | + if (property_exists($routeParams, $key)) { |
|
| 72 | + $routeParams->{$key} = $value; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return $routeParams; |
|
| 77 | - } |
|
| 76 | + return $routeParams; |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -4,17 +4,17 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Common |
| 6 | 6 | { |
| 7 | - public static function getValue($array, $item, $default = null) |
|
| 8 | - { |
|
| 9 | - return (isset($array[$item])) ? $array[$item] : $default; |
|
| 10 | - } |
|
| 7 | + public static function getValue($array, $item, $default = null) |
|
| 8 | + { |
|
| 9 | + return (isset($array[$item])) ? $array[$item] : $default; |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public function toArray() |
|
| 13 | - { |
|
| 14 | - $params = array_filter(get_object_vars($this), function($item) { |
|
| 15 | - return ($item!==null) && !(is_array($item) && !count($item)); |
|
| 16 | - }); |
|
| 12 | + public function toArray() |
|
| 13 | + { |
|
| 14 | + $params = array_filter(get_object_vars($this), function($item) { |
|
| 15 | + return ($item!==null) && !(is_array($item) && !count($item)); |
|
| 16 | + }); |
|
| 17 | 17 | |
| 18 | - return $params; |
|
| 19 | - } |
|
| 18 | + return $params; |
|
| 19 | + } |
|
| 20 | 20 | } |