ziptastic_api 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e86b04c8154a5b0d884048735edc31801723bd91
4
- data.tar.gz: 6e58d0deb378058edb64bbc9072f5a7a37a0ac60
3
+ metadata.gz: 7e226c6e49408c1f723a85544229b1a346235111
4
+ data.tar.gz: 9bbf74f941acb29214609c6dea385d5918f63a35
5
5
  SHA512:
6
- metadata.gz: 015d3bdc304336e3398142c7527f3790da201e3ee5202afae60c4aa5ca6d857112ae81168f1ce5ad1590b3cc209507d41ba3341c502fe03360220311d6dbb513
7
- data.tar.gz: 4427746c953aa14196ae11b39dddf8926c0ed0ad8da1229c9a157338b8db09ef2587a5e3b6f84aad4d9209ae3135545bad0bf4f9c1ef9c51e77e3208b707ec2c
6
+ metadata.gz: 8fc8cdbe4982acdbedc0f6111ea59acfa7b0ed73982f7226cf1d2441320762e9fcc7a1fb3ded7f840942b6433499aa638b605ceb3bc8fe61d3cdabb5fa1017a8
7
+ data.tar.gz: 314e7051614d62c64d05442c343527796de4f7beb0297c75405d141ca6629999cf8b874d0b8e3986854fa3a2daf0d18003fae234e2220274c44838ca8b1d3538
data/README.md CHANGED
@@ -23,6 +23,9 @@ Or install it yourself as:
23
23
  ```
24
24
  $> ZiptasticApi.get("FR", "78711")
25
25
  => #<ZiptasticApi::Response:0x007f36aedb5358 @city="Mantes-la-Ville", @country="FR", @county="Yvelines", @state="Île-de-France", @state_short="A8", @postal_code="78711">
26
+
27
+ $> ZiptasticApi.get("FR", "AZERTY")
28
+ => ZiptasticApi::UnkownZipCodeError: unknown 'FR':'AZERTY'
26
29
  ```
27
30
 
28
31
  ## Contributing
@@ -4,5 +4,6 @@ module ZiptasticApi
4
4
  end
5
5
  end
6
6
 
7
+ require 'ziptastic_api/error'
7
8
  require 'ziptastic_api/response'
8
9
  require 'ziptastic_api/request'
@@ -0,0 +1,2 @@
1
+ class ZiptasticApi::UnkownZipCodeError < StandardError
2
+ end
@@ -7,7 +7,11 @@ module ZiptasticApi
7
7
  end
8
8
 
9
9
  def response
10
- @response ||= Response.new(api_response.parsed_response)
10
+ @response ||= begin
11
+ raise UnkownZipCodeError.new("unknown '#{country_code}':'#{zip_code}'") if api_response.parsed_response.empty?
12
+
13
+ Response.new(api_response.parsed_response)
14
+ end
11
15
  end
12
16
 
13
17
  private
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "ziptastic_api"
7
- spec.version = '0.1'
7
+ spec.version = '0.2'
8
8
  spec.authors = ["Marion Duprey"]
9
9
  spec.email = ["marion.duprey@gmail.com"]
10
10
  spec.summary = %q{Easily make requests to the Ziptastic API}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ziptastic_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marion Duprey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-26 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,7 @@ files:
65
65
  - README.md
66
66
  - Rakefile
67
67
  - lib/ziptastic_api.rb
68
+ - lib/ziptastic_api/error.rb
68
69
  - lib/ziptastic_api/request.rb
69
70
  - lib/ziptastic_api/response.rb
70
71
  - ziptastic-api.gemspec