@@ -3,26 +3,26 @@ |
||
3 | 3 | |
4 | 4 | class StatusUpdateType |
5 | 5 | { |
6 | - const PICKUP = 'pickup'; |
|
7 | - const DROPOFF = 'dropoff'; |
|
8 | - const NOANSWER = 'noanswer'; |
|
9 | - const NOTFOUND = 'notfound'; |
|
10 | - const NOTPAID = 'notpaid'; |
|
11 | - const PAID = 'paid'; |
|
12 | - const WRONGDELIVERY = 'wrongdelivery'; |
|
13 | - const WRONGADDRESSRECIPIENT = 'wrongaddressrecipient'; |
|
14 | - const NOTPRESENT = 'notpresent'; |
|
15 | - const PARTS_MISSING = 'parts_missing'; |
|
16 | - const SERVICE_RENDERED = 'service_rendered'; |
|
17 | - const FOLLOW_UP = 'follow_up'; |
|
18 | - const LEFT_INFORMATION = 'left_information'; |
|
19 | - const SPOKE_WITH_DECISION_MAKER = 'spoke_with_decision_maker'; |
|
20 | - const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
21 | - const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
22 | - const COMPETITIVE_ACCOUNT = 'competitive_account'; |
|
23 | - const SCHEDULED_FOLLOW_UP_MEETING = 'scheduled_follow_up_meeting'; |
|
24 | - const SCHEDULED_LUNCH = 'scheduled_lunch'; |
|
25 | - const SCHEDULED_PRODUCT_DEMO = 'scheduled_product_demo'; |
|
26 | - const SCHEDULED_CLINICAL_DEMO = 'scheduled_clinical_demo'; |
|
27 | - const NO_OPPORTUNITY = 'no_opportunity'; |
|
6 | + const PICKUP = 'pickup'; |
|
7 | + const DROPOFF = 'dropoff'; |
|
8 | + const NOANSWER = 'noanswer'; |
|
9 | + const NOTFOUND = 'notfound'; |
|
10 | + const NOTPAID = 'notpaid'; |
|
11 | + const PAID = 'paid'; |
|
12 | + const WRONGDELIVERY = 'wrongdelivery'; |
|
13 | + const WRONGADDRESSRECIPIENT = 'wrongaddressrecipient'; |
|
14 | + const NOTPRESENT = 'notpresent'; |
|
15 | + const PARTS_MISSING = 'parts_missing'; |
|
16 | + const SERVICE_RENDERED = 'service_rendered'; |
|
17 | + const FOLLOW_UP = 'follow_up'; |
|
18 | + const LEFT_INFORMATION = 'left_information'; |
|
19 | + const SPOKE_WITH_DECISION_MAKER = 'spoke_with_decision_maker'; |
|
20 | + const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
21 | + const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
22 | + const COMPETITIVE_ACCOUNT = 'competitive_account'; |
|
23 | + const SCHEDULED_FOLLOW_UP_MEETING = 'scheduled_follow_up_meeting'; |
|
24 | + const SCHEDULED_LUNCH = 'scheduled_lunch'; |
|
25 | + const SCHEDULED_PRODUCT_DEMO = 'scheduled_product_demo'; |
|
26 | + const SCHEDULED_CLINICAL_DEMO = 'scheduled_clinical_demo'; |
|
27 | + const NO_OPPORTUNITY = 'no_opportunity'; |
|
28 | 28 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class OptimizationType |
5 | 5 | { |
6 | - const DISTANCE = 'Distance'; |
|
7 | - const TIME = 'Time'; |
|
8 | - const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
6 | + const DISTANCE = 'Distance'; |
|
7 | + const TIME = 'Time'; |
|
8 | + const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
9 | 9 | } |
@@ -3,10 +3,10 @@ |
||
3 | 3 | |
4 | 4 | class OptimizationStates |
5 | 5 | { |
6 | - const INITIAL = 1; |
|
7 | - const MATRIX_PROCESSING = 2; |
|
8 | - const OPTIMIZING = 3; |
|
9 | - const OPTIMIZED = 4; |
|
10 | - const ERROR = 5; |
|
11 | - const COMPUTING_DIRECTIONS = 6; |
|
6 | + const INITIAL = 1; |
|
7 | + const MATRIX_PROCESSING = 2; |
|
8 | + const OPTIMIZING = 3; |
|
9 | + const OPTIMIZED = 4; |
|
10 | + const ERROR = 5; |
|
11 | + const COMPUTING_DIRECTIONS = 6; |
|
12 | 12 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class TerritoryTypes |
5 | 5 | { |
6 | - const CIRCLE = 'circle'; |
|
7 | - const POLY = 'poly'; |
|
8 | - const RECT = 'rect'; |
|
6 | + const CIRCLE = 'circle'; |
|
7 | + const POLY = 'poly'; |
|
8 | + const RECT = 'rect'; |
|
9 | 9 | } |
@@ -44,18 +44,18 @@ |
||
44 | 44 | const ORDER_V4 = '/api.v4/order.php'; |
45 | 45 | |
46 | 46 | const ROUTE_V4 = '/api.v4/route.php'; |
47 | - const ROUTE_DUPLICATE ='/actions/duplicate_route.php'; |
|
48 | - const ROUTES_DELETE ='/actions/delete_routes.php'; |
|
49 | - const REOPTIMIZE_V3_2 ='/api.v3/route/reoptimize_2.php'; |
|
50 | - const ROUTES_MERGE ='/actions/merge_routes.php'; |
|
51 | - const ROUTE_SHARE ='/actions/route/share_route.php'; |
|
52 | - const ROUTE_NOTES_ADD ='/actions/addRouteNotes.php'; |
|
53 | - const STATUS_V4 ='/api.v4/status.php'; |
|
54 | - const GET_DEVICE_LOCATION ='/api/track/get_device_location.php'; |
|
55 | - |
|
56 | - const TRACK_SET ='/track/set.php'; |
|
57 | - |
|
58 | - const NOTE_CUSTOM_TYPES_V4 ='/api.v4/note_custom_types.php'; |
|
47 | + const ROUTE_DUPLICATE = '/actions/duplicate_route.php'; |
|
48 | + const ROUTES_DELETE = '/actions/delete_routes.php'; |
|
49 | + const REOPTIMIZE_V3_2 = '/api.v3/route/reoptimize_2.php'; |
|
50 | + const ROUTES_MERGE = '/actions/merge_routes.php'; |
|
51 | + const ROUTE_SHARE = '/actions/route/share_route.php'; |
|
52 | + const ROUTE_NOTES_ADD = '/actions/addRouteNotes.php'; |
|
53 | + const STATUS_V4 = '/api.v4/status.php'; |
|
54 | + const GET_DEVICE_LOCATION = '/api/track/get_device_location.php'; |
|
55 | + |
|
56 | + const TRACK_SET = '/track/set.php'; |
|
57 | + |
|
58 | + const NOTE_CUSTOM_TYPES_V4 = '/api.v4/note_custom_types.php'; |
|
59 | 59 | |
60 | 60 | const VEHICLE_V4 = '/api/vehicles'; |
61 | 61 | } |
@@ -3,13 +3,13 @@ |
||
3 | 3 | |
4 | 4 | class AlgorithmType |
5 | 5 | { |
6 | - const TSP = 1; |
|
7 | - const VRP = 2; |
|
8 | - const CVRP_TW_SD = 3; |
|
9 | - const CVRP_TW_MD = 4; |
|
10 | - const TSP_TW = 5; |
|
11 | - const TSP_TW_CR = 6; |
|
12 | - const BBCVRP = 7; |
|
13 | - const ALG_NONE = 100; |
|
14 | - const ALG_LEGACY_DISTRIBUTED = 101; |
|
6 | + const TSP = 1; |
|
7 | + const VRP = 2; |
|
8 | + const CVRP_TW_SD = 3; |
|
9 | + const CVRP_TW_MD = 4; |
|
10 | + const TSP_TW = 5; |
|
11 | + const TSP_TW_CR = 6; |
|
12 | + const BBCVRP = 7; |
|
13 | + const ALG_NONE = 100; |
|
14 | + const ALG_LEGACY_DISTRIBUTED = 101; |
|
15 | 15 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | const TSP_TW = 5; |
11 | 11 | const TSP_TW_CR = 6; |
12 | 12 | const BBCVRP = 7; |
13 | - const ALG_NONE = 100; |
|
13 | + const ALG_NONE = 100; |
|
14 | 14 | const ALG_LEGACY_DISTRIBUTED = 101; |
15 | 15 | } |
@@ -6,179 +6,179 @@ |
||
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 | - $response = Route4Me::makeRequst(array( |
|
81 | - 'url' => Endpoint::VEHICLE_V4, |
|
82 | - 'method' => 'GET', |
|
83 | - 'query' => array( |
|
84 | - 'with_pagination' => isset($params['with_pagination']) ? $params['with_pagination'] : null, |
|
85 | - 'page' => isset($params['page']) ? $params['page'] : null, |
|
86 | - 'perPage' => isset($params['perPage']) ? $params['perPage'] : null, |
|
87 | - ) |
|
88 | - )); |
|
78 | + public static function getVehicles($params) |
|
79 | + { |
|
80 | + $response = Route4Me::makeRequst(array( |
|
81 | + 'url' => Endpoint::VEHICLE_V4, |
|
82 | + 'method' => 'GET', |
|
83 | + 'query' => array( |
|
84 | + 'with_pagination' => isset($params['with_pagination']) ? $params['with_pagination'] : null, |
|
85 | + 'page' => isset($params['page']) ? $params['page'] : null, |
|
86 | + 'perPage' => isset($params['perPage']) ? $params['perPage'] : null, |
|
87 | + ) |
|
88 | + )); |
|
89 | 89 | |
90 | - return $response; |
|
91 | - } |
|
90 | + return $response; |
|
91 | + } |
|
92 | 92 | |
93 | - public function getRandomVehicleId($page,$perPage) |
|
94 | - { |
|
95 | - $query['page'] = isset($page) ? $page : 1; |
|
96 | - $query['perPage'] = isset($perPage) ? $perPage : 10; |
|
97 | - $query['with_pagination'] = true; |
|
93 | + public function getRandomVehicleId($page,$perPage) |
|
94 | + { |
|
95 | + $query['page'] = isset($page) ? $page : 1; |
|
96 | + $query['perPage'] = isset($perPage) ? $perPage : 10; |
|
97 | + $query['with_pagination'] = true; |
|
98 | 98 | |
99 | - $vehicles = $this->getVehicles($query); |
|
99 | + $vehicles = $this->getVehicles($query); |
|
100 | 100 | |
101 | - if (is_null($vehicles)) return null; |
|
102 | - if (!isset($vehicles['data'])) return null; |
|
103 | - if (sizeof($vehicles['data'])<1) return null; |
|
101 | + if (is_null($vehicles)) return null; |
|
102 | + if (!isset($vehicles['data'])) return null; |
|
103 | + if (sizeof($vehicles['data'])<1) return null; |
|
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 | - $body = array(); |
|
124 | + $body = array(); |
|
125 | 125 | |
126 | - $vehicle= new Vehicle(); |
|
126 | + $vehicle= new Vehicle(); |
|
127 | 127 | |
128 | - foreach($params as $key => $value) { |
|
129 | - if ($key=="vehicle_id") continue; |
|
130 | - if (property_exists($vehicle, $key)) { |
|
131 | - if (isset($params->{$key})) { |
|
132 | - $body[$key] = $params->{$key}; |
|
133 | - } |
|
134 | - } |
|
135 | - } |
|
128 | + foreach($params as $key => $value) { |
|
129 | + if ($key=="vehicle_id") continue; |
|
130 | + if (property_exists($vehicle, $key)) { |
|
131 | + if (isset($params->{$key})) { |
|
132 | + $body[$key] = $params->{$key}; |
|
133 | + } |
|
134 | + } |
|
135 | + } |
|
136 | 136 | |
137 | - $response = Route4Me::makeRequst(array( |
|
138 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
139 | - 'method' => 'PUT', |
|
140 | - 'body' => $body, |
|
141 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
142 | - )); |
|
137 | + $response = Route4Me::makeRequst(array( |
|
138 | + 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
139 | + 'method' => 'PUT', |
|
140 | + 'body' => $body, |
|
141 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
142 | + )); |
|
143 | 143 | |
144 | - return $response; |
|
145 | - } |
|
144 | + return $response; |
|
145 | + } |
|
146 | 146 | |
147 | - public function createVehicle($params) |
|
148 | - { |
|
149 | - $body = array(); |
|
147 | + public function createVehicle($params) |
|
148 | + { |
|
149 | + $body = array(); |
|
150 | 150 | |
151 | - $vehicle= new Vehicle(); |
|
151 | + $vehicle= new Vehicle(); |
|
152 | 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 | - } |
|
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 | 161 | |
162 | - $response = Route4Me::makeRequst(array( |
|
163 | - 'url' => Endpoint::VEHICLE_V4, |
|
164 | - 'method' => 'POST', |
|
165 | - 'body' => $body, |
|
166 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
167 | - )); |
|
162 | + $response = Route4Me::makeRequst(array( |
|
163 | + 'url' => Endpoint::VEHICLE_V4, |
|
164 | + 'method' => 'POST', |
|
165 | + 'body' => $body, |
|
166 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
167 | + )); |
|
168 | 168 | |
169 | - return $response; |
|
170 | - } |
|
169 | + return $response; |
|
170 | + } |
|
171 | 171 | |
172 | - public function removeVehicle($params) |
|
173 | - { |
|
174 | - $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
172 | + public function removeVehicle($params) |
|
173 | + { |
|
174 | + $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
175 | 175 | |
176 | - $response = Route4Me::makeRequst(array( |
|
177 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
178 | - 'method' => 'DELETE', |
|
179 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
180 | - )); |
|
176 | + $response = Route4Me::makeRequst(array( |
|
177 | + 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
178 | + 'method' => 'DELETE', |
|
179 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
180 | + )); |
|
181 | 181 | |
182 | - return $response; |
|
183 | - } |
|
182 | + return $response; |
|
183 | + } |
|
184 | 184 | } |
@@ -59,14 +59,14 @@ 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(); |
|
69 | - foreach($params as $key => $value) { |
|
68 | + $vehicle = new Vehicle(); |
|
69 | + foreach ($params as $key => $value) { |
|
70 | 70 | if (property_exists($vehicle, $key)) { |
71 | 71 | $vehicle->{$key} = $value; |
72 | 72 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return $response; |
91 | 91 | } |
92 | 92 | |
93 | - public function getRandomVehicleId($page,$perPage) |
|
93 | + public function getRandomVehicleId($page, $perPage) |
|
94 | 94 | { |
95 | 95 | $query['page'] = isset($page) ? $page : 1; |
96 | 96 | $query['perPage'] = isset($perPage) ? $perPage : 10; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if (!isset($vehicles['data'])) return null; |
103 | 103 | if (sizeof($vehicles['data'])<1) return null; |
104 | 104 | |
105 | - $randomIndex = rand(0, sizeof($vehicles['data'])-1); |
|
105 | + $randomIndex = rand(0, sizeof($vehicles['data']) - 1); |
|
106 | 106 | |
107 | 107 | return $vehicles['data'][$randomIndex]['vehicle_id']; |
108 | 108 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public function getVehicleByID($vehicleID) |
111 | 111 | { |
112 | 112 | $response = Route4Me::makeRequst(array( |
113 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
113 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
114 | 114 | 'method' => 'GET' |
115 | 115 | )); |
116 | 116 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | |
124 | 124 | $body = array(); |
125 | 125 | |
126 | - $vehicle= new Vehicle(); |
|
126 | + $vehicle = new Vehicle(); |
|
127 | 127 | |
128 | - foreach($params as $key => $value) { |
|
128 | + foreach ($params as $key => $value) { |
|
129 | 129 | if ($key=="vehicle_id") continue; |
130 | 130 | if (property_exists($vehicle, $key)) { |
131 | 131 | if (isset($params->{$key})) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $response = Route4Me::makeRequst(array( |
138 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
138 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
139 | 139 | 'method' => 'PUT', |
140 | 140 | 'body' => $body, |
141 | 141 | 'HTTPHEADER' => 'Content-Type: application/json' |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | { |
149 | 149 | $body = array(); |
150 | 150 | |
151 | - $vehicle= new Vehicle(); |
|
151 | + $vehicle = new Vehicle(); |
|
152 | 152 | |
153 | - foreach($params as $key => $value) { |
|
153 | + foreach ($params as $key => $value) { |
|
154 | 154 | if ($key=="vehicle_id") continue; |
155 | 155 | if (property_exists($vehicle, $key)) { |
156 | 156 | if (isset($params->{$key})) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
175 | 175 | |
176 | 176 | $response = Route4Me::makeRequst(array( |
177 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
177 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
178 | 178 | 'method' => 'DELETE', |
179 | 179 | 'HTTPHEADER' => 'Content-Type: application/json' |
180 | 180 | )); |
@@ -98,9 +98,15 @@ discard block |
||
98 | 98 | |
99 | 99 | $vehicles = $this->getVehicles($query); |
100 | 100 | |
101 | - if (is_null($vehicles)) return null; |
|
102 | - if (!isset($vehicles['data'])) return null; |
|
103 | - if (sizeof($vehicles['data'])<1) return null; |
|
101 | + if (is_null($vehicles)) { |
|
102 | + return null; |
|
103 | + } |
|
104 | + if (!isset($vehicles['data'])) { |
|
105 | + return null; |
|
106 | + } |
|
107 | + if (sizeof($vehicles['data'])<1) { |
|
108 | + return null; |
|
109 | + } |
|
104 | 110 | |
105 | 111 | $randomIndex = rand(0, sizeof($vehicles['data'])-1); |
106 | 112 | |
@@ -126,7 +132,9 @@ discard block |
||
126 | 132 | $vehicle= new Vehicle(); |
127 | 133 | |
128 | 134 | foreach($params as $key => $value) { |
129 | - if ($key=="vehicle_id") continue; |
|
135 | + if ($key=="vehicle_id") { |
|
136 | + continue; |
|
137 | + } |
|
130 | 138 | if (property_exists($vehicle, $key)) { |
131 | 139 | if (isset($params->{$key})) { |
132 | 140 | $body[$key] = $params->{$key}; |
@@ -151,7 +159,9 @@ discard block |
||
151 | 159 | $vehicle= new Vehicle(); |
152 | 160 | |
153 | 161 | foreach($params as $key => $value) { |
154 | - if ($key=="vehicle_id") continue; |
|
162 | + if ($key=="vehicle_id") { |
|
163 | + continue; |
|
164 | + } |
|
155 | 165 | if (property_exists($vehicle, $key)) { |
156 | 166 | if (isset($params->{$key})) { |
157 | 167 | $body[$key] = $params->{$key}; |
@@ -6,378 +6,378 @@ |
||
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 $webiinar_date; |
|
26 | + public $email_address; |
|
27 | + public $first_name; |
|
28 | + public $last_name; |
|
29 | + public $phone_number; |
|
30 | + public $company_name; |
|
31 | + public $webiinar_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(); |
|
66 | + public static function fromArray(array $params) |
|
67 | + { |
|
68 | + $member= new Member(); |
|
69 | 69 | |
70 | - foreach($params as $key => $value) { |
|
71 | - if (property_exists($member, $key)) { |
|
72 | - $member->{$key} = $value; |
|
73 | - } |
|
74 | - } |
|
70 | + foreach($params as $key => $value) { |
|
71 | + if (property_exists($member, $key)) { |
|
72 | + $member->{$key} = $value; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - return $member; |
|
77 | - } |
|
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($body) |
|
116 | - { |
|
117 | - $response = Route4Me::makeRequst(array( |
|
118 | - 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
119 | - 'method' => 'POST', |
|
120 | - 'query' => array( |
|
121 | - 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
122 | - 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
123 | - ), |
|
124 | - 'body' => array( |
|
125 | - 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
126 | - 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
127 | - 'format' => isset($body->format) ? $body->format : null |
|
128 | - ) |
|
115 | + public static function addDeviceRecord($body) |
|
116 | + { |
|
117 | + $response = Route4Me::makeRequst(array( |
|
118 | + 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
119 | + 'method' => 'POST', |
|
120 | + 'query' => array( |
|
121 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
122 | + 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
123 | + ), |
|
124 | + 'body' => array( |
|
125 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
126 | + 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
127 | + 'format' => isset($body->format) ? $body->format : null |
|
128 | + ) |
|
129 | 129 | |
130 | - )); |
|
130 | + )); |
|
131 | 131 | |
132 | - return $response; |
|
133 | - } |
|
132 | + return $response; |
|
133 | + } |
|
134 | 134 | |
135 | - public static function createMember($body) |
|
136 | - { |
|
137 | - $response = Route4Me::makeRequst(array( |
|
138 | - 'url' => Endpoint::USER_V4, |
|
139 | - 'method' => 'POST', |
|
140 | - 'body' => array( |
|
141 | - 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null, |
|
142 | - 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
143 | - 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
144 | - 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
145 | - 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
146 | - 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
147 | - 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
148 | - 'member_type' => isset($body->member_type) ? $body->member_type : null, |
|
149 | - 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
150 | - 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
151 | - 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
152 | - 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
153 | - 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
154 | - 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
155 | - 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
156 | - ) |
|
157 | - )); |
|
135 | + public static function createMember($body) |
|
136 | + { |
|
137 | + $response = Route4Me::makeRequst(array( |
|
138 | + 'url' => Endpoint::USER_V4, |
|
139 | + 'method' => 'POST', |
|
140 | + 'body' => array( |
|
141 | + 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null, |
|
142 | + 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
143 | + 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
144 | + 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
145 | + 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
146 | + 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
147 | + 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
148 | + 'member_type' => isset($body->member_type) ? $body->member_type : null, |
|
149 | + 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
150 | + 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
151 | + 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
152 | + 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
153 | + 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
154 | + 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
155 | + 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
156 | + ) |
|
157 | + )); |
|
158 | 158 | |
159 | - return $response; |
|
160 | - } |
|
159 | + return $response; |
|
160 | + } |
|
161 | 161 | |
162 | - public static function getRandomMemberByType($memberType) |
|
163 | - { |
|
164 | - $members = self::getUsers(); |
|
162 | + public static function getRandomMemberByType($memberType) |
|
163 | + { |
|
164 | + $members = self::getUsers(); |
|
165 | 165 | |
166 | - if (is_null($members)) return null; |
|
167 | - if (!isset($members['results'])) return null; |
|
166 | + if (is_null($members)) return null; |
|
167 | + if (!isset($members['results'])) return null; |
|
168 | 168 | |
169 | - $memberIDs = array(); |
|
169 | + $memberIDs = array(); |
|
170 | 170 | |
171 | - foreach ($members['results'] as $memb) { |
|
172 | - if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
173 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
174 | - } |
|
175 | - } |
|
171 | + foreach ($members['results'] as $memb) { |
|
172 | + if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
173 | + if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
174 | + } |
|
175 | + } |
|
176 | 176 | |
177 | - if (sizeof($memberIDs)<1) return null; |
|
177 | + if (sizeof($memberIDs)<1) return null; |
|
178 | 178 | |
179 | - $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
179 | + $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
180 | 180 | |
181 | - return $memberIDs[$randomIndex]; |
|
182 | - } |
|
181 | + return $memberIDs[$randomIndex]; |
|
182 | + } |
|
183 | 183 | |
184 | 184 | |
185 | - public static function updateMember($body) |
|
186 | - { |
|
187 | - $response = Route4Me::makeRequst(array( |
|
188 | - 'url' => Endpoint::USER_V4, |
|
189 | - 'method' => 'PUT', |
|
190 | - 'body' => array( |
|
191 | - 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
192 | - 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
193 | - 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null, |
|
194 | - 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
195 | - 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
196 | - 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
197 | - 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
198 | - 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
199 | - 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
200 | - 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
201 | - 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
202 | - 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
203 | - 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
204 | - 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
205 | - 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
206 | - ) |
|
185 | + public static function updateMember($body) |
|
186 | + { |
|
187 | + $response = Route4Me::makeRequst(array( |
|
188 | + 'url' => Endpoint::USER_V4, |
|
189 | + 'method' => 'PUT', |
|
190 | + 'body' => array( |
|
191 | + 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
192 | + 'member_phone' => isset($body->member_phone) ? $body->member_phone : null, |
|
193 | + 'HIDE_ROUTED_ADDRESSES' => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null, |
|
194 | + 'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null, |
|
195 | + 'route_count' => isset($body->route_count) ? $body->route_count : null, |
|
196 | + 'member_email' => isset($body->member_email) ? $body->member_email : null, |
|
197 | + 'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null, |
|
198 | + 'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null, |
|
199 | + 'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null, |
|
200 | + 'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null, |
|
201 | + 'member_password' => isset($body->member_password) ? $body->member_password : null, |
|
202 | + 'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null, |
|
203 | + 'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null, |
|
204 | + 'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null, |
|
205 | + 'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null |
|
206 | + ) |
|
207 | 207 | |
208 | - )); |
|
208 | + )); |
|
209 | 209 | |
210 | - return $response; |
|
211 | - } |
|
210 | + return $response; |
|
211 | + } |
|
212 | 212 | |
213 | - public static function deleteMember($body) |
|
214 | - { |
|
215 | - $response = Route4Me::makeRequst(array( |
|
216 | - 'url' => Endpoint::USER_V4, |
|
217 | - 'method' => 'DELETE', |
|
218 | - 'body' => array( |
|
219 | - 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
220 | - ) |
|
213 | + public static function deleteMember($body) |
|
214 | + { |
|
215 | + $response = Route4Me::makeRequst(array( |
|
216 | + 'url' => Endpoint::USER_V4, |
|
217 | + 'method' => 'DELETE', |
|
218 | + 'body' => array( |
|
219 | + 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
220 | + ) |
|
221 | 221 | |
222 | - )); |
|
222 | + )); |
|
223 | 223 | |
224 | - return $response; |
|
225 | - } |
|
224 | + return $response; |
|
225 | + } |
|
226 | 226 | |
227 | - public static function newAccountRegistration($body) |
|
228 | - { |
|
229 | - $response = Route4Me::makeRequst(array( |
|
230 | - 'url' => Endpoint::REGISTER_ACTION, |
|
231 | - 'method' => 'POST', |
|
232 | - 'query' => array( |
|
233 | - 'plan' => isset($body->plan) ? $body->plan : null |
|
234 | - ), |
|
235 | - 'body' => array( |
|
236 | - 'strEmail' => isset($body->strEmail) ? $body->strEmail : null, |
|
237 | - 'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null, |
|
238 | - 'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null, |
|
239 | - 'strFirstName' => isset($body->strFirstName) ? $body->strFirstName : null, |
|
240 | - 'strLastName' => isset($body->strLastName) ? $body->strLastName : null, |
|
241 | - 'format' => isset($body->format) ? $body->format : null, |
|
242 | - 'strIndustry' => isset($body->strIndustry) ? $body->strIndustry : null, |
|
243 | - 'chkTerms' => isset($body->chkTerms) ? $body->chkTerms : null, |
|
244 | - 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
245 | - 'strSubAccountType' => isset($body->strSubAccountType) ? $body->strSubAccountType : null, |
|
246 | - 'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing : false, |
|
247 | - 'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) |
|
248 | - ? $body->blDisableAccountActivationEmail : false |
|
249 | - ), |
|
250 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
251 | - )); |
|
227 | + public static function newAccountRegistration($body) |
|
228 | + { |
|
229 | + $response = Route4Me::makeRequst(array( |
|
230 | + 'url' => Endpoint::REGISTER_ACTION, |
|
231 | + 'method' => 'POST', |
|
232 | + 'query' => array( |
|
233 | + 'plan' => isset($body->plan) ? $body->plan : null |
|
234 | + ), |
|
235 | + 'body' => array( |
|
236 | + 'strEmail' => isset($body->strEmail) ? $body->strEmail : null, |
|
237 | + 'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null, |
|
238 | + 'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null, |
|
239 | + 'strFirstName' => isset($body->strFirstName) ? $body->strFirstName : null, |
|
240 | + 'strLastName' => isset($body->strLastName) ? $body->strLastName : null, |
|
241 | + 'format' => isset($body->format) ? $body->format : null, |
|
242 | + 'strIndustry' => isset($body->strIndustry) ? $body->strIndustry : null, |
|
243 | + 'chkTerms' => isset($body->chkTerms) ? $body->chkTerms : null, |
|
244 | + 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
245 | + 'strSubAccountType' => isset($body->strSubAccountType) ? $body->strSubAccountType : null, |
|
246 | + 'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing : false, |
|
247 | + 'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) |
|
248 | + ? $body->blDisableAccountActivationEmail : false |
|
249 | + ), |
|
250 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
251 | + )); |
|
252 | 252 | |
253 | - return $response; |
|
254 | - } |
|
253 | + return $response; |
|
254 | + } |
|
255 | 255 | |
256 | - public static function validateSession($params) |
|
257 | - { |
|
258 | - $response = Route4Me::makeRequst(array( |
|
259 | - 'url' => Endpoint::VALIDATE_SESSION, |
|
260 | - 'method' => 'GET', |
|
261 | - 'query' => array( |
|
262 | - 'session_guid' => isset($params->session_guid) ? $params->session_guid : null, |
|
263 | - 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
264 | - 'format' => isset($params->format) ? $params->format : null |
|
265 | - ) |
|
266 | - )); |
|
256 | + public static function validateSession($params) |
|
257 | + { |
|
258 | + $response = Route4Me::makeRequst(array( |
|
259 | + 'url' => Endpoint::VALIDATE_SESSION, |
|
260 | + 'method' => 'GET', |
|
261 | + 'query' => array( |
|
262 | + 'session_guid' => isset($params->session_guid) ? $params->session_guid : null, |
|
263 | + 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
264 | + 'format' => isset($params->format) ? $params->format : null |
|
265 | + ) |
|
266 | + )); |
|
267 | 267 | |
268 | - return $response; |
|
269 | - } |
|
268 | + return $response; |
|
269 | + } |
|
270 | 270 | |
271 | - public static function memberAuthentication($body) |
|
272 | - { |
|
273 | - $response = Route4Me::makeRequst(array( |
|
274 | - 'url' => Endpoint::AUTHENTICATE, |
|
275 | - 'method' => 'POST', |
|
276 | - 'body' => array( |
|
277 | - 'strEmail' => isset($body->strEmail) ? $body->strEmail : null, |
|
278 | - 'strPassword' => isset($body->strPassword) ? $body->strPassword : null, |
|
279 | - 'format' => isset($body->format) ? $body->format : null |
|
280 | - ), |
|
281 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
282 | - )); |
|
271 | + public static function memberAuthentication($body) |
|
272 | + { |
|
273 | + $response = Route4Me::makeRequst(array( |
|
274 | + 'url' => Endpoint::AUTHENTICATE, |
|
275 | + 'method' => 'POST', |
|
276 | + 'body' => array( |
|
277 | + 'strEmail' => isset($body->strEmail) ? $body->strEmail : null, |
|
278 | + 'strPassword' => isset($body->strPassword) ? $body->strPassword : null, |
|
279 | + 'format' => isset($body->format) ? $body->format : null |
|
280 | + ), |
|
281 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
282 | + )); |
|
283 | 283 | |
284 | - return $response; |
|
285 | - } |
|
284 | + return $response; |
|
285 | + } |
|
286 | 286 | |
287 | - public static function webinarRegistration($body) |
|
288 | - { |
|
289 | - $response = Route4Me::makeRequst(array( |
|
290 | - 'url' => Endpoint::WEBINAR_REGISTER, |
|
291 | - 'method' => 'POST', |
|
292 | - 'body' => array( |
|
293 | - 'email_address' => isset($body->email_address) ? $body->email_address : null, |
|
294 | - 'first_name' => isset($body->first_name) ? $body->first_name : null, |
|
295 | - 'last_name' => isset($body->last_name) ? $body->last_name : null, |
|
296 | - 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
297 | - 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
298 | - 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
299 | - 'webiinar_date' => isset($body->webiinar_date) ? $body->webiinar_date : null, |
|
300 | - ) |
|
287 | + public static function webinarRegistration($body) |
|
288 | + { |
|
289 | + $response = Route4Me::makeRequst(array( |
|
290 | + 'url' => Endpoint::WEBINAR_REGISTER, |
|
291 | + 'method' => 'POST', |
|
292 | + 'body' => array( |
|
293 | + 'email_address' => isset($body->email_address) ? $body->email_address : null, |
|
294 | + 'first_name' => isset($body->first_name) ? $body->first_name : null, |
|
295 | + 'last_name' => isset($body->last_name) ? $body->last_name : null, |
|
296 | + 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
297 | + 'phone_number' => isset($body->phone_number) ? $body->phone_number : null, |
|
298 | + 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
299 | + 'webiinar_date' => isset($body->webiinar_date) ? $body->webiinar_date : null, |
|
300 | + ) |
|
301 | 301 | |
302 | - )); |
|
302 | + )); |
|
303 | 303 | |
304 | - return $response; |
|
305 | - } |
|
304 | + return $response; |
|
305 | + } |
|
306 | 306 | |
307 | - public static function purchaseUserLicense($body) |
|
308 | - { |
|
309 | - $response = Route4Me::makeRequst(array( |
|
310 | - 'url' => Endpoint::USER_LICENSE, |
|
311 | - 'method' => 'POST', |
|
312 | - 'query' => array( |
|
313 | - 'device_id' => isset($body->device_id) ? $body->device_id : null |
|
314 | - ), |
|
315 | - 'body' => array( |
|
316 | - 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
317 | - 'session_guid' => isset($body->session_guid) ? $body->session_guid : null, |
|
318 | - 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
319 | - 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
320 | - 'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null, |
|
321 | - 'token' => isset($body->token) ? $body->token : null, |
|
322 | - 'payload' => isset($body->payload) ? $body->payload : null, |
|
323 | - 'format' => isset($body->format) ? $body->format : null, |
|
324 | - ) |
|
325 | - )); |
|
307 | + public static function purchaseUserLicense($body) |
|
308 | + { |
|
309 | + $response = Route4Me::makeRequst(array( |
|
310 | + 'url' => Endpoint::USER_LICENSE, |
|
311 | + 'method' => 'POST', |
|
312 | + 'query' => array( |
|
313 | + 'device_id' => isset($body->device_id) ? $body->device_id : null |
|
314 | + ), |
|
315 | + 'body' => array( |
|
316 | + 'member_id' => isset($body->member_id) ? $body->member_id : null, |
|
317 | + 'session_guid' => isset($body->session_guid) ? $body->session_guid : null, |
|
318 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
319 | + 'device_type' => isset($body->device_type) ? $body->device_type : null, |
|
320 | + 'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null, |
|
321 | + 'token' => isset($body->token) ? $body->token : null, |
|
322 | + 'payload' => isset($body->payload) ? $body->payload : null, |
|
323 | + 'format' => isset($body->format) ? $body->format : null, |
|
324 | + ) |
|
325 | + )); |
|
326 | 326 | |
327 | - return $response; |
|
328 | - } |
|
327 | + return $response; |
|
328 | + } |
|
329 | 329 | |
330 | - public static function newMemberConfigKey($body) |
|
331 | - { |
|
332 | - $response = Route4Me::makeRequst(array( |
|
333 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
334 | - 'method' => 'POST', |
|
335 | - 'body' => array( |
|
336 | - 'config_key' => isset($body->config_key) ? $body->config_key : null, |
|
337 | - 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
338 | - ) |
|
339 | - )); |
|
330 | + public static function newMemberConfigKey($body) |
|
331 | + { |
|
332 | + $response = Route4Me::makeRequst(array( |
|
333 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
334 | + 'method' => 'POST', |
|
335 | + 'body' => array( |
|
336 | + 'config_key' => isset($body->config_key) ? $body->config_key : null, |
|
337 | + 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
338 | + ) |
|
339 | + )); |
|
340 | 340 | |
341 | - return $response; |
|
342 | - } |
|
341 | + return $response; |
|
342 | + } |
|
343 | 343 | |
344 | - public static function removeMemberConfigKey($body) |
|
345 | - { |
|
346 | - $response = Route4Me::makeRequst(array( |
|
347 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
348 | - 'method' => 'DELETE', |
|
349 | - 'body' => array( |
|
350 | - 'config_key' => isset($body->config_key) ? $body->config_key : null |
|
351 | - ) |
|
352 | - )); |
|
344 | + public static function removeMemberConfigKey($body) |
|
345 | + { |
|
346 | + $response = Route4Me::makeRequst(array( |
|
347 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
348 | + 'method' => 'DELETE', |
|
349 | + 'body' => array( |
|
350 | + 'config_key' => isset($body->config_key) ? $body->config_key : null |
|
351 | + ) |
|
352 | + )); |
|
353 | 353 | |
354 | - return $response; |
|
355 | - } |
|
354 | + return $response; |
|
355 | + } |
|
356 | 356 | |
357 | - public static function getMemberConfigData($body) |
|
358 | - { |
|
359 | - $response = Route4Me::makeRequst(array( |
|
360 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
361 | - 'method' => 'GET', |
|
362 | - 'query' => array( |
|
363 | - 'config_key' => isset($body->config_key) ? $body->config_key : null |
|
364 | - ) |
|
365 | - )); |
|
357 | + public static function getMemberConfigData($body) |
|
358 | + { |
|
359 | + $response = Route4Me::makeRequst(array( |
|
360 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
361 | + 'method' => 'GET', |
|
362 | + 'query' => array( |
|
363 | + 'config_key' => isset($body->config_key) ? $body->config_key : null |
|
364 | + ) |
|
365 | + )); |
|
366 | 366 | |
367 | - return $response; |
|
368 | - } |
|
367 | + return $response; |
|
368 | + } |
|
369 | 369 | |
370 | - public static function updateMemberConfigKey($body) |
|
371 | - { |
|
372 | - $response = Route4Me::makeRequst(array( |
|
373 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
374 | - 'method' => 'PUT', |
|
375 | - 'body' => array( |
|
376 | - 'config_key' => isset($body->config_key) ? $body->config_key : null, |
|
377 | - 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
378 | - ) |
|
379 | - )); |
|
370 | + public static function updateMemberConfigKey($body) |
|
371 | + { |
|
372 | + $response = Route4Me::makeRequst(array( |
|
373 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
374 | + 'method' => 'PUT', |
|
375 | + 'body' => array( |
|
376 | + 'config_key' => isset($body->config_key) ? $body->config_key : null, |
|
377 | + 'config_value' => isset($body->config_value) ? $body->config_value : null |
|
378 | + ) |
|
379 | + )); |
|
380 | 380 | |
381 | - return $response; |
|
382 | - } |
|
381 | + return $response; |
|
382 | + } |
|
383 | 383 | } |
@@ -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 | } |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
119 | 119 | 'method' => 'POST', |
120 | 120 | 'query' => array( |
121 | - 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
121 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
122 | 122 | 'device_type' => isset($body->device_type) ? $body->device_type : null, |
123 | 123 | ), |
124 | 124 | 'body' => array( |
125 | - 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
125 | + 'device_id' => isset($body->device_id) ? $body->device_id : null, |
|
126 | 126 | 'device_type' => isset($body->device_type) ? $body->device_type : null, |
127 | - 'format' => isset($body->format) ? $body->format : null |
|
127 | + 'format' => isset($body->format) ? $body->format : null |
|
128 | 128 | ) |
129 | 129 | |
130 | 130 | )); |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | |
171 | 171 | foreach ($members['results'] as $memb) { |
172 | 172 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
173 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
173 | + if ($memberType==$memb['member_type']) $memberIDs[] = $memb['member_id']; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | 177 | if (sizeof($memberIDs)<1) return null; |
178 | 178 | |
179 | - $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
179 | + $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
180 | 180 | |
181 | 181 | return $memberIDs[$randomIndex]; |
182 | 182 | } |
@@ -163,18 +163,26 @@ |
||
163 | 163 | { |
164 | 164 | $members = self::getUsers(); |
165 | 165 | |
166 | - if (is_null($members)) return null; |
|
167 | - if (!isset($members['results'])) return null; |
|
166 | + if (is_null($members)) { |
|
167 | + return null; |
|
168 | + } |
|
169 | + if (!isset($members['results'])) { |
|
170 | + return null; |
|
171 | + } |
|
168 | 172 | |
169 | 173 | $memberIDs = array(); |
170 | 174 | |
171 | 175 | foreach ($members['results'] as $memb) { |
172 | 176 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
173 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
177 | + if ($memberType==$memb['member_type']) { |
|
178 | + $memberIDs[]=$memb['member_id']; |
|
179 | + } |
|
174 | 180 | } |
175 | 181 | } |
176 | 182 | |
177 | - if (sizeof($memberIDs)<1) return null; |
|
183 | + if (sizeof($memberIDs)<1) { |
|
184 | + return null; |
|
185 | + } |
|
178 | 186 | |
179 | 187 | $randomIndex = rand(0, sizeof($memberIDs)-1); |
180 | 188 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class AvoidanceZone extends Common |
9 | 9 | { |
10 | - public $territory_id; // Avoidance zone id |
|
10 | + public $territory_id; // Avoidance zone id |
|
11 | 11 | public $territory_name; |
12 | 12 | public $territory_color; |
13 | 13 | public $orders; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $avoidanceZoneParameters = new AvoidanceZone(); |
32 | 32 | |
33 | - foreach($params as $key => $value) { |
|
33 | + foreach ($params as $key => $value) { |
|
34 | 34 | if (property_exists($avoidanceZoneParameters, $key)) { |
35 | 35 | $avoidanceZoneParameters->{$key} = $value; |
36 | 36 | } |
@@ -7,107 +7,107 @@ |
||
7 | 7 | |
8 | 8 | class AvoidanceZone extends Common |
9 | 9 | { |
10 | - public $territory_id; // Avoidance zone id |
|
11 | - public $territory_name; |
|
12 | - public $territory_color; |
|
13 | - public $orders; |
|
14 | - public $member_id; |
|
15 | - public $territory; // Territory parameters |
|
10 | + public $territory_id; // Avoidance zone id |
|
11 | + public $territory_name; |
|
12 | + public $territory_color; |
|
13 | + public $orders; |
|
14 | + public $member_id; |
|
15 | + public $territory; // Territory parameters |
|
16 | 16 | |
17 | - public static function fromArray(array $params) |
|
18 | - { |
|
19 | - if (!isset($params['territory_name'])) { |
|
20 | - throw new BadParam('Territory name must be provided'); |
|
21 | - } |
|
17 | + public static function fromArray(array $params) |
|
18 | + { |
|
19 | + if (!isset($params['territory_name'])) { |
|
20 | + throw new BadParam('Territory name must be provided'); |
|
21 | + } |
|
22 | 22 | |
23 | - if (!isset($params['territory_color'])) { |
|
24 | - throw new BadParam('Territory color must be provided'); |
|
25 | - } |
|
23 | + if (!isset($params['territory_color'])) { |
|
24 | + throw new BadParam('Territory color must be provided'); |
|
25 | + } |
|
26 | 26 | |
27 | - if (!isset($params['territory'])) { |
|
28 | - throw new BadParam('Territory must be provided'); |
|
29 | - } |
|
27 | + if (!isset($params['territory'])) { |
|
28 | + throw new BadParam('Territory must be provided'); |
|
29 | + } |
|
30 | 30 | |
31 | - $avoidanceZoneParameters = new AvoidanceZone(); |
|
31 | + $avoidanceZoneParameters = new AvoidanceZone(); |
|
32 | 32 | |
33 | - foreach($params as $key => $value) { |
|
34 | - if (property_exists($avoidanceZoneParameters, $key)) { |
|
35 | - $avoidanceZoneParameters->{$key} = $value; |
|
36 | - } |
|
37 | - } |
|
33 | + foreach($params as $key => $value) { |
|
34 | + if (property_exists($avoidanceZoneParameters, $key)) { |
|
35 | + $avoidanceZoneParameters->{$key} = $value; |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | - return $avoidanceZoneParameters; |
|
40 | - } |
|
39 | + return $avoidanceZoneParameters; |
|
40 | + } |
|
41 | 41 | |
42 | - public static function getAvoidanceZone($territory_id) |
|
43 | - { |
|
44 | - $avoidanceZone = Route4Me::makeRequst(array( |
|
45 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
46 | - 'method' => 'GET', |
|
47 | - 'query' => array( |
|
48 | - 'territory_id' => $territory_id |
|
49 | - ) |
|
50 | - )); |
|
42 | + public static function getAvoidanceZone($territory_id) |
|
43 | + { |
|
44 | + $avoidanceZone = Route4Me::makeRequst(array( |
|
45 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
46 | + 'method' => 'GET', |
|
47 | + 'query' => array( |
|
48 | + 'territory_id' => $territory_id |
|
49 | + ) |
|
50 | + )); |
|
51 | 51 | |
52 | - return $avoidanceZone; |
|
53 | - } |
|
52 | + return $avoidanceZone; |
|
53 | + } |
|
54 | 54 | |
55 | - public static function getAvoidanceZones($params) |
|
56 | - { |
|
57 | - $avoidanceZones = Route4Me::makeRequst(array( |
|
58 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
59 | - 'method' => 'GET', |
|
60 | - 'query' => array( |
|
61 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
62 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
63 | - ) |
|
64 | - )); |
|
55 | + public static function getAvoidanceZones($params) |
|
56 | + { |
|
57 | + $avoidanceZones = Route4Me::makeRequst(array( |
|
58 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
59 | + 'method' => 'GET', |
|
60 | + 'query' => array( |
|
61 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
62 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
63 | + ) |
|
64 | + )); |
|
65 | 65 | |
66 | - return $avoidanceZones; |
|
67 | - } |
|
66 | + return $avoidanceZones; |
|
67 | + } |
|
68 | 68 | |
69 | - public static function addAvoidanceZone($params) |
|
70 | - { |
|
71 | - $terParams = array(); |
|
69 | + public static function addAvoidanceZone($params) |
|
70 | + { |
|
71 | + $terParams = array(); |
|
72 | 72 | |
73 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
74 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
73 | + if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
74 | + if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
75 | 75 | |
76 | - $abContacts = Route4Me::makeRequst(array( |
|
77 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
78 | - 'method' => 'POST', |
|
79 | - 'body' => array( |
|
80 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
81 | - 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
82 | - 'territory' => $terParams |
|
83 | - ) |
|
84 | - )); |
|
76 | + $abContacts = Route4Me::makeRequst(array( |
|
77 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
78 | + 'method' => 'POST', |
|
79 | + 'body' => array( |
|
80 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
81 | + 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
82 | + 'territory' => $terParams |
|
83 | + ) |
|
84 | + )); |
|
85 | 85 | |
86 | - return $abContacts; |
|
87 | - } |
|
86 | + return $abContacts; |
|
87 | + } |
|
88 | 88 | |
89 | - public function deleteAvoidanceZone($territory_id) |
|
90 | - { |
|
91 | - $result = Route4Me::makeRequst(array( |
|
92 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
93 | - 'method' => 'DELETEARRAY', |
|
94 | - 'query' => array( |
|
95 | - 'territory_id' => $territory_id |
|
96 | - ) |
|
97 | - )); |
|
89 | + public function deleteAvoidanceZone($territory_id) |
|
90 | + { |
|
91 | + $result = Route4Me::makeRequst(array( |
|
92 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
93 | + 'method' => 'DELETEARRAY', |
|
94 | + 'query' => array( |
|
95 | + 'territory_id' => $territory_id |
|
96 | + ) |
|
97 | + )); |
|
98 | 98 | |
99 | - return $result; |
|
100 | - } |
|
99 | + return $result; |
|
100 | + } |
|
101 | 101 | |
102 | - public function updateAvoidanceZone($params) |
|
103 | - { |
|
104 | - $avoidanceZone = Route4Me::makeRequst(array( |
|
105 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
106 | - 'method' => 'PUT', |
|
107 | - 'body' => $params, |
|
102 | + public function updateAvoidanceZone($params) |
|
103 | + { |
|
104 | + $avoidanceZone = Route4Me::makeRequst(array( |
|
105 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
106 | + 'method' => 'PUT', |
|
107 | + 'body' => $params, |
|
108 | 108 | |
109 | - )); |
|
109 | + )); |
|
110 | 110 | |
111 | - return $avoidanceZone; |
|
112 | - } |
|
111 | + return $avoidanceZone; |
|
112 | + } |
|
113 | 113 | } |
@@ -70,8 +70,12 @@ |
||
70 | 70 | { |
71 | 71 | $terParams = array(); |
72 | 72 | |
73 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
74 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
73 | + if (isset($params->territory['type'])) { |
|
74 | + $terParams['type'] = $params->territory['type']; |
|
75 | + } |
|
76 | + if (isset($params->territory['data'])) { |
|
77 | + $terParams['data'] = $params->territory['data']; |
|
78 | + } |
|
75 | 79 | |
76 | 80 | $abContacts = Route4Me::makeRequst(array( |
77 | 81 | 'url' => Endpoint::AVOIDANCE_ZONE, |