Skip to content

Commit

Permalink
Fix for zip codes with leading zeros (#4)
Browse files Browse the repository at this point in the history
* Fix for zip codes with leading zeros

* Update postal code doc type

* Change zipcode type to string
  • Loading branch information
MichaelMackus authored and daspecster committed Jun 22, 2016
1 parent f66ff57 commit 6227a4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Lookup
{
const ZIPTASTIC_LOOKUP_URL = 'https://zip.getziptastic.com/v3/%s/%d';
const ZIPTASTIC_LOOKUP_URL = 'https://zip.getziptastic.com/v3/%s/%s';

/**
* @var ServiceInterface;
Expand Down Expand Up @@ -42,12 +42,12 @@ public static function create($apiKey = null, $countryCode = 'US')

/**
* Get information on given $zipCode
* @param int $zipCode
* @param string $zipCode
* @return array[LookupModel]
*/
public function lookup($zipCode)
{
$url = sprintf(self::ZIPTASTIC_LOOKUP_URL, $this->countryCode, $zipCode);
$url = sprintf(self::ZIPTASTIC_LOOKUP_URL, $this->countryCode, (string) $zipCode);
$res = $this->service->get($url, $this->apiKey);

$collection = [];
Expand All @@ -57,4 +57,4 @@ public function lookup($zipCode)

return $collection;
}
}
}
4 changes: 2 additions & 2 deletions src/LookupModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LookupModel
private $stateShort;

/**
* @var int
* @var string
*/
private $postalCode;

Expand Down Expand Up @@ -95,7 +95,7 @@ public function stateShort()
}

/**
* @return int
* @return string
*/
public function postalCode()
{
Expand Down

0 comments on commit 6227a4c

Please sign in to comment.