@@ -7,64 +7,64 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class TelematicsVendor extends Common |
| 9 | 9 | { |
| 10 | - public $vendor_id; // Telematics Vendor id |
|
| 11 | - public $is_integrated; // If 1, the vendor is integrated in Route4Me |
|
| 12 | - public $page; // starting page |
|
| 13 | - public $per_page; // Vendors per page in a response |
|
| 14 | - public $country; // Country Alpha 2 code |
|
| 15 | - public $feature; // Vendor's feature |
|
| 16 | - public $search; // Searched text |
|
| 17 | - public $vendors; // Comma-delimited list of the vendors IDs. |
|
| 10 | + public $vendor_id; // Telematics Vendor id |
|
| 11 | + public $is_integrated; // If 1, the vendor is integrated in Route4Me |
|
| 12 | + public $page; // starting page |
|
| 13 | + public $per_page; // Vendors per page in a response |
|
| 14 | + public $country; // Country Alpha 2 code |
|
| 15 | + public $feature; // Vendor's feature |
|
| 16 | + public $search; // Searched text |
|
| 17 | + public $vendors; // Comma-delimited list of the vendors IDs. |
|
| 18 | 18 | |
| 19 | - public static function fromArray(array $params) { |
|
| 20 | - $vendorsParameters = new TelematicsVendor(); |
|
| 19 | + public static function fromArray(array $params) { |
|
| 20 | + $vendorsParameters = new TelematicsVendor(); |
|
| 21 | 21 | |
| 22 | - foreach ($params as $key => $value) { |
|
| 23 | - if (property_exists($vendorsParameters, $key)) { |
|
| 24 | - $vendorsParameters->{$key} = $value; |
|
| 25 | - } |
|
| 26 | - } |
|
| 22 | + foreach ($params as $key => $value) { |
|
| 23 | + if (property_exists($vendorsParameters, $key)) { |
|
| 24 | + $vendorsParameters->{$key} = $value; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - return $vendorsParameters; |
|
| 29 | - } |
|
| 28 | + return $vendorsParameters; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public static function GetTelematicsVendors($params) { |
|
| 32 | - Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
|
| 31 | + public static function GetTelematicsVendors($params) { |
|
| 32 | + Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
|
| 33 | 33 | |
| 34 | - $allQueryFields = array('vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors'); |
|
| 34 | + $allQueryFields = array('vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors'); |
|
| 35 | 35 | |
| 36 | - $vendors = Route4Me::makeRequst(array( |
|
| 37 | - 'url' => "", |
|
| 38 | - 'method' => 'GET', |
|
| 39 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 40 | - )); |
|
| 36 | + $vendors = Route4Me::makeRequst(array( |
|
| 37 | + 'url' => "", |
|
| 38 | + 'method' => 'GET', |
|
| 39 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 40 | + )); |
|
| 41 | 41 | |
| 42 | - return $vendors; |
|
| 43 | - } |
|
| 42 | + return $vendors; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public static function GetRandomVendorID($offset, $limit) { |
|
| 46 | - $allVendors = self::GetTelematicsVendors(null); |
|
| 47 | - $vendorsNumber = sizeof($allVendors['vendors']); |
|
| 45 | + public static function GetRandomVendorID($offset, $limit) { |
|
| 46 | + $allVendors = self::GetTelematicsVendors(null); |
|
| 47 | + $vendorsNumber = sizeof($allVendors['vendors']); |
|
| 48 | 48 | |
| 49 | - if ($vendorsNumber < $limit) { |
|
| 50 | - if ($vendorsNumber > $offset) { |
|
| 51 | - $limit = $vendorsNumber; |
|
| 52 | - } else { |
|
| 53 | - if ($vendorsNumber == $offset) { |
|
| 54 | - return $allVendors['vendors'][$offset]->{'vendor_id'}; |
|
| 55 | - } else { |
|
| 56 | - echo "The vendors numbers are less than offset"; |
|
| 57 | - return null; |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - } |
|
| 49 | + if ($vendorsNumber < $limit) { |
|
| 50 | + if ($vendorsNumber > $offset) { |
|
| 51 | + $limit = $vendorsNumber; |
|
| 52 | + } else { |
|
| 53 | + if ($vendorsNumber == $offset) { |
|
| 54 | + return $allVendors['vendors'][$offset]->{'vendor_id'}; |
|
| 55 | + } else { |
|
| 56 | + echo "The vendors numbers are less than offset"; |
|
| 57 | + return null; |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $randNumber = rand($offset, $limit); |
|
| 62 | + $randNumber = rand($offset, $limit); |
|
| 63 | 63 | |
| 64 | - return $allVendors['vendors'][$randNumber]['id']; |
|
| 65 | - } |
|
| 64 | + return $allVendors['vendors'][$randNumber]['id']; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /* |
|
| 67 | + /* |
|
| 68 | 68 | public static function GetTelematicsVendor($params) { |
| 69 | 69 | Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS); |
| 70 | 70 | |
@@ -83,4 +83,4 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | |
| 85 | 85 | } |
| 86 | - |
|
| 87 | 86 | \ No newline at end of file |
| 87 | + |
|
| 88 | 88 | \ No newline at end of file |
@@ -43,14 +43,14 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function GetRandomVendorID($offset, $limit) { |
| 46 | - $allVendors = self::GetTelematicsVendors(null); |
|
| 46 | + $allVendors = self::GetTelematicsVendors(null); |
|
| 47 | 47 | $vendorsNumber = sizeof($allVendors['vendors']); |
| 48 | 48 | |
| 49 | - if ($vendorsNumber < $limit) { |
|
| 50 | - if ($vendorsNumber > $offset) { |
|
| 49 | + if ($vendorsNumber<$limit) { |
|
| 50 | + if ($vendorsNumber>$offset) { |
|
| 51 | 51 | $limit = $vendorsNumber; |
| 52 | 52 | } else { |
| 53 | - if ($vendorsNumber == $offset) { |
|
| 53 | + if ($vendorsNumber==$offset) { |
|
| 54 | 54 | return $allVendors['vendors'][$offset]->{'vendor_id'}; |
| 55 | 55 | } else { |
| 56 | 56 | echo "The vendors numbers are less than offset"; |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | $randomVendorID = $vendors->GetRandomVendorID(0, 5); |
| 19 | 19 | |
| 20 | 20 | $vendorParameters = TelematicsVendor::fromArray(array( |
| 21 | - "vendor_id" => $randomVendorID |
|
| 21 | + "vendor_id" => $randomVendorID |
|
| 22 | 22 | )); |
| 23 | 23 | |
| 24 | 24 | $vendor = new TelematicsVendor(); |
| 25 | 25 | $vendorResult = $vendor->GetTelematicsVendors($vendorParameters); |
| 26 | 26 | |
| 27 | 27 | Route4Me::simplePrint($vendorResult); |
| 28 | - echo "<br>"; |
|
| 28 | + echo "<br>"; |
|
| 29 | 29 | |
@@ -14,18 +14,18 @@ |
||
| 14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 15 | 15 | |
| 16 | 16 | $vendorsParameters = TelematicsVendor::fromArray(array( |
| 17 | - //"country" => "GB", // uncomment this line for searching by Country |
|
| 18 | - "is_integrated" => 1, |
|
| 19 | - //"feature" => "satelite", // uncomment this line for searching by Feature |
|
| 20 | - "search" => "Fleet", |
|
| 21 | - "page" => 1, |
|
| 22 | - "per_page" => 5 |
|
| 17 | + //"country" => "GB", // uncomment this line for searching by Country |
|
| 18 | + "is_integrated" => 1, |
|
| 19 | + //"feature" => "satelite", // uncomment this line for searching by Feature |
|
| 20 | + "search" => "Fleet", |
|
| 21 | + "page" => 1, |
|
| 22 | + "per_page" => 5 |
|
| 23 | 23 | )); |
| 24 | 24 | |
| 25 | 25 | $vendors = new TelematicsVendor(); |
| 26 | 26 | $vendorsResults = $vendors->GetTelematicsVendors($vendorsParameters); |
| 27 | 27 | |
| 28 | 28 | foreach ($vendorsResults['vendors'] as $result) { |
| 29 | - Route4Me::simplePrint($result); |
|
| 30 | - echo "<br>"; |
|
| 29 | + Route4Me::simplePrint($result); |
|
| 30 | + echo "<br>"; |
|
| 31 | 31 | } |
@@ -21,6 +21,6 @@ |
||
| 21 | 21 | $vendorsResults = $vendors->GetTelematicsVendors($vendorsParameters); |
| 22 | 22 | |
| 23 | 23 | foreach ($vendorsResults['vendors'] as $result) { |
| 24 | - Route4Me::simplePrint($result); |
|
| 25 | - echo "<br>"; |
|
| 24 | + Route4Me::simplePrint($result); |
|
| 25 | + echo "<br>"; |
|
| 26 | 26 | } |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 15 | 15 | |
| 16 | 16 | $vendorsParameters = TelematicsVendor::fromArray(array( |
| 17 | - "vendors" => "55,56,57" |
|
| 17 | + "vendors" => "55,56,57" |
|
| 18 | 18 | )); |
| 19 | 19 | |
| 20 | 20 | $vendors = new TelematicsVendor(); |
| 21 | 21 | $comparisonResults = $vendors->GetTelematicsVendors($vendorsParameters); |
| 22 | 22 | |
| 23 | 23 | foreach ($comparisonResults['vendors'] as $result) { |
| 24 | - Route4Me::simplePrint($result, true); |
|
| 25 | - echo "<br>"; |
|
| 24 | + Route4Me::simplePrint($result, true); |
|
| 25 | + echo "<br>"; |
|
| 26 | 26 | } |