@@ -11,15 +11,15 @@ |
||
11 | 11 | */ |
12 | 12 | class Direction extends Common |
13 | 13 | { |
14 | - /** |
|
15 | - * Starting location of a direction |
|
16 | - * @var DirectionLocation |
|
17 | - */ |
|
18 | - public $location = []; |
|
14 | + /** |
|
15 | + * Starting location of a direction |
|
16 | + * @var DirectionLocation |
|
17 | + */ |
|
18 | + public $location = []; |
|
19 | 19 | |
20 | - /** |
|
21 | - * The direction steps |
|
22 | - * @var DirectionStep[] |
|
23 | - */ |
|
24 | - public $steps = []; |
|
20 | + /** |
|
21 | + * The direction steps |
|
22 | + * @var DirectionStep[] |
|
23 | + */ |
|
24 | + public $steps = []; |
|
25 | 25 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class CustomNoteTypeResponse extends Common |
8 | 8 | { |
9 | - /** |
|
10 | - * Note custom type ID |
|
11 | - * @var integer |
|
12 | - */ |
|
13 | - public $note_custom_type_id; |
|
9 | + /** |
|
10 | + * Note custom type ID |
|
11 | + * @var integer |
|
12 | + */ |
|
13 | + public $note_custom_type_id; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Note custom type |
|
17 | - * @var CustomNoteType |
|
18 | - */ |
|
19 | - public $note_custom_type; |
|
15 | + /** |
|
16 | + * Note custom type |
|
17 | + * @var CustomNoteType |
|
18 | + */ |
|
19 | + public $note_custom_type; |
|
20 | 20 | |
21 | - /** |
|
22 | - * ID of a root owner of the account |
|
23 | - * @var integer |
|
24 | - */ |
|
25 | - public $root_owner_member_id; |
|
21 | + /** |
|
22 | + * ID of a root owner of the account |
|
23 | + * @var integer |
|
24 | + */ |
|
25 | + public $root_owner_member_id; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Values of the custom note type |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - public $note_custom_type_values=[]; |
|
27 | + /** |
|
28 | + * Values of the custom note type |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + public $note_custom_type_values=[]; |
|
32 | 32 | } |
@@ -28,5 +28,5 @@ |
||
28 | 28 | * Values of the custom note type |
29 | 29 | * @var array |
30 | 30 | */ |
31 | - public $note_custom_type_values=[]; |
|
31 | + public $note_custom_type_values = []; |
|
32 | 32 | } |
@@ -6,144 +6,144 @@ |
||
6 | 6 | |
7 | 7 | class AddressBookGroup extends Common |
8 | 8 | { |
9 | - public $group_id; |
|
10 | - public $group_name; |
|
11 | - public $group_color; |
|
12 | - public $group_icon; |
|
13 | - public $member_id; |
|
14 | - public $filter; |
|
15 | - |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | - } |
|
20 | - |
|
21 | - public static function getAddressBookGroup(array $params) |
|
22 | - { |
|
23 | - $abGroup = Route4Me::makeRequst([ |
|
24 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
25 | - 'method' => 'GET', |
|
26 | - 'query' => [ |
|
27 | - 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
28 | - ], |
|
29 | - ]); |
|
30 | - |
|
31 | - return $abGroup; |
|
32 | - } |
|
33 | - |
|
34 | - public static function updateAddressBookGroup(array $params) |
|
35 | - { |
|
36 | - $allBodyFields = ['group_id', 'group_color', 'group_icon', 'filter']; |
|
37 | - |
|
38 | - $abGroup = Route4Me::makeRequst([ |
|
39 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
40 | - 'method' => 'PUT', |
|
41 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
42 | - ]); |
|
43 | - |
|
44 | - return $abGroup; |
|
45 | - } |
|
46 | - |
|
47 | - public static function removeAddressBookGroup(array $params) |
|
48 | - { |
|
49 | - $allBodyFields = ['group_id']; |
|
50 | - |
|
51 | - $abGroup = Route4Me::makeRequst([ |
|
52 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
53 | - 'method' => 'DELETE', |
|
54 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
55 | - ]); |
|
56 | - |
|
57 | - return $abGroup; |
|
58 | - } |
|
59 | - |
|
60 | - public static function createAddressBookGroup(array $params) |
|
61 | - { |
|
62 | - $allBodyFields = ['group_name', 'group_color', 'group_icon', 'filter']; |
|
63 | - |
|
64 | - $abGroup = Route4Me::makeRequst([ |
|
65 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
66 | - 'method' => 'POST', |
|
67 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
68 | - ]); |
|
69 | - |
|
70 | - return $abGroup; |
|
71 | - } |
|
72 | - |
|
73 | - public static function searchAddressBookGroups(array $params) |
|
74 | - { |
|
75 | - $allBodyFields = ['fields', 'offset', 'limit', 'filter']; |
|
76 | - |
|
77 | - $abGroups = Route4Me::makeRequst([ |
|
78 | - 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
79 | - 'method' => 'POST', |
|
80 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
81 | - ]); |
|
82 | - |
|
83 | - return $abGroups; |
|
84 | - } |
|
85 | - |
|
86 | - public static function getAddressBookContactsByGroup(array $params) |
|
87 | - { |
|
88 | - $allBodyFields = ['fields', 'group_id']; |
|
89 | - |
|
90 | - $abGroups = Route4Me::makeRequst([ |
|
91 | - 'url' => Endpoint::ADDRESS_BOOK_SEARCH, |
|
92 | - 'method' => 'POST', |
|
93 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
94 | - ]); |
|
95 | - |
|
96 | - return $abGroups; |
|
97 | - } |
|
98 | - |
|
99 | - public static function getAddressBookGroups(array $params) |
|
100 | - { |
|
101 | - $abGroup = Route4Me::makeRequst([ |
|
102 | - 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
103 | - 'method' => 'GET', |
|
104 | - 'query' => [ |
|
105 | - 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
106 | - 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
107 | - ], |
|
108 | - ]); |
|
109 | - |
|
110 | - return $abGroup; |
|
111 | - } |
|
112 | - |
|
113 | - public static function getRandomAddressBookGroup(array $params) |
|
114 | - { |
|
115 | - $abGroups = self::getAddressBookGroups($params); |
|
116 | - |
|
117 | - if (isset($abGroups) && sizeof($abGroups) > 1) { |
|
118 | - $groupsSize = sizeof($abGroups); |
|
119 | - |
|
120 | - $randomGroupIndex = rand(0, $groupsSize - 1); |
|
121 | - |
|
122 | - return $abGroups[$randomGroupIndex]; |
|
123 | - } |
|
124 | - |
|
125 | - return null; |
|
126 | - } |
|
127 | - |
|
128 | - /* |
|
9 | + public $group_id; |
|
10 | + public $group_name; |
|
11 | + public $group_color; |
|
12 | + public $group_icon; |
|
13 | + public $member_id; |
|
14 | + public $filter; |
|
15 | + |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | + } |
|
20 | + |
|
21 | + public static function getAddressBookGroup(array $params) |
|
22 | + { |
|
23 | + $abGroup = Route4Me::makeRequst([ |
|
24 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
25 | + 'method' => 'GET', |
|
26 | + 'query' => [ |
|
27 | + 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
28 | + ], |
|
29 | + ]); |
|
30 | + |
|
31 | + return $abGroup; |
|
32 | + } |
|
33 | + |
|
34 | + public static function updateAddressBookGroup(array $params) |
|
35 | + { |
|
36 | + $allBodyFields = ['group_id', 'group_color', 'group_icon', 'filter']; |
|
37 | + |
|
38 | + $abGroup = Route4Me::makeRequst([ |
|
39 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
40 | + 'method' => 'PUT', |
|
41 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
42 | + ]); |
|
43 | + |
|
44 | + return $abGroup; |
|
45 | + } |
|
46 | + |
|
47 | + public static function removeAddressBookGroup(array $params) |
|
48 | + { |
|
49 | + $allBodyFields = ['group_id']; |
|
50 | + |
|
51 | + $abGroup = Route4Me::makeRequst([ |
|
52 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
53 | + 'method' => 'DELETE', |
|
54 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
55 | + ]); |
|
56 | + |
|
57 | + return $abGroup; |
|
58 | + } |
|
59 | + |
|
60 | + public static function createAddressBookGroup(array $params) |
|
61 | + { |
|
62 | + $allBodyFields = ['group_name', 'group_color', 'group_icon', 'filter']; |
|
63 | + |
|
64 | + $abGroup = Route4Me::makeRequst([ |
|
65 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
66 | + 'method' => 'POST', |
|
67 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
68 | + ]); |
|
69 | + |
|
70 | + return $abGroup; |
|
71 | + } |
|
72 | + |
|
73 | + public static function searchAddressBookGroups(array $params) |
|
74 | + { |
|
75 | + $allBodyFields = ['fields', 'offset', 'limit', 'filter']; |
|
76 | + |
|
77 | + $abGroups = Route4Me::makeRequst([ |
|
78 | + 'url' => Endpoint::ADDRESS_BOOK_V4, |
|
79 | + 'method' => 'POST', |
|
80 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
81 | + ]); |
|
82 | + |
|
83 | + return $abGroups; |
|
84 | + } |
|
85 | + |
|
86 | + public static function getAddressBookContactsByGroup(array $params) |
|
87 | + { |
|
88 | + $allBodyFields = ['fields', 'group_id']; |
|
89 | + |
|
90 | + $abGroups = Route4Me::makeRequst([ |
|
91 | + 'url' => Endpoint::ADDRESS_BOOK_SEARCH, |
|
92 | + 'method' => 'POST', |
|
93 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
94 | + ]); |
|
95 | + |
|
96 | + return $abGroups; |
|
97 | + } |
|
98 | + |
|
99 | + public static function getAddressBookGroups(array $params) |
|
100 | + { |
|
101 | + $abGroup = Route4Me::makeRequst([ |
|
102 | + 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
|
103 | + 'method' => 'GET', |
|
104 | + 'query' => [ |
|
105 | + 'offset' => isset($params['offset']) ? $params['offset'] : null, |
|
106 | + 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
107 | + ], |
|
108 | + ]); |
|
109 | + |
|
110 | + return $abGroup; |
|
111 | + } |
|
112 | + |
|
113 | + public static function getRandomAddressBookGroup(array $params) |
|
114 | + { |
|
115 | + $abGroups = self::getAddressBookGroups($params); |
|
116 | + |
|
117 | + if (isset($abGroups) && sizeof($abGroups) > 1) { |
|
118 | + $groupsSize = sizeof($abGroups); |
|
119 | + |
|
120 | + $randomGroupIndex = rand(0, $groupsSize - 1); |
|
121 | + |
|
122 | + return $abGroups[$randomGroupIndex]; |
|
123 | + } |
|
124 | + |
|
125 | + return null; |
|
126 | + } |
|
127 | + |
|
128 | + /* |
|
129 | 129 | * Gets an array of the address book contact groups with a specified name. |
130 | 130 | * @param string $name |
131 | 131 | * Address book contact group name |
132 | 132 | */ |
133 | - public static function getAddressBookGroupIdByName($name) |
|
134 | - { |
|
135 | - $abGroups = self::getAddressBookGroups(['offset'=>0,'limit'=>100]); |
|
136 | - |
|
137 | - $abGroupId = []; |
|
138 | - |
|
139 | - foreach ($abGroups as $abg) { |
|
140 | - if (isset($abg['group_name'])) { |
|
141 | - if ($abg['group_name']==$name) { |
|
142 | - $abGroupId[] = $abg['group_id']; |
|
143 | - } |
|
144 | - } |
|
145 | - } |
|
146 | - |
|
147 | - return $abGroupId; |
|
148 | - } |
|
133 | + public static function getAddressBookGroupIdByName($name) |
|
134 | + { |
|
135 | + $abGroups = self::getAddressBookGroups(['offset'=>0,'limit'=>100]); |
|
136 | + |
|
137 | + $abGroupId = []; |
|
138 | + |
|
139 | + foreach ($abGroups as $abg) { |
|
140 | + if (isset($abg['group_name'])) { |
|
141 | + if ($abg['group_name']==$name) { |
|
142 | + $abGroupId[] = $abg['group_id']; |
|
143 | + } |
|
144 | + } |
|
145 | + } |
|
146 | + |
|
147 | + return $abGroupId; |
|
148 | + } |
|
149 | 149 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
25 | 25 | 'method' => 'GET', |
26 | 26 | 'query' => [ |
27 | - 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
27 | + 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
28 | 28 | ], |
29 | 29 | ]); |
30 | 30 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'method' => 'GET', |
104 | 104 | 'query' => [ |
105 | 105 | 'offset' => isset($params['offset']) ? $params['offset'] : null, |
106 | - 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
106 | + 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
107 | 107 | ], |
108 | 108 | ]); |
109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | $abGroups = self::getAddressBookGroups($params); |
116 | 116 | |
117 | - if (isset($abGroups) && sizeof($abGroups) > 1) { |
|
117 | + if (isset($abGroups) && sizeof($abGroups)>1) { |
|
118 | 118 | $groupsSize = sizeof($abGroups); |
119 | 119 | |
120 | 120 | $randomGroupIndex = rand(0, $groupsSize - 1); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function getAddressBookGroupIdByName($name) |
134 | 134 | { |
135 | - $abGroups = self::getAddressBookGroups(['offset'=>0,'limit'=>100]); |
|
135 | + $abGroups = self::getAddressBookGroups(['offset'=>0, 'limit'=>100]); |
|
136 | 136 | |
137 | 137 | $abGroupId = []; |
138 | 138 |
@@ -10,39 +10,39 @@ |
||
10 | 10 | */ |
11 | 11 | class GeocodingResponse extends Common |
12 | 12 | { |
13 | - /** |
|
14 | - * A geocoded address |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - public $address; |
|
18 | - |
|
19 | - /** |
|
20 | - * Latitude |
|
21 | - * @var double |
|
22 | - */ |
|
23 | - public $lat; |
|
24 | - |
|
25 | - /** |
|
26 | - * Longitude |
|
27 | - * @var double |
|
28 | - */ |
|
29 | - public $lng; |
|
30 | - |
|
31 | - /** |
|
32 | - * Geocoded area level type |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - public $type; |
|
36 | - |
|
37 | - /** |
|
38 | - * Confidence ("high", "medium", "low") |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - public $confidence; |
|
42 | - |
|
43 | - /** |
|
44 | - * Content of the original string (an address or geopoint) sent by HTTP |
|
45 | - * @var Route |
|
46 | - */ |
|
47 | - public $original; |
|
13 | + /** |
|
14 | + * A geocoded address |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + public $address; |
|
18 | + |
|
19 | + /** |
|
20 | + * Latitude |
|
21 | + * @var double |
|
22 | + */ |
|
23 | + public $lat; |
|
24 | + |
|
25 | + /** |
|
26 | + * Longitude |
|
27 | + * @var double |
|
28 | + */ |
|
29 | + public $lng; |
|
30 | + |
|
31 | + /** |
|
32 | + * Geocoded area level type |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + public $type; |
|
36 | + |
|
37 | + /** |
|
38 | + * Confidence ("high", "medium", "low") |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + public $confidence; |
|
42 | + |
|
43 | + /** |
|
44 | + * Content of the original string (an address or geopoint) sent by HTTP |
|
45 | + * @var Route |
|
46 | + */ |
|
47 | + public $original; |
|
48 | 48 | } |
@@ -5,80 +5,80 @@ |
||
5 | 5 | |
6 | 6 | class OrderCustomField extends Common |
7 | 7 | { |
8 | - public $order_custom_field_id; |
|
9 | - public $order_custom_field_name; |
|
10 | - public $order_custom_field_label; |
|
11 | - public $order_custom_field_type; |
|
12 | - public $order_custom_field_value; |
|
13 | - public $root_owner_member_id; |
|
14 | - public $order_custom_field_type_info; |
|
15 | - |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | - } |
|
20 | - |
|
21 | - public static function addOrderCustomUserField($params) |
|
22 | - { |
|
23 | - $excludeFields = ['order_custom_field_id']; |
|
24 | - |
|
25 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
26 | - |
|
27 | - $response = Route4Me::makeRequst([ |
|
28 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
29 | - 'method' => 'POST', |
|
30 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
31 | - ]); |
|
32 | - |
|
33 | - return $response; |
|
34 | - } |
|
35 | - |
|
36 | - public static function getOrderCustomUserFields($params) |
|
37 | - { |
|
38 | - $allQueryFields = []; |
|
39 | - |
|
40 | - $response = Route4Me::makeRequst([ |
|
41 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
42 | - 'method' => 'GET', |
|
43 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
44 | - ]); |
|
45 | - |
|
46 | - return $response; |
|
47 | - } |
|
48 | - |
|
49 | - public static function updateOrderCustomUserField($params) |
|
50 | - { |
|
51 | - $excludeFields = ['order_custom_field_name']; |
|
52 | - |
|
53 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
54 | - |
|
55 | - $response = Route4Me::makeRequst([ |
|
56 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
57 | - 'method' => 'PUT', |
|
58 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
59 | - ]); |
|
60 | - |
|
61 | - return $response; |
|
62 | - } |
|
63 | - |
|
64 | - public static function removeOrderCustomUserField($params) |
|
65 | - { |
|
66 | - $excludeFields = [ |
|
67 | - 'order_custom_field_name', |
|
68 | - 'order_custom_field_type', |
|
69 | - 'order_custom_field_label', |
|
70 | - 'order_custom_field_type_info', |
|
71 | - 'root_owner_member_id' |
|
72 | - ]; |
|
73 | - |
|
74 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
75 | - |
|
76 | - $response = Route4Me::makeRequst([ |
|
77 | - 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
78 | - 'method' => 'DELETE', |
|
79 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
80 | - ]); |
|
81 | - |
|
82 | - return $response; |
|
83 | - } |
|
8 | + public $order_custom_field_id; |
|
9 | + public $order_custom_field_name; |
|
10 | + public $order_custom_field_label; |
|
11 | + public $order_custom_field_type; |
|
12 | + public $order_custom_field_value; |
|
13 | + public $root_owner_member_id; |
|
14 | + public $order_custom_field_type_info; |
|
15 | + |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
19 | + } |
|
20 | + |
|
21 | + public static function addOrderCustomUserField($params) |
|
22 | + { |
|
23 | + $excludeFields = ['order_custom_field_id']; |
|
24 | + |
|
25 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
26 | + |
|
27 | + $response = Route4Me::makeRequst([ |
|
28 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
29 | + 'method' => 'POST', |
|
30 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
31 | + ]); |
|
32 | + |
|
33 | + return $response; |
|
34 | + } |
|
35 | + |
|
36 | + public static function getOrderCustomUserFields($params) |
|
37 | + { |
|
38 | + $allQueryFields = []; |
|
39 | + |
|
40 | + $response = Route4Me::makeRequst([ |
|
41 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
42 | + 'method' => 'GET', |
|
43 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
44 | + ]); |
|
45 | + |
|
46 | + return $response; |
|
47 | + } |
|
48 | + |
|
49 | + public static function updateOrderCustomUserField($params) |
|
50 | + { |
|
51 | + $excludeFields = ['order_custom_field_name']; |
|
52 | + |
|
53 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
54 | + |
|
55 | + $response = Route4Me::makeRequst([ |
|
56 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
57 | + 'method' => 'PUT', |
|
58 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
59 | + ]); |
|
60 | + |
|
61 | + return $response; |
|
62 | + } |
|
63 | + |
|
64 | + public static function removeOrderCustomUserField($params) |
|
65 | + { |
|
66 | + $excludeFields = [ |
|
67 | + 'order_custom_field_name', |
|
68 | + 'order_custom_field_type', |
|
69 | + 'order_custom_field_label', |
|
70 | + 'order_custom_field_type_info', |
|
71 | + 'root_owner_member_id' |
|
72 | + ]; |
|
73 | + |
|
74 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
75 | + |
|
76 | + $response = Route4Me::makeRequst([ |
|
77 | + 'url' => Endpoint::ORDER_CUSTOM_FIELDS_V4, |
|
78 | + 'method' => 'DELETE', |
|
79 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
80 | + ]); |
|
81 | + |
|
82 | + return $response; |
|
83 | + } |
|
84 | 84 | } |
@@ -10,27 +10,27 @@ |
||
10 | 10 | */ |
11 | 11 | class SearchResponse extends Common |
12 | 12 | { |
13 | - /** |
|
14 | - * An array of the AddressBookContact type objects. |
|
15 | - * @var AddressBookLocation[] |
|
16 | - */ |
|
17 | - public $results=[]; |
|
13 | + /** |
|
14 | + * An array of the AddressBookContact type objects. |
|
15 | + * @var AddressBookLocation[] |
|
16 | + */ |
|
17 | + public $results=[]; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Total number of the returned contacts |
|
21 | - * @var integer |
|
22 | - */ |
|
23 | - public $total; |
|
19 | + /** |
|
20 | + * Total number of the returned contacts |
|
21 | + * @var integer |
|
22 | + */ |
|
23 | + public $total; |
|
24 | 24 | |
25 | - /** |
|
26 | - * An array of the field names to be shown |
|
27 | - * @var string[] |
|
28 | - */ |
|
29 | - public $fields=[]; |
|
25 | + /** |
|
26 | + * An array of the field names to be shown |
|
27 | + * @var string[] |
|
28 | + */ |
|
29 | + public $fields=[]; |
|
30 | 30 | |
31 | - /** |
|
32 | - * The contacts query in the JSON format |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - public $index_query; |
|
31 | + /** |
|
32 | + * The contacts query in the JSON format |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + public $index_query; |
|
36 | 36 | } |
@@ -4,37 +4,37 @@ |
||
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 (null !== $item) && !(is_array($item) && !count($item)); |
|
16 | - }); |
|
12 | + public function toArray() |
|
13 | + { |
|
14 | + $params = array_filter(get_object_vars($this), function ($item) { |
|
15 | + return (null !== $item) && !(is_array($item) && !count($item)); |
|
16 | + }); |
|
17 | 17 | |
18 | - return $params; |
|
19 | - } |
|
18 | + return $params; |
|
19 | + } |
|
20 | 20 | |
21 | - protected function fillFromArray(array $params) |
|
22 | - { |
|
23 | - foreach ($this as $key => $value) { |
|
24 | - if (isset($params[$key])) { |
|
25 | - $this->{$key} = $params[$key]; |
|
26 | - } |
|
27 | - } |
|
28 | - } |
|
21 | + protected function fillFromArray(array $params) |
|
22 | + { |
|
23 | + foreach ($this as $key => $value) { |
|
24 | + if (isset($params[$key])) { |
|
25 | + $this->{$key} = $params[$key]; |
|
26 | + } |
|
27 | + } |
|
28 | + } |
|
29 | 29 | |
30 | - public static function fromArray(array $params) |
|
31 | - { |
|
32 | - $_this = new static; |
|
33 | - foreach ($params as $key => $value) { |
|
34 | - if (property_exists($_this, $key)) { |
|
35 | - $_this->{$key} = $value; |
|
36 | - } |
|
37 | - } |
|
38 | - return $_this; |
|
39 | - } |
|
30 | + public static function fromArray(array $params) |
|
31 | + { |
|
32 | + $_this = new static; |
|
33 | + foreach ($params as $key => $value) { |
|
34 | + if (property_exists($_this, $key)) { |
|
35 | + $_this->{$key} = $value; |
|
36 | + } |
|
37 | + } |
|
38 | + return $_this; |
|
39 | + } |
|
40 | 40 | } |
@@ -7,212 +7,212 @@ |
||
7 | 7 | |
8 | 8 | class Address extends Common |
9 | 9 | { |
10 | - public $route_destination_id; |
|
11 | - public $alias; |
|
12 | - public $member_id; |
|
13 | - public $address; |
|
14 | - public $addressUpdate; |
|
15 | - public $is_depot = false; |
|
16 | - public $lat; |
|
17 | - public $lng; |
|
18 | - public $route_id; |
|
19 | - public $original_route_id; |
|
20 | - public $optimization_problem_id; |
|
21 | - public $sequence_no; |
|
22 | - public $geocoded; |
|
23 | - public $preferred_geocoding; |
|
24 | - public $failed_geocoding; |
|
25 | - public $geocodings = []; |
|
26 | - public $contact_id; |
|
27 | - public $is_visited; |
|
28 | - public $customer_po; |
|
29 | - public $invoice_no; |
|
30 | - public $reference_no; |
|
31 | - public $order_no; |
|
32 | - public $weight; |
|
33 | - public $cost; |
|
34 | - public $revenue; |
|
35 | - public $cube; |
|
36 | - public $pieces; |
|
37 | - public $email; |
|
38 | - public $phone; |
|
39 | - public $tracking_number; |
|
40 | - public $destination_note_count; |
|
41 | - public $drive_time_to_next_destination; |
|
42 | - public $distance_to_next_destination; |
|
43 | - public $generated_time_window_start; |
|
44 | - public $generated_time_window_end; |
|
45 | - public $time_window_start; |
|
46 | - public $time_window_end; |
|
47 | - public $time; |
|
48 | - public $notes; |
|
49 | - public $timestamp_last_visited; |
|
50 | - public $custom_fields = []; |
|
51 | - public $manifest = []; |
|
52 | - |
|
53 | - public $first_name; |
|
54 | - public $last_name; |
|
55 | - public $is_departed; |
|
56 | - public $timestamp_last_departed; |
|
57 | - public $order_id; |
|
58 | - public $priority; |
|
59 | - public $curbside_lat; |
|
60 | - public $curbside_lng; |
|
61 | - public $time_window_start_2; |
|
62 | - public $time_window_end_2; |
|
63 | - |
|
64 | - public $timeframe_violation_state; |
|
65 | - public $timeframe_violation_time; |
|
66 | - public $timeframe_violation_rate; |
|
67 | - public $route_name; |
|
68 | - public $address_stop_type; |
|
69 | - public $visited_lat; |
|
70 | - public $visited_lng; |
|
71 | - public $departed_lat; |
|
72 | - public $departed_lng; |
|
73 | - public $group; |
|
74 | - public $abnormal_traffic_time_to_next_destination; |
|
75 | - public $uncongested_time_to_next_destination; |
|
76 | - public $traffic_time_to_next_destination; |
|
77 | - public $channel_name; |
|
78 | - public $pickup; |
|
79 | - public $dropoff; |
|
80 | - public $joint; |
|
81 | - public $geofence_detected_visited_timestamp; |
|
82 | - public $geofence_detected_departed_timestamp; |
|
83 | - public $geofence_detected_service_time; |
|
84 | - public $geofence_detected_visited_lat; |
|
85 | - public $geofence_detected_visited_lng; |
|
86 | - public $geofence_detected_departed_lat; |
|
87 | - public $geofence_detected_departed_lng; |
|
88 | - public $custom_fields_str_json; |
|
89 | - public $custom_fields_config; |
|
90 | - public $custom_fields_config_str_json; |
|
91 | - public $bundle_count; |
|
92 | - public $bundle_items; |
|
93 | - public $order_inventory; |
|
94 | - public $required_skills; |
|
95 | - public $udu_distance_to_next_destination; |
|
96 | - public $wait_time_to_next_destination; |
|
97 | - public $path_to_next = []; |
|
98 | - public $additional_status; |
|
99 | - public $tags = []; |
|
100 | - |
|
101 | - public function __construct() |
|
102 | - { |
|
103 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
104 | - } |
|
105 | - |
|
106 | - public static function getAddress($routeId, $addressId) |
|
107 | - { |
|
108 | - $address = Route4Me::makeRequst([ |
|
109 | - 'url' => Endpoint::ADDRESS_V4, |
|
110 | - 'method' => 'GET', |
|
111 | - 'query' => [ |
|
112 | - 'route_id' => $routeId, |
|
113 | - 'route_destination_id' => $addressId, |
|
114 | - ], |
|
115 | - ]); |
|
116 | - |
|
117 | - return self::fromArray($address); |
|
118 | - } |
|
119 | - |
|
120 | - public function update() |
|
121 | - { |
|
122 | - $addressUpdate = Route4Me::makeRequst([ |
|
123 | - 'url' => Endpoint::ADDRESS_V4, |
|
124 | - 'method' => 'PUT', |
|
125 | - 'body' => $this->toArray(), |
|
126 | - 'query' => [ |
|
127 | - 'route_id' => $this->route_id, |
|
128 | - 'route_destination_id' => $this->route_destination_id, |
|
129 | - ], |
|
130 | - ]); |
|
131 | - |
|
132 | - return self::fromArray($addressUpdate); |
|
133 | - } |
|
134 | - |
|
135 | - /* |
|
10 | + public $route_destination_id; |
|
11 | + public $alias; |
|
12 | + public $member_id; |
|
13 | + public $address; |
|
14 | + public $addressUpdate; |
|
15 | + public $is_depot = false; |
|
16 | + public $lat; |
|
17 | + public $lng; |
|
18 | + public $route_id; |
|
19 | + public $original_route_id; |
|
20 | + public $optimization_problem_id; |
|
21 | + public $sequence_no; |
|
22 | + public $geocoded; |
|
23 | + public $preferred_geocoding; |
|
24 | + public $failed_geocoding; |
|
25 | + public $geocodings = []; |
|
26 | + public $contact_id; |
|
27 | + public $is_visited; |
|
28 | + public $customer_po; |
|
29 | + public $invoice_no; |
|
30 | + public $reference_no; |
|
31 | + public $order_no; |
|
32 | + public $weight; |
|
33 | + public $cost; |
|
34 | + public $revenue; |
|
35 | + public $cube; |
|
36 | + public $pieces; |
|
37 | + public $email; |
|
38 | + public $phone; |
|
39 | + public $tracking_number; |
|
40 | + public $destination_note_count; |
|
41 | + public $drive_time_to_next_destination; |
|
42 | + public $distance_to_next_destination; |
|
43 | + public $generated_time_window_start; |
|
44 | + public $generated_time_window_end; |
|
45 | + public $time_window_start; |
|
46 | + public $time_window_end; |
|
47 | + public $time; |
|
48 | + public $notes; |
|
49 | + public $timestamp_last_visited; |
|
50 | + public $custom_fields = []; |
|
51 | + public $manifest = []; |
|
52 | + |
|
53 | + public $first_name; |
|
54 | + public $last_name; |
|
55 | + public $is_departed; |
|
56 | + public $timestamp_last_departed; |
|
57 | + public $order_id; |
|
58 | + public $priority; |
|
59 | + public $curbside_lat; |
|
60 | + public $curbside_lng; |
|
61 | + public $time_window_start_2; |
|
62 | + public $time_window_end_2; |
|
63 | + |
|
64 | + public $timeframe_violation_state; |
|
65 | + public $timeframe_violation_time; |
|
66 | + public $timeframe_violation_rate; |
|
67 | + public $route_name; |
|
68 | + public $address_stop_type; |
|
69 | + public $visited_lat; |
|
70 | + public $visited_lng; |
|
71 | + public $departed_lat; |
|
72 | + public $departed_lng; |
|
73 | + public $group; |
|
74 | + public $abnormal_traffic_time_to_next_destination; |
|
75 | + public $uncongested_time_to_next_destination; |
|
76 | + public $traffic_time_to_next_destination; |
|
77 | + public $channel_name; |
|
78 | + public $pickup; |
|
79 | + public $dropoff; |
|
80 | + public $joint; |
|
81 | + public $geofence_detected_visited_timestamp; |
|
82 | + public $geofence_detected_departed_timestamp; |
|
83 | + public $geofence_detected_service_time; |
|
84 | + public $geofence_detected_visited_lat; |
|
85 | + public $geofence_detected_visited_lng; |
|
86 | + public $geofence_detected_departed_lat; |
|
87 | + public $geofence_detected_departed_lng; |
|
88 | + public $custom_fields_str_json; |
|
89 | + public $custom_fields_config; |
|
90 | + public $custom_fields_config_str_json; |
|
91 | + public $bundle_count; |
|
92 | + public $bundle_items; |
|
93 | + public $order_inventory; |
|
94 | + public $required_skills; |
|
95 | + public $udu_distance_to_next_destination; |
|
96 | + public $wait_time_to_next_destination; |
|
97 | + public $path_to_next = []; |
|
98 | + public $additional_status; |
|
99 | + public $tags = []; |
|
100 | + |
|
101 | + public function __construct() |
|
102 | + { |
|
103 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
104 | + } |
|
105 | + |
|
106 | + public static function getAddress($routeId, $addressId) |
|
107 | + { |
|
108 | + $address = Route4Me::makeRequst([ |
|
109 | + 'url' => Endpoint::ADDRESS_V4, |
|
110 | + 'method' => 'GET', |
|
111 | + 'query' => [ |
|
112 | + 'route_id' => $routeId, |
|
113 | + 'route_destination_id' => $addressId, |
|
114 | + ], |
|
115 | + ]); |
|
116 | + |
|
117 | + return self::fromArray($address); |
|
118 | + } |
|
119 | + |
|
120 | + public function update() |
|
121 | + { |
|
122 | + $addressUpdate = Route4Me::makeRequst([ |
|
123 | + 'url' => Endpoint::ADDRESS_V4, |
|
124 | + 'method' => 'PUT', |
|
125 | + 'body' => $this->toArray(), |
|
126 | + 'query' => [ |
|
127 | + 'route_id' => $this->route_id, |
|
128 | + 'route_destination_id' => $this->route_destination_id, |
|
129 | + ], |
|
130 | + ]); |
|
131 | + |
|
132 | + return self::fromArray($addressUpdate); |
|
133 | + } |
|
134 | + |
|
135 | + /* |
|
136 | 136 | * Marks an address as marked as visited/as departed |
137 | 137 | * depending on which parameter is specified: 'is_visited' or 'is_departed'. |
138 | 138 | */ |
139 | - public function markAddress($params) |
|
140 | - { |
|
141 | - $allQueryFields = ['route_id', 'route_destination_id']; |
|
142 | - $allBodyFields = ['is_visited', 'is_departed']; |
|
143 | - |
|
144 | - $result = Route4Me::makeRequst([ |
|
145 | - 'url' => Endpoint::ADDRESS_V4, |
|
146 | - 'method' => 'PUT', |
|
147 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
148 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
149 | - ]); |
|
150 | - |
|
151 | - return $result; |
|
152 | - } |
|
153 | - |
|
154 | - /* |
|
139 | + public function markAddress($params) |
|
140 | + { |
|
141 | + $allQueryFields = ['route_id', 'route_destination_id']; |
|
142 | + $allBodyFields = ['is_visited', 'is_departed']; |
|
143 | + |
|
144 | + $result = Route4Me::makeRequst([ |
|
145 | + 'url' => Endpoint::ADDRESS_V4, |
|
146 | + 'method' => 'PUT', |
|
147 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
148 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
149 | + ]); |
|
150 | + |
|
151 | + return $result; |
|
152 | + } |
|
153 | + |
|
154 | + /* |
|
155 | 155 | * Marks an address as departed. |
156 | 156 | */ |
157 | - public function markAsDeparted($params) |
|
158 | - { |
|
159 | - $allQueryFields = ['route_id', 'address_id', 'is_departed', 'member_id']; |
|
157 | + public function markAsDeparted($params) |
|
158 | + { |
|
159 | + $allQueryFields = ['route_id', 'address_id', 'is_departed', 'member_id']; |
|
160 | 160 | |
161 | - $address = Route4Me::makeRequst([ |
|
162 | - 'url' => Endpoint::MARK_ADDRESS_DEPARTED, |
|
163 | - 'method' => 'PUT', |
|
164 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
165 | - ]); |
|
161 | + $address = Route4Me::makeRequst([ |
|
162 | + 'url' => Endpoint::MARK_ADDRESS_DEPARTED, |
|
163 | + 'method' => 'PUT', |
|
164 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
165 | + ]); |
|
166 | 166 | |
167 | - return $address; |
|
168 | - } |
|
167 | + return $address; |
|
168 | + } |
|
169 | 169 | |
170 | - /* |
|
170 | + /* |
|
171 | 171 | * Marks an address as visited. |
172 | 172 | */ |
173 | - public function markAsVisited($params) |
|
174 | - { |
|
175 | - $allQueryFields = ['route_id', 'address_id', 'is_visited', 'member_id']; |
|
176 | - |
|
177 | - $address = Route4Me::makeRequst([ |
|
178 | - 'url' => Endpoint::UPDATE_ADDRESS_VISITED, |
|
179 | - 'method' => 'PUT', |
|
180 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
181 | - ]); |
|
182 | - |
|
183 | - return $address; |
|
184 | - } |
|
185 | - |
|
186 | - public function deleteAddress() |
|
187 | - { |
|
188 | - $address = Route4Me::makeRequst([ |
|
189 | - 'url' => Endpoint::ADDRESS_V4, |
|
190 | - 'method' => 'DELETE', |
|
191 | - 'query' => [ |
|
192 | - 'route_id' => $this->route_id, |
|
193 | - 'route_destination_id' => $this->route_destination_id, |
|
194 | - ], |
|
195 | - ]); |
|
196 | - |
|
197 | - return (bool) $address['deleted']; |
|
198 | - } |
|
199 | - |
|
200 | - public function moveDestinationToRoute($params) |
|
201 | - { |
|
202 | - $allBodyFields = ['to_route_id', 'route_destination_id', 'after_destination_id']; |
|
203 | - |
|
204 | - $result = Route4Me::makeRequst([ |
|
205 | - 'url' => Endpoint::MOVE_ROUTE_DESTINATION, |
|
206 | - 'method' => 'POST', |
|
207 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
208 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
209 | - ]); |
|
210 | - |
|
211 | - return $result; |
|
212 | - } |
|
213 | - |
|
214 | - public function getAddressId() |
|
215 | - { |
|
216 | - return $this->route_destination_id; |
|
217 | - } |
|
173 | + public function markAsVisited($params) |
|
174 | + { |
|
175 | + $allQueryFields = ['route_id', 'address_id', 'is_visited', 'member_id']; |
|
176 | + |
|
177 | + $address = Route4Me::makeRequst([ |
|
178 | + 'url' => Endpoint::UPDATE_ADDRESS_VISITED, |
|
179 | + 'method' => 'PUT', |
|
180 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
181 | + ]); |
|
182 | + |
|
183 | + return $address; |
|
184 | + } |
|
185 | + |
|
186 | + public function deleteAddress() |
|
187 | + { |
|
188 | + $address = Route4Me::makeRequst([ |
|
189 | + 'url' => Endpoint::ADDRESS_V4, |
|
190 | + 'method' => 'DELETE', |
|
191 | + 'query' => [ |
|
192 | + 'route_id' => $this->route_id, |
|
193 | + 'route_destination_id' => $this->route_destination_id, |
|
194 | + ], |
|
195 | + ]); |
|
196 | + |
|
197 | + return (bool) $address['deleted']; |
|
198 | + } |
|
199 | + |
|
200 | + public function moveDestinationToRoute($params) |
|
201 | + { |
|
202 | + $allBodyFields = ['to_route_id', 'route_destination_id', 'after_destination_id']; |
|
203 | + |
|
204 | + $result = Route4Me::makeRequst([ |
|
205 | + 'url' => Endpoint::MOVE_ROUTE_DESTINATION, |
|
206 | + 'method' => 'POST', |
|
207 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
208 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
209 | + ]); |
|
210 | + |
|
211 | + return $result; |
|
212 | + } |
|
213 | + |
|
214 | + public function getAddressId() |
|
215 | + { |
|
216 | + return $this->route_destination_id; |
|
217 | + } |
|
218 | 218 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class AddressBookLocationSearchResponse |
8 | 8 | { |
9 | - public $results=[]; |
|
10 | - public $total; |
|
11 | - public $fields=[]; |
|
9 | + public $results=[]; |
|
10 | + public $total; |
|
11 | + public $fields=[]; |
|
12 | 12 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class AddressBookLocationSearchResponse |
8 | 8 | { |
9 | - public $results=[]; |
|
9 | + public $results = []; |
|
10 | 10 | public $total; |
11 | - public $fields=[]; |
|
11 | + public $fields = []; |
|
12 | 12 | } |