@@ -16,12 +16,12 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
19 | + $ab = new AddressBook(); |
|
20 | 20 | |
21 | - $addressId = 51111441; |
|
22 | - $res = $ab->getAddressById($addressId); |
|
23 | - print_r($res); |
|
21 | + $addressId = 51111441; |
|
22 | + $res = $ab->getAddressById($addressId); |
|
23 | + print_r($res); |
|
24 | 24 | } catch (ApiError $e) { |
25 | - echo $e->getCode() . PHP_EOL; |
|
26 | - echo $e->getMessage() . PHP_EOL; |
|
25 | + echo $e->getCode() . PHP_EOL; |
|
26 | + echo $e->getMessage() . PHP_EOL; |
|
27 | 27 | } |
@@ -22,6 +22,6 @@ |
||
22 | 22 | $res = $ab->getAddressById($addressId); |
23 | 23 | print_r($res); |
24 | 24 | } catch (ApiError $e) { |
25 | - echo $e->getCode() . PHP_EOL; |
|
26 | - echo $e->getMessage() . PHP_EOL; |
|
25 | + echo $e->getCode().PHP_EOL; |
|
26 | + echo $e->getMessage().PHP_EOL; |
|
27 | 27 | } |
@@ -17,14 +17,14 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
20 | + $ab = new AddressBook(); |
|
21 | 21 | |
22 | - $addressIds = [96100573, 96100961]; |
|
23 | - $filename = 'test_export.csv'; |
|
22 | + $addressIds = [96100573, 96100961]; |
|
23 | + $filename = 'test_export.csv'; |
|
24 | 24 | |
25 | - $res = $ab->exportAddressesByIds($addressIds, $filename); |
|
26 | - print_r($res); |
|
25 | + $res = $ab->exportAddressesByIds($addressIds, $filename); |
|
26 | + print_r($res); |
|
27 | 27 | } catch (ApiError $e) { |
28 | - echo $e->getCode() . PHP_EOL; |
|
29 | - echo $e->getMessage() . PHP_EOL; |
|
28 | + echo $e->getCode() . PHP_EOL; |
|
29 | + echo $e->getMessage() . PHP_EOL; |
|
30 | 30 | } |
@@ -25,6 +25,6 @@ |
||
25 | 25 | $res = $ab->exportAddressesByIds($addressIds, $filename); |
26 | 26 | print_r($res); |
27 | 27 | } catch (ApiError $e) { |
28 | - echo $e->getCode() . PHP_EOL; |
|
29 | - echo $e->getMessage() . PHP_EOL; |
|
28 | + echo $e->getCode().PHP_EOL; |
|
29 | + echo $e->getMessage().PHP_EOL; |
|
30 | 30 | } |
@@ -17,33 +17,33 @@ |
||
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->getAddressesPaginated(); |
|
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->getAddressesPaginated($options); |
|
35 | - print_r($res); |
|
36 | - |
|
37 | - ///////////////////////////////////////////// |
|
38 | - // get the first 5 addresses from server that match query 'France' |
|
39 | - $options = [ |
|
40 | - 'query' => 'France', |
|
41 | - 'page' => 1, |
|
42 | - 'per_page' => 10 |
|
43 | - ]; |
|
44 | - $res = $ab->getAddressesPaginated($options); |
|
45 | - print_r($res); |
|
20 | + $ab = new AddressBook(); |
|
21 | + |
|
22 | + ///////////////////////////////////////////// |
|
23 | + // get the first page of addresses from server |
|
24 | + $res = $ab->getAddressesPaginated(); |
|
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->getAddressesPaginated($options); |
|
35 | + print_r($res); |
|
36 | + |
|
37 | + ///////////////////////////////////////////// |
|
38 | + // get the first 5 addresses from server that match query 'France' |
|
39 | + $options = [ |
|
40 | + 'query' => 'France', |
|
41 | + 'page' => 1, |
|
42 | + 'per_page' => 10 |
|
43 | + ]; |
|
44 | + $res = $ab->getAddressesPaginated($options); |
|
45 | + print_r($res); |
|
46 | 46 | } catch (ApiError $e) { |
47 | - echo $e->getCode() . PHP_EOL; |
|
48 | - echo $e->getMessage() . PHP_EOL; |
|
47 | + echo $e->getCode() . PHP_EOL; |
|
48 | + echo $e->getMessage() . PHP_EOL; |
|
49 | 49 | } |
@@ -44,6 +44,6 @@ |
||
44 | 44 | $res = $ab->getAddressesPaginated($options); |
45 | 45 | print_r($res); |
46 | 46 | } catch (ApiError $e) { |
47 | - echo $e->getCode() . PHP_EOL; |
|
48 | - echo $e->getMessage() . PHP_EOL; |
|
47 | + echo $e->getCode().PHP_EOL; |
|
48 | + echo $e->getMessage().PHP_EOL; |
|
49 | 49 | } |
@@ -17,37 +17,37 @@ |
||
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->getAddresses($options); |
|
29 | - print_r($res); |
|
30 | - |
|
31 | - ///////////////////////////////////////////// |
|
32 | - // get only the 5 fields of address |
|
33 | - $options = [ |
|
34 | - 'fields' => "address_id, address_1, first_name, last_name, address_city", |
|
35 | - 'limit' => 5, |
|
36 | - 'offset' => 0 |
|
37 | - ]; |
|
38 | - $res = $ab->getAddresses($options); |
|
39 | - print_r($res); |
|
40 | - |
|
41 | - ///////////////////////////////////////////// |
|
42 | - // get the first 5 addresses from the server that match quere 'France' |
|
43 | - $options = [ |
|
44 | - 'query' => 'France', |
|
45 | - 'limit' => 10, |
|
46 | - 'offset' => 0 |
|
47 | - ]; |
|
48 | - $res = $ab->getAddresses($options); |
|
49 | - 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->getAddresses($options); |
|
29 | + print_r($res); |
|
30 | + |
|
31 | + ///////////////////////////////////////////// |
|
32 | + // get only the 5 fields of address |
|
33 | + $options = [ |
|
34 | + 'fields' => "address_id, address_1, first_name, last_name, address_city", |
|
35 | + 'limit' => 5, |
|
36 | + 'offset' => 0 |
|
37 | + ]; |
|
38 | + $res = $ab->getAddresses($options); |
|
39 | + print_r($res); |
|
40 | + |
|
41 | + ///////////////////////////////////////////// |
|
42 | + // get the first 5 addresses from the server that match quere 'France' |
|
43 | + $options = [ |
|
44 | + 'query' => 'France', |
|
45 | + 'limit' => 10, |
|
46 | + 'offset' => 0 |
|
47 | + ]; |
|
48 | + $res = $ab->getAddresses($options); |
|
49 | + print_r($res); |
|
50 | 50 | } catch (ApiError $e) { |
51 | - echo $e->getCode() . PHP_EOL; |
|
52 | - echo $e->getMessage() . PHP_EOL; |
|
51 | + echo $e->getCode() . PHP_EOL; |
|
52 | + echo $e->getMessage() . PHP_EOL; |
|
53 | 53 | } |
@@ -48,6 +48,6 @@ |
||
48 | 48 | $res = $ab->getAddresses($options); |
49 | 49 | print_r($res); |
50 | 50 | } catch (ApiError $e) { |
51 | - echo $e->getCode() . PHP_EOL; |
|
52 | - echo $e->getMessage() . PHP_EOL; |
|
51 | + echo $e->getCode().PHP_EOL; |
|
52 | + echo $e->getMessage().PHP_EOL; |
|
53 | 53 | } |
@@ -17,24 +17,24 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
20 | + $ab = new AddressBook(); |
|
21 | 21 | |
22 | - $filter = [ |
|
23 | - 'query' => 'Tusha', |
|
24 | - 'selected_areas' => [[ |
|
25 | - 'type' => 'circle', |
|
26 | - 'value' => [ |
|
27 | - 'center' => [ |
|
28 | - 'lat' => 38.024654, |
|
29 | - 'lng' => 77.338814 |
|
30 | - ], |
|
31 | - 'distance' => 10000 |
|
32 | - ] |
|
33 | - ]] |
|
34 | - ]; |
|
35 | - $res = $ab->deleteAddressesByAreas($filter); |
|
36 | - print_r($res); |
|
22 | + $filter = [ |
|
23 | + 'query' => 'Tusha', |
|
24 | + 'selected_areas' => [[ |
|
25 | + 'type' => 'circle', |
|
26 | + 'value' => [ |
|
27 | + 'center' => [ |
|
28 | + 'lat' => 38.024654, |
|
29 | + 'lng' => 77.338814 |
|
30 | + ], |
|
31 | + 'distance' => 10000 |
|
32 | + ] |
|
33 | + ]] |
|
34 | + ]; |
|
35 | + $res = $ab->deleteAddressesByAreas($filter); |
|
36 | + print_r($res); |
|
37 | 37 | } catch (ApiError $e) { |
38 | - echo $e->getCode() . PHP_EOL; |
|
39 | - echo $e->getMessage() . PHP_EOL; |
|
38 | + echo $e->getCode() . PHP_EOL; |
|
39 | + echo $e->getMessage() . PHP_EOL; |
|
40 | 40 | } |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | |
8 | 8 | namespace Route4Me; |
9 | 9 | |
10 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
11 | -require $root . '/vendor/autoload.php'; |
|
10 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
11 | +require $root.'/vendor/autoload.php'; |
|
12 | 12 | |
13 | 13 | use Route4Me\Exception\ApiError; |
14 | 14 | use Route4Me\V5\AddressBook\AddressBook; |
@@ -35,6 +35,6 @@ discard block |
||
35 | 35 | $res = $ab->deleteAddressesByAreas($filter); |
36 | 36 | print_r($res); |
37 | 37 | } catch (ApiError $e) { |
38 | - echo $e->getCode() . PHP_EOL; |
|
39 | - echo $e->getMessage() . PHP_EOL; |
|
38 | + echo $e->getCode().PHP_EOL; |
|
39 | + echo $e->getMessage().PHP_EOL; |
|
40 | 40 | } |
@@ -18,28 +18,28 @@ |
||
18 | 18 | Route4Me::setApiKey(Constants::API_KEY); |
19 | 19 | |
20 | 20 | try { |
21 | - $ab = new AddressBook(); |
|
22 | - |
|
23 | - ///////////////////////////////////////////// |
|
24 | - // update adress's by array |
|
25 | - $addressIds = [96121941, 96122542, 96100576]; |
|
26 | - $params = [ |
|
27 | - 'service_time' => 16, |
|
28 | - 'last_name' => 'Grigoriani V', |
|
29 | - 'address_phone_number' => '+1234567890' |
|
30 | - ]; |
|
31 | - $res = $ab->updateAddressesByIds($addressIds, $params); |
|
32 | - print_r($res); |
|
33 | - |
|
34 | - ///////////////////////////////////////////// |
|
35 | - // update adress's by object UpdateAddress |
|
36 | - $addressIds = [96121941, 96122542, 96100576]; |
|
37 | - $address = new UpdateAddress(17); |
|
38 | - $address->last_name = 'Grigoriani VI'; |
|
39 | - $address->address_phone_number = '+0987654321'; |
|
40 | - $res = $ab->updateAddressesByIds($addressIds, $address); |
|
41 | - print_r($res); |
|
21 | + $ab = new AddressBook(); |
|
22 | + |
|
23 | + ///////////////////////////////////////////// |
|
24 | + // update adress's by array |
|
25 | + $addressIds = [96121941, 96122542, 96100576]; |
|
26 | + $params = [ |
|
27 | + 'service_time' => 16, |
|
28 | + 'last_name' => 'Grigoriani V', |
|
29 | + 'address_phone_number' => '+1234567890' |
|
30 | + ]; |
|
31 | + $res = $ab->updateAddressesByIds($addressIds, $params); |
|
32 | + print_r($res); |
|
33 | + |
|
34 | + ///////////////////////////////////////////// |
|
35 | + // update adress's by object UpdateAddress |
|
36 | + $addressIds = [96121941, 96122542, 96100576]; |
|
37 | + $address = new UpdateAddress(17); |
|
38 | + $address->last_name = 'Grigoriani VI'; |
|
39 | + $address->address_phone_number = '+0987654321'; |
|
40 | + $res = $ab->updateAddressesByIds($addressIds, $address); |
|
41 | + print_r($res); |
|
42 | 42 | } catch (ApiError $e) { |
43 | - echo $e->getCode() . PHP_EOL; |
|
44 | - echo $e->getMessage() . PHP_EOL; |
|
43 | + echo $e->getCode() . PHP_EOL; |
|
44 | + echo $e->getMessage() . PHP_EOL; |
|
45 | 45 | } |
@@ -40,6 +40,6 @@ |
||
40 | 40 | $res = $ab->updateAddressesByIds($addressIds, $address); |
41 | 41 | print_r($res); |
42 | 42 | } catch (ApiError $e) { |
43 | - echo $e->getCode() . PHP_EOL; |
|
44 | - echo $e->getMessage() . PHP_EOL; |
|
43 | + echo $e->getCode().PHP_EOL; |
|
44 | + echo $e->getMessage().PHP_EOL; |
|
45 | 45 | } |
@@ -17,29 +17,29 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
21 | - |
|
22 | - ///////////////////////////////////////////// |
|
23 | - // update adresses in circle aria |
|
24 | - $filter = [ |
|
25 | - 'query' => "Tusha", |
|
26 | - 'bounding_box' => null, |
|
27 | - 'selected_areas' => [[ |
|
28 | - 'type' => 'circle', |
|
29 | - 'value' => [ |
|
30 | - 'center' => [ |
|
31 | - 'lat' => 38.024654, |
|
32 | - 'lng' => 77.338814 |
|
33 | - ], |
|
34 | - 'distance' => 10000 |
|
35 | - ] |
|
36 | - ]], |
|
37 | - 'filename' => 'test_export.csv' |
|
38 | - ]; |
|
39 | - |
|
40 | - $res = $ab->exportAddressesByAreas($filter); |
|
41 | - print_r($res); |
|
20 | + $ab = new AddressBook(); |
|
21 | + |
|
22 | + ///////////////////////////////////////////// |
|
23 | + // update adresses in circle aria |
|
24 | + $filter = [ |
|
25 | + 'query' => "Tusha", |
|
26 | + 'bounding_box' => null, |
|
27 | + 'selected_areas' => [[ |
|
28 | + 'type' => 'circle', |
|
29 | + 'value' => [ |
|
30 | + 'center' => [ |
|
31 | + 'lat' => 38.024654, |
|
32 | + 'lng' => 77.338814 |
|
33 | + ], |
|
34 | + 'distance' => 10000 |
|
35 | + ] |
|
36 | + ]], |
|
37 | + 'filename' => 'test_export.csv' |
|
38 | + ]; |
|
39 | + |
|
40 | + $res = $ab->exportAddressesByAreas($filter); |
|
41 | + print_r($res); |
|
42 | 42 | } catch (ApiError $e) { |
43 | - echo $e->getCode() . PHP_EOL; |
|
44 | - echo $e->getMessage() . PHP_EOL; |
|
43 | + echo $e->getCode() . PHP_EOL; |
|
44 | + echo $e->getMessage() . PHP_EOL; |
|
45 | 45 | } |
@@ -40,6 +40,6 @@ |
||
40 | 40 | $res = $ab->exportAddressesByAreas($filter); |
41 | 41 | print_r($res); |
42 | 42 | } catch (ApiError $e) { |
43 | - echo $e->getCode() . PHP_EOL; |
|
44 | - echo $e->getMessage() . PHP_EOL; |
|
43 | + echo $e->getCode().PHP_EOL; |
|
44 | + echo $e->getMessage().PHP_EOL; |
|
45 | 45 | } |
@@ -17,12 +17,12 @@ |
||
17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
18 | 18 | |
19 | 19 | try { |
20 | - $ab = new AddressBook(); |
|
20 | + $ab = new AddressBook(); |
|
21 | 21 | |
22 | - $addressIds = [96121941, 96122542, 96100576]; |
|
23 | - $res = $ab->getAddressesByIds($addressIds); |
|
24 | - print_r($res); |
|
22 | + $addressIds = [96121941, 96122542, 96100576]; |
|
23 | + $res = $ab->getAddressesByIds($addressIds); |
|
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->getAddressesByIds($addressIds); |
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,40 +16,40 @@ |
||
16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
17 | 17 | |
18 | 18 | try { |
19 | - $ab = new AddressBook(); |
|
20 | - |
|
21 | - ///////////////////////////////////////////// |
|
22 | - // get the clusters with precision 1 |
|
23 | - $options = [ |
|
24 | - 'clustering' => [ |
|
25 | - 'precision' => 1 |
|
26 | - ] |
|
27 | - ]; |
|
28 | - $res = $ab->getAddressClustersByBodyPayload($options); |
|
29 | - print_r($res); |
|
30 | - |
|
31 | - ///////////////////////////////////////////// |
|
32 | - // get the clusters with precision 2 from selected area |
|
33 | - $options = [ |
|
34 | - 'clustering' => [ |
|
35 | - 'precision' => 2 |
|
36 | - ], |
|
37 | - 'filter' => [ |
|
38 | - 'selected_areas' => [[ |
|
39 | - 'type' => 'circle', |
|
40 | - 'value' => [ |
|
41 | - 'center' => [ |
|
42 | - 'lat' => 52.4025, |
|
43 | - 'lng' => 4.5601 |
|
44 | - ], |
|
45 | - 'distance' => 10000 |
|
46 | - ] |
|
47 | - ]] |
|
48 | - ] |
|
49 | - ]; |
|
50 | - $res = $ab->getAddressClustersByBodyPayload($options); |
|
51 | - print_r($res); |
|
19 | + $ab = new AddressBook(); |
|
20 | + |
|
21 | + ///////////////////////////////////////////// |
|
22 | + // get the clusters with precision 1 |
|
23 | + $options = [ |
|
24 | + 'clustering' => [ |
|
25 | + 'precision' => 1 |
|
26 | + ] |
|
27 | + ]; |
|
28 | + $res = $ab->getAddressClustersByBodyPayload($options); |
|
29 | + print_r($res); |
|
30 | + |
|
31 | + ///////////////////////////////////////////// |
|
32 | + // get the clusters with precision 2 from selected area |
|
33 | + $options = [ |
|
34 | + 'clustering' => [ |
|
35 | + 'precision' => 2 |
|
36 | + ], |
|
37 | + 'filter' => [ |
|
38 | + 'selected_areas' => [[ |
|
39 | + 'type' => 'circle', |
|
40 | + 'value' => [ |
|
41 | + 'center' => [ |
|
42 | + 'lat' => 52.4025, |
|
43 | + 'lng' => 4.5601 |
|
44 | + ], |
|
45 | + 'distance' => 10000 |
|
46 | + ] |
|
47 | + ]] |
|
48 | + ] |
|
49 | + ]; |
|
50 | + $res = $ab->getAddressClustersByBodyPayload($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->getAddressClustersByBodyPayload($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 | } |