zipcodeservices 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTg5NmJkOTk1Njc2ZWZlOGM0YjlhNzFlYzUyNTg0NjNmNTA3MWQyMA==
4
+ MWY3NjA0MDJhYTU0NGY3YTRlMmYzYmM5N2RlNjQ4NGVhMTRjM2JiNA==
5
5
  data.tar.gz: !binary |-
6
- NzY2MmUzODhmZTQwOTBjMzdiZDYxNjU4MTBjY2I4ZGY3NGJkY2QxZQ==
6
+ MWY5MTRhMDRhMTI1YWQ2YjEzYzQxNWY5ODBmMDhmOGE5ODQzMzNlOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTVkZjNmMmE3OWVlNDliNjhiMTgzNjRjNDIwMTllZTdlOGIyYTE2YWY5NDA1
10
- YTY2MjAyM2Y1NGE2NDRmMTBhYTYyMTAyM2ZlZGNmNzg5OWU1MDY4ODNiZTM1
11
- ZTEzZWFhY2NlMjEyMmJmNjU3OWE1Y2Q1ZDVkNTc0M2FlYzI2ZGM=
9
+ YmUzNjJmMjUzMmI2ZmM5ZGJkMzcyMWM4MTMxYWQ2MDlkNDAwNWIwM2FjYWZl
10
+ ZTdhZmU5MjYwMTgzYmY1MWZiMDUyMWFjOTM4NzI1YmM4MTk4YjkzOGE3OTcw
11
+ M2ZhNjQ2MzNiNzJjNDRhYzFiOWJlNzQyZDA0MDM0YTVlNzljZWI=
12
12
  data.tar.gz: !binary |-
13
- MDgzZWRhMTgwYTUwZjkwODViNzI2NzRkMGJkNDQxOTcxNDVkMDE0NjZlZTI5
14
- NTQ2MDBjZDAzMzdhMGI1MTBiYTQ4NzY2YTYyZGQyZmViMjIzMzllYmUyNDBh
15
- N2RhZDcwNGI2OWU4OWM1Zjg2MTE1OGIyOTllMTA3Y2M0NmUyZGU=
13
+ YzM5YmFmOThhYzQyMTgxNzVmMGMxOWFmMDRlZjlkNTMxYjBhNjI4N2UyNzgz
14
+ NDcxNWFhNWFmZTdmN2YyZDNkZWE2NWI3YzIyNjY0ZjJiZThlOWIwYjNlOTAx
15
+ YWIzMjBmMDgxZjQ2YzYyZjE1YmQ3MzQyZjYzZWI5ZTFmZmZlMDQ=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zipcodeservices (0.0.3)
4
+ zipcodeservices (0.0.4)
5
5
  multi_xml (~> 0.5)
6
6
  nokogiri (~> 1.6)
7
7
  typhoeus (= 0.3.3)
@@ -11,58 +11,46 @@ GEM
11
11
  specs:
12
12
  celluloid (0.15.2)
13
13
  timers (~> 1.1.0)
14
- celluloid-io (0.15.0)
15
- celluloid (>= 0.15.0)
16
- nio4r (>= 0.5.0)
17
14
  coderay (1.1.0)
18
- columnize (0.8.9)
19
- debugger (1.6.6)
20
- columnize (>= 0.3.1)
21
- debugger-linecache (~> 1.2.0)
22
- debugger-ruby_core_source (~> 1.3.2)
23
- debugger-linecache (1.2.0)
24
- debugger-ruby_core_source (1.3.2)
25
15
  diff-lcs (1.2.5)
26
16
  ffi (1.9.3)
27
- formatador (0.2.4)
28
- guard (2.6.0)
17
+ formatador (0.2.5)
18
+ guard (2.6.1)
29
19
  formatador (>= 0.2.4)
30
20
  listen (~> 2.7)
31
21
  lumberjack (~> 1.0)
32
22
  pry (>= 0.9.12)
33
23
  thor (>= 0.18.1)
34
- guard-rspec (4.2.8)
24
+ guard-rspec (4.3.1)
35
25
  guard (~> 2.1)
36
26
  rspec (>= 2.14, < 4.0)
37
- listen (2.7.4)
27
+ listen (2.7.9)
38
28
  celluloid (>= 0.15.2)
39
- celluloid-io (>= 0.15.0)
40
29
  rb-fsevent (>= 0.9.3)
41
30
  rb-inotify (>= 0.9)
42
- lumberjack (1.0.5)
31
+ lumberjack (1.0.9)
43
32
  method_source (0.8.2)
44
- mime-types (2.2)
45
- mini_portile (0.5.3)
33
+ mime-types (2.3)
34
+ mini_portile (0.6.0)
46
35
  multi_xml (0.5.5)
47
- nio4r (1.0.0)
48
- nokogiri (1.6.2)
49
- mini_portile (~> 0.5.2)
50
- pry (0.9.12.6)
51
- coderay (~> 1.0)
52
- method_source (~> 0.8)
36
+ nokogiri (1.6.3.1)
37
+ mini_portile (= 0.6.0)
38
+ pry (0.10.1)
39
+ coderay (~> 1.1.0)
40
+ method_source (~> 0.8.1)
53
41
  slop (~> 3.4)
54
42
  rb-fsevent (0.9.4)
55
- rb-inotify (0.9.4)
43
+ rb-inotify (0.9.5)
56
44
  ffi (>= 0.5.0)
57
- rspec (2.14.1)
58
- rspec-core (~> 2.14.0)
59
- rspec-expectations (~> 2.14.0)
60
- rspec-mocks (~> 2.14.0)
61
- rspec-core (2.14.8)
62
- rspec-expectations (2.14.5)
45
+ rspec (2.99.0)
46
+ rspec-core (~> 2.99.0)
47
+ rspec-expectations (~> 2.99.0)
48
+ rspec-mocks (~> 2.99.0)
49
+ rspec-core (2.99.2)
50
+ rspec-expectations (2.99.2)
63
51
  diff-lcs (>= 1.1.3, < 2.0)
64
- rspec-mocks (2.14.6)
65
- slop (3.5.0)
52
+ rspec-mocks (2.99.2)
53
+ slop (3.6.0)
66
54
  thor (0.19.1)
67
55
  timers (1.1.0)
68
56
  typhoeus (0.3.3)
@@ -73,7 +61,6 @@ PLATFORMS
73
61
  ruby
74
62
 
75
63
  DEPENDENCIES
76
- debugger
77
64
  guard-rspec (~> 4.2)
78
65
  rspec (~> 2.13)
79
66
  vcr (~> 2.4)
data/README.md CHANGED
@@ -34,7 +34,14 @@ Installation for contributors
34
34
 
35
35
  Please write tests for any changes you make or we will have our way with you
36
36
 
37
- ## LICENSE
37
+ ## License
38
38
 
39
+ [The MIT License (MIT)](http://vulk.mit-license.org)
39
40
 
40
- Licensed under [MIT](http://vulk.mit-license.org/)
41
+ Copyright (c) 2014 Vulk <[wolfpack@vulk.co](mailto:wolfpack@vulk.co)>
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44
+
45
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -19,7 +19,7 @@ module IpAddressServices
19
19
  "#{@base_uri}/#{fmt}"
20
20
  end
21
21
 
22
- def zip_by_ip(ipaddress)
22
+ def get_ip_address(ipaddress)
23
23
  #/{apikey}/{ipadderss}
24
24
  response = Typhoeus::Request.get( "#{base_uri}/ipaddress.svc/GetIP?apikey=#{apikey}&ip=#{ipaddress}")
25
25
  if response.code == 200
@@ -38,7 +38,7 @@ module IpAddressServices
38
38
  end
39
39
  end
40
40
 
41
- def radius_by_ip(ipaddress, rad)
41
+ def zip_codes_in_radius_of_ip(ipaddress, rad)
42
42
  response = Typhoeus::Request.get( "#{base_uri}/ipaddress.svc/GetZipsInRadiusOfIP?apikey=#{apikey}&ip=#{ipaddress}&radius=#{rad}")
43
43
  if response.code == 200
44
44
  if data_format == :xml
@@ -19,24 +19,6 @@ module ZipCodeServices
19
19
  "#{@base_uri}/#{fmt}"
20
20
  end
21
21
 
22
- def get_ip(ip)
23
- response = Typhoeus::Request.get( "#{base_uri}/ipaddress.svc/GetIp?apikey=#{apikey}&ip=#{ip}")
24
- if response.code == 200
25
- if data_format == :xml
26
- j = MultiXml.parse(response.body)
27
- raise "BAD API KEY" if j.first[1].first[1]["City"] == nil
28
- else
29
- j = JSON::parse(response.body)
30
- raise "BAD API KEY" if j.first[1]["City"] == nil
31
- end
32
- j
33
- elsif response.code == 404
34
- nil
35
- else
36
- raise response.body
37
- end
38
- end
39
-
40
22
  def zipcode(zip)
41
23
  #/{apikey}/{zipcode}
42
24
  response = Typhoeus::Request.get( "#{base_uri}/zipcodes.svc/#{apikey}/#{zip}")
@@ -56,7 +38,7 @@ module ZipCodeServices
56
38
  end
57
39
  end
58
40
 
59
- def radius(zip, rad)
41
+ def get_zipcodes_in_radius_of_zipcode(zip, rad)
60
42
  response = Typhoeus::Request.get( "#{base_uri}/zipcodes.svc/#{apikey}/#{zip}/#{rad}")
61
43
  if response.code == 200
62
44
  if data_format == :xml
@@ -74,7 +56,7 @@ module ZipCodeServices
74
56
  end
75
57
  end
76
58
 
77
- def radius_by_latlong(lat, lon, rad)
59
+ def get_zips_in_radius_of_latlong(lat, lon, rad)
78
60
  response = Typhoeus::Request.get( "#{base_uri}/zipcodes.svc/GetZipCodesInRadiusLatLong?apikey=#{apikey}&latitude=#{lat}&longitude=#{lon}&radius=#{rad}")
79
61
  if response.code == 200
80
62
  if data_format == :xml
@@ -1,3 +1,3 @@
1
1
  module ZipCodeServices
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -10,13 +10,13 @@ describe "json client" do
10
10
  end
11
11
 
12
12
  it "should retrieve ip address info", :vcr, record: :all do
13
- zips = IpAddressServices.zip_by_ip("184.98.179.3")
13
+ zips = IpAddressServices.get_ip_address("184.98.179.3")
14
14
  zips.first[1]["City"].should == "Phoenix"
15
15
  # test other item
16
16
  end
17
17
 
18
18
  it "should get zip codes in radius of ip address", :vcr, record: :all do
19
- zips = IpAddressServices.radius_by_ip("184.98.179.3", 1)
19
+ zips = IpAddressServices.zip_codes_in_radius_of_ip("184.98.179.3", 1)
20
20
  zips.first[1].first["PostalCode"].should == "86323"
21
21
  end
22
22
  end
@@ -27,13 +27,13 @@ describe "xml client" do
27
27
  end
28
28
 
29
29
  it "should retrieve ip address info", :vcr, record: :all do
30
- zips = IpAddressServices.zip_by_ip("184.98.179.3")
30
+ zips = IpAddressServices.get_ip_address("184.98.179.3")
31
31
  zips.first[1].first[1]["City"].should == "Phoenix"
32
32
  # test other item
33
33
  end
34
34
 
35
35
  it "should get zip codes in radius of ip address", :vcr, record: :all do
36
- zips = IpAddressServices.radius_by_ip("184.98.179.3", 1)
36
+ zips = IpAddressServices.zip_codes_in_radius_of_ip("184.98.179.3", 1)
37
37
  zips.first[1].first[1].first[1]["PostalCode"].should == "86323"
38
38
  end
39
39
  end
@@ -15,12 +15,12 @@ describe "json client" do
15
15
  end
16
16
 
17
17
  it "should get zip codes in radius of zip code", :vcr, record: :all do
18
- zips = ZipCodeServices.radius(78702, 1)
18
+ zips = ZipCodeServices.get_zipcodes_in_radius_of_zipcode(78702, 1)
19
19
  zips.first[1].first["PostalCode"].should == "78701"
20
20
  end
21
21
 
22
22
  it "should get zip codes in radius of latitude and longitude", :vcr, record: :all do
23
- zips = ZipCodeServices.radius_by_latlong("30.2645715", "-97.7284341", 1)
23
+ zips = ZipCodeServices.get_zips_in_radius_of_latlong("30.2645715", "-97.7284341", 1)
24
24
  zips.first[1].first["PostalCode"].should == "73301"
25
25
  end
26
26
 
@@ -73,12 +73,12 @@ describe "xml client" do
73
73
  end
74
74
 
75
75
  it "should get zip codes in radius of zip code", :vcr, record: :all do
76
- zips = ZipCodeServices.radius(78702, 1)
76
+ zips = ZipCodeServices.get_zipcodes_in_radius_of_zipcode(78702, 1)
77
77
  zips.first[1].first[1].first[1].first["PostalCode"].should == "78701"
78
78
  end
79
79
 
80
80
  it "should get zip codes in radius of latitude and longitude", :vcr, record: :all do
81
- zips = ZipCodeServices.radius_by_latlong("30.2645715", "-97.7284341", 1)
81
+ zips = ZipCodeServices.get_zips_in_radius_of_latlong("30.2645715", "-97.7284341", 1)
82
82
  zips.first[1]["GetZipCodesInRadiusOfLatLongResult"]["ZipCodeWithDistanceDTO"][0]["PostalCode"].should == "73301"
83
83
  end
84
84
 
@@ -118,15 +118,3 @@ describe "xml client" do
118
118
  end
119
119
  end
120
120
 
121
- describe "json client for ip services" do
122
- before(:each) do
123
- ZipCodeServices.data_format = :json
124
- end
125
-
126
- it "should retrieve address information for an ip address", :vcr, record: :all do
127
- ip_address = ZipCodeServices.get_ip("184.98.179.3")
128
- ip_address.first[1]["City"].should == "Phoenix"
129
- # test other item
130
- end
131
-
132
- end
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'rspec', ["~> 2.13"]
24
24
  s.add_development_dependency 'vcr',["~> 2.4"]
25
25
  s.add_development_dependency 'guard-rspec', ["~> 4.2"]
26
- s.add_development_dependency 'debugger'
26
+ # s.add_development_dependency 'debugger'
27
27
 
28
28
  s.add_runtime_dependency "typhoeus", "0.3.3"
29
29
  s.add_runtime_dependency "multi_xml", ["~> 0.5"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipcodeservices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - W Watson
@@ -55,20 +55,6 @@ dependencies:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
57
  version: '4.2'
58
- - !ruby/object:Gem::Dependency
59
- name: debugger
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - ! '>='
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
- type: :development
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - ! '>='
70
- - !ruby/object:Gem::Version
71
- version: '0'
72
58
  - !ruby/object:Gem::Dependency
73
59
  name: typhoeus
74
60
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +104,6 @@ executables: []
118
104
  extensions: []
119
105
  extra_rdoc_files: []
120
106
  files:
121
- - .env.example
122
107
  - .gitignore
123
108
  - Gemfile
124
109
  - Gemfile.lock
@@ -186,3 +171,4 @@ test_files:
186
171
  - spec/vcr_cassettes/json/client_should_return_zips_in_radius_of_ip_address.yml
187
172
  - spec/vcr_cassettes/xml/client_should_get_zip_codes_in_radius_of_zip_code.yml
188
173
  - spec/vcr_cassettes/xml/client_should_retrieve_zip_code_info.yml
174
+ has_rdoc:
@@ -1 +0,0 @@
1
- export ZIP_CODE_SERVICES_API_KEY="YOUR API KEY HERE"