@@ -17,39 +17,39 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
21 | - |
|
22 | - ///////////////////////////////////////////// |
|
23 | - // get the first 5 addresses |
|
24 | - $options = [ |
|
25 | - 'limit' => 5, |
|
26 | - 'offset' => 0 |
|
27 | - ]; |
|
28 | - $res = $ab->getAddressesByBodyPayload($options); |
|
29 | - print_r($res); |
|
30 | - |
|
31 | - ///////////////////////////////////////////// |
|
32 | - // get the first 5 addresses in the selected area from the server |
|
33 | - $options = [ |
|
34 | - 'filter' => [ |
|
35 | - 'query' => 'Tusha', |
|
36 | - 'selected_areas' => [[ |
|
37 | - 'type' => 'circle', |
|
38 | - 'value' => [ |
|
39 | - 'center' => [ |
|
40 | - 'lat' => 38.024654, |
|
41 | - 'lng' => 77.338814 |
|
42 | - ], |
|
43 | - 'distance' => 10000 |
|
44 | - ] |
|
45 | - ]] |
|
46 | - ], |
|
47 | - 'limit' => 5, |
|
48 | - 'offset' => 0 |
|
49 | - ]; |
|
50 | - $res = $ab->getAddressesByBodyPayload($options); |
|
51 | - print_r($res); |
|
20 | + $ab = new AddressBook(); |
|
21 | + |
|
22 | + ///////////////////////////////////////////// |
|
23 | + // get the first 5 addresses |
|
24 | + $options = [ |
|
25 | + 'limit' => 5, |
|
26 | + 'offset' => 0 |
|
27 | + ]; |
|
28 | + $res = $ab->getAddressesByBodyPayload($options); |
|
29 | + print_r($res); |
|
30 | + |
|
31 | + ///////////////////////////////////////////// |
|
32 | + // get the first 5 addresses in the selected area from the server |
|
33 | + $options = [ |
|
34 | + 'filter' => [ |
|
35 | + 'query' => 'Tusha', |
|
36 | + 'selected_areas' => [[ |
|
37 | + 'type' => 'circle', |
|
38 | + 'value' => [ |
|
39 | + 'center' => [ |
|
40 | + 'lat' => 38.024654, |
|
41 | + 'lng' => 77.338814 |
|
42 | + ], |
|
43 | + 'distance' => 10000 |
|
44 | + ] |
|
45 | + ]] |
|
46 | + ], |
|
47 | + 'limit' => 5, |
|
48 | + 'offset' => 0 |
|
49 | + ]; |
|
50 | + $res = $ab->getAddressesByBodyPayload($options); |
|
51 | + print_r($res); |
|
52 | 52 | } catch (ApiError $e) { |
53 | - echo $e->getCode() . PHP_EOL; |
|
54 | - echo $e->getMessage() . PHP_EOL; |
|
53 | + echo $e->getCode() . PHP_EOL; |
|
54 | + echo $e->getMessage() . PHP_EOL; |
|
55 | 55 | } |
@@ -50,6 +50,6 @@ |
||
50 | 50 | $res = $ab->getAddressesByBodyPayload($options); |
51 | 51 | print_r($res); |
52 | 52 | } catch (ApiError $e) { |
53 | - echo $e->getCode() . PHP_EOL; |
|
54 | - echo $e->getMessage() . PHP_EOL; |
|
53 | + echo $e->getCode().PHP_EOL; |
|
54 | + echo $e->getMessage().PHP_EOL; |
|
55 | 55 | } |
@@ -16,11 +16,11 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
19 | + $ab = new AddressBook(); |
|
20 | 20 | |
21 | - $res = $ab->getAddressesDepots(); |
|
22 | - print_r($res); |
|
21 | + $res = $ab->getAddressesDepots(); |
|
22 | + print_r($res); |
|
23 | 23 | } catch (ApiError $e) { |
24 | - echo $e->getCode() . PHP_EOL; |
|
25 | - echo $e->getMessage() . PHP_EOL; |
|
24 | + echo $e->getCode() . PHP_EOL; |
|
25 | + echo $e->getMessage() . PHP_EOL; |
|
26 | 26 | } |
@@ -21,6 +21,6 @@ |
||
21 | 21 | $res = $ab->getAddressesDepots(); |
22 | 22 | print_r($res); |
23 | 23 | } catch (ApiError $e) { |
24 | - echo $e->getCode() . PHP_EOL; |
|
25 | - echo $e->getMessage() . PHP_EOL; |
|
24 | + echo $e->getCode().PHP_EOL; |
|
25 | + echo $e->getMessage().PHP_EOL; |
|
26 | 26 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
19 | + $ab = new AddressBook(); |
|
20 | 20 | |
21 | - $jobId = '434A746FF41D5572FB3D76FACB55161E'; |
|
21 | + $jobId = '434A746FF41D5572FB3D76FACB55161E'; |
|
22 | 22 | |
23 | - $res = $ab->getAddressesAsynchronousJobResult($jobId); |
|
24 | - print_r($res); |
|
23 | + $res = $ab->getAddressesAsynchronousJobResult($jobId); |
|
24 | + print_r($res); |
|
25 | 25 | } catch (ApiError $e) { |
26 | - echo $e->getCode() . PHP_EOL; |
|
27 | - echo $e->getMessage() . PHP_EOL; |
|
26 | + echo $e->getCode() . PHP_EOL; |
|
27 | + echo $e->getMessage() . PHP_EOL; |
|
28 | 28 | } |
@@ -23,6 +23,6 @@ |
||
23 | 23 | $res = $ab->getAddressesAsynchronousJobResult($jobId); |
24 | 24 | print_r($res); |
25 | 25 | } catch (ApiError $e) { |
26 | - echo $e->getCode() . PHP_EOL; |
|
27 | - echo $e->getMessage() . PHP_EOL; |
|
26 | + echo $e->getCode().PHP_EOL; |
|
27 | + echo $e->getMessage().PHP_EOL; |
|
28 | 28 | } |
@@ -16,11 +16,11 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
19 | + $ab = new AddressBook(); |
|
20 | 20 | |
21 | - $res = $ab->getAddressCustomFields(); |
|
22 | - print_r($res); |
|
21 | + $res = $ab->getAddressCustomFields(); |
|
22 | + print_r($res); |
|
23 | 23 | } catch (ApiError $e) { |
24 | - echo $e->getCode() . PHP_EOL; |
|
25 | - echo $e->getMessage() . PHP_EOL; |
|
24 | + echo $e->getCode() . PHP_EOL; |
|
25 | + echo $e->getMessage() . PHP_EOL; |
|
26 | 26 | } |
@@ -21,6 +21,6 @@ |
||
21 | 21 | $res = $ab->getAddressCustomFields(); |
22 | 22 | print_r($res); |
23 | 23 | } catch (ApiError $e) { |
24 | - echo $e->getCode() . PHP_EOL; |
|
25 | - echo $e->getMessage() . PHP_EOL; |
|
24 | + echo $e->getCode().PHP_EOL; |
|
25 | + echo $e->getMessage().PHP_EOL; |
|
26 | 26 | } |
@@ -18,17 +18,17 @@ |
||
18 | 18 | Route4Me::setApiKey(Constants::API_KEY); |
19 | 19 | |
20 | 20 | try { |
21 | - $ab = new AddressBook(); |
|
21 | + $ab = new AddressBook(); |
|
22 | 22 | |
23 | - ///////////////////////////////////////////// |
|
24 | - // update adress's last_name |
|
25 | - $addressId = 96100576; |
|
26 | - $params = [ |
|
27 | - 'last_name' => 'Grigoriani III' |
|
28 | - ]; |
|
29 | - $res = $ab->updateAddressById($addressId, $params); |
|
30 | - print_r($res); |
|
23 | + ///////////////////////////////////////////// |
|
24 | + // update adress's last_name |
|
25 | + $addressId = 96100576; |
|
26 | + $params = [ |
|
27 | + 'last_name' => 'Grigoriani III' |
|
28 | + ]; |
|
29 | + $res = $ab->updateAddressById($addressId, $params); |
|
30 | + print_r($res); |
|
31 | 31 | } catch (ApiError $e) { |
32 | - echo $e->getCode() . PHP_EOL; |
|
33 | - echo $e->getMessage() . PHP_EOL; |
|
32 | + echo $e->getCode() . PHP_EOL; |
|
33 | + echo $e->getMessage() . PHP_EOL; |
|
34 | 34 | } |
@@ -29,6 +29,6 @@ |
||
29 | 29 | $res = $ab->updateAddressById($addressId, $params); |
30 | 30 | print_r($res); |
31 | 31 | } catch (ApiError $e) { |
32 | - echo $e->getCode() . PHP_EOL; |
|
33 | - echo $e->getMessage() . PHP_EOL; |
|
32 | + echo $e->getCode().PHP_EOL; |
|
33 | + echo $e->getMessage().PHP_EOL; |
|
34 | 34 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
19 | + $ab = new AddressBook(); |
|
20 | 20 | |
21 | - $jobId = '866BCFF5C3722432BAE58E6731753BC2'; |
|
21 | + $jobId = '866BCFF5C3722432BAE58E6731753BC2'; |
|
22 | 22 | |
23 | - $res = $ab->getAddressesAsynchronousJobStatus($jobId); |
|
24 | - print_r($res); |
|
23 | + $res = $ab->getAddressesAsynchronousJobStatus($jobId); |
|
24 | + print_r($res); |
|
25 | 25 | } catch (ApiError $e) { |
26 | - echo $e->getCode() . PHP_EOL; |
|
27 | - echo $e->getMessage() . PHP_EOL; |
|
26 | + echo $e->getCode() . PHP_EOL; |
|
27 | + echo $e->getMessage() . PHP_EOL; |
|
28 | 28 | } |
@@ -23,6 +23,6 @@ |
||
23 | 23 | $res = $ab->getAddressesAsynchronousJobStatus($jobId); |
24 | 24 | print_r($res); |
25 | 25 | } catch (ApiError $e) { |
26 | - echo $e->getCode() . PHP_EOL; |
|
27 | - echo $e->getMessage() . PHP_EOL; |
|
26 | + echo $e->getCode().PHP_EOL; |
|
27 | + echo $e->getMessage().PHP_EOL; |
|
28 | 28 | } |
@@ -16,14 +16,14 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
19 | + $ab = new AddressBook(); |
|
20 | 20 | |
21 | - $territoryIds = [96100573, 96100961]; |
|
22 | - $filename = 'test_export.csv'; |
|
21 | + $territoryIds = [96100573, 96100961]; |
|
22 | + $filename = 'test_export.csv'; |
|
23 | 23 | |
24 | - $res = $ab->exportAddressesByAreaIds($territoryIds, $filename); |
|
25 | - print_r($res); |
|
24 | + $res = $ab->exportAddressesByAreaIds($territoryIds, $filename); |
|
25 | + print_r($res); |
|
26 | 26 | } catch (ApiError $e) { |
27 | - echo $e->getCode() . PHP_EOL; |
|
28 | - echo $e->getMessage() . PHP_EOL; |
|
27 | + echo $e->getCode() . PHP_EOL; |
|
28 | + echo $e->getMessage() . PHP_EOL; |
|
29 | 29 | } |
@@ -24,6 +24,6 @@ |
||
24 | 24 | $res = $ab->exportAddressesByAreaIds($territoryIds, $filename); |
25 | 25 | print_r($res); |
26 | 26 | } catch (ApiError $e) { |
27 | - echo $e->getCode() . PHP_EOL; |
|
28 | - echo $e->getMessage() . PHP_EOL; |
|
27 | + echo $e->getCode().PHP_EOL; |
|
28 | + echo $e->getMessage().PHP_EOL; |
|
29 | 29 | } |
@@ -17,44 +17,44 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
21 | - |
|
22 | - ///////////////////////////////////////////// |
|
23 | - // get the first page of addresses from server |
|
24 | - $res = $ab->getAddressesPaginatedByBodyPayload(); |
|
25 | - print_r($res); |
|
26 | - |
|
27 | - ///////////////////////////////////////////// |
|
28 | - // get only the 5 fields of addresses from server |
|
29 | - $options = [ |
|
30 | - 'fields' => ['address_id', 'address_1', 'first_name', 'last_name', 'address_city'], |
|
31 | - 'page' => 2, |
|
32 | - 'per_page' => 10 |
|
33 | - ]; |
|
34 | - $res = $ab->getAddressesPaginatedByBodyPayload($options); |
|
35 | - print_r($res); |
|
36 | - |
|
37 | - ///////////////////////////////////////////// |
|
38 | - // get the first 5 addresses in the selected area from the server |
|
39 | - $options = [ |
|
40 | - 'filter' => [ |
|
41 | - 'selected_areas' => [[ |
|
42 | - 'type' => 'circle', |
|
43 | - 'value' => [ |
|
44 | - 'center' => [ |
|
45 | - 'lat' => 52.4025, |
|
46 | - 'lng' => 4.5601 |
|
47 | - ], |
|
48 | - 'distance' => 10000 |
|
49 | - ] |
|
50 | - ]] |
|
51 | - ], |
|
52 | - 'page' => 2, |
|
53 | - 'per_page' => 10 |
|
54 | - ]; |
|
55 | - $res = $ab->getAddressesPaginatedByBodyPayload($options); |
|
56 | - print_r($res); |
|
20 | + $ab = new AddressBook(); |
|
21 | + |
|
22 | + ///////////////////////////////////////////// |
|
23 | + // get the first page of addresses from server |
|
24 | + $res = $ab->getAddressesPaginatedByBodyPayload(); |
|
25 | + print_r($res); |
|
26 | + |
|
27 | + ///////////////////////////////////////////// |
|
28 | + // get only the 5 fields of addresses from server |
|
29 | + $options = [ |
|
30 | + 'fields' => ['address_id', 'address_1', 'first_name', 'last_name', 'address_city'], |
|
31 | + 'page' => 2, |
|
32 | + 'per_page' => 10 |
|
33 | + ]; |
|
34 | + $res = $ab->getAddressesPaginatedByBodyPayload($options); |
|
35 | + print_r($res); |
|
36 | + |
|
37 | + ///////////////////////////////////////////// |
|
38 | + // get the first 5 addresses in the selected area from the server |
|
39 | + $options = [ |
|
40 | + 'filter' => [ |
|
41 | + 'selected_areas' => [[ |
|
42 | + 'type' => 'circle', |
|
43 | + 'value' => [ |
|
44 | + 'center' => [ |
|
45 | + 'lat' => 52.4025, |
|
46 | + 'lng' => 4.5601 |
|
47 | + ], |
|
48 | + 'distance' => 10000 |
|
49 | + ] |
|
50 | + ]] |
|
51 | + ], |
|
52 | + 'page' => 2, |
|
53 | + 'per_page' => 10 |
|
54 | + ]; |
|
55 | + $res = $ab->getAddressesPaginatedByBodyPayload($options); |
|
56 | + print_r($res); |
|
57 | 57 | } catch (ApiError $e) { |
58 | - echo $e->getCode() . PHP_EOL; |
|
59 | - echo $e->getMessage() . PHP_EOL; |
|
58 | + echo $e->getCode() . PHP_EOL; |
|
59 | + echo $e->getMessage() . PHP_EOL; |
|
60 | 60 | } |
@@ -55,6 +55,6 @@ |
||
55 | 55 | $res = $ab->getAddressesPaginatedByBodyPayload($options); |
56 | 56 | print_r($res); |
57 | 57 | } catch (ApiError $e) { |
58 | - echo $e->getCode() . PHP_EOL; |
|
59 | - echo $e->getMessage() . PHP_EOL; |
|
58 | + echo $e->getCode().PHP_EOL; |
|
59 | + echo $e->getMessage().PHP_EOL; |
|
60 | 60 | } |
@@ -18,35 +18,35 @@ |
||
18 | 18 | Route4Me::setApiKey(Constants::API_KEY); |
19 | 19 | |
20 | 20 | try { |
21 | - $ab = new AddressBook(); |
|
22 | - |
|
23 | - ///////////////////////////////////////////// |
|
24 | - // add adress from array |
|
25 | - $params = [ |
|
26 | - 'address_1' => '17205 RICHMOND TNPK, MILFORD, VA, 22514', |
|
27 | - 'cached_lat' => 38.024654, |
|
28 | - 'cached_lng' => 77.338814, |
|
29 | - 'address_stop_type' => 'DELIVERY', |
|
30 | - 'address_city' => 'Tbilisi Vah', |
|
31 | - 'first_name' => 'Tusha', |
|
32 | - 'last_name' => 'Grigoriani' |
|
33 | - ]; |
|
34 | - $res = $ab->addAddress($params); |
|
35 | - print_r($res); |
|
36 | - |
|
37 | - ///////////////////////////////////////////// |
|
38 | - // add adress from Address and array |
|
39 | - $params['address_stop_type'] = 'VISIT'; |
|
40 | - $address = new Address($params); |
|
41 | - $res = $ab->addAddress($address); |
|
42 | - print_r($res); |
|
43 | - |
|
44 | - ///////////////////////////////////////////// |
|
45 | - // add adress from Address |
|
46 | - $address = new Address('17205 Tbilisi Vah, GEORGIAN, GE, 22514', 38.024654, 77.338814, 'DELIVERY'); |
|
47 | - $res = $ab->addAddress($address); |
|
48 | - print_r($res); |
|
21 | + $ab = new AddressBook(); |
|
22 | + |
|
23 | + ///////////////////////////////////////////// |
|
24 | + // add adress from array |
|
25 | + $params = [ |
|
26 | + 'address_1' => '17205 RICHMOND TNPK, MILFORD, VA, 22514', |
|
27 | + 'cached_lat' => 38.024654, |
|
28 | + 'cached_lng' => 77.338814, |
|
29 | + 'address_stop_type' => 'DELIVERY', |
|
30 | + 'address_city' => 'Tbilisi Vah', |
|
31 | + 'first_name' => 'Tusha', |
|
32 | + 'last_name' => 'Grigoriani' |
|
33 | + ]; |
|
34 | + $res = $ab->addAddress($params); |
|
35 | + print_r($res); |
|
36 | + |
|
37 | + ///////////////////////////////////////////// |
|
38 | + // add adress from Address and array |
|
39 | + $params['address_stop_type'] = 'VISIT'; |
|
40 | + $address = new Address($params); |
|
41 | + $res = $ab->addAddress($address); |
|
42 | + print_r($res); |
|
43 | + |
|
44 | + ///////////////////////////////////////////// |
|
45 | + // add adress from Address |
|
46 | + $address = new Address('17205 Tbilisi Vah, GEORGIAN, GE, 22514', 38.024654, 77.338814, 'DELIVERY'); |
|
47 | + $res = $ab->addAddress($address); |
|
48 | + print_r($res); |
|
49 | 49 | } catch (ApiError $e) { |
50 | - echo $e->getCode() . PHP_EOL; |
|
51 | - echo $e->getMessage() . PHP_EOL; |
|
50 | + echo $e->getCode() . PHP_EOL; |
|
51 | + echo $e->getMessage() . PHP_EOL; |
|
52 | 52 | } |
@@ -47,6 +47,6 @@ |
||
47 | 47 | $res = $ab->addAddress($address); |
48 | 48 | print_r($res); |
49 | 49 | } catch (ApiError $e) { |
50 | - echo $e->getCode() . PHP_EOL; |
|
51 | - echo $e->getMessage() . PHP_EOL; |
|
50 | + echo $e->getCode().PHP_EOL; |
|
51 | + echo $e->getMessage().PHP_EOL; |
|
52 | 52 | } |