geocodio 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8dcb40046fc86fce3f7b2c8a9c4f4ef41b53d7a
4
+ data.tar.gz: 47cc99f61cb0a754c8c45b836202c4fcd9f7f0f7
5
+ SHA512:
6
+ metadata.gz: 858cc6961cfbccd641fe50f986fb9619d36e764c8cad964d2dc0d4213cd3150b6dcf3832eb2a72c6f676691219e80a910539c21360c0888d35d998737269bb82
7
+ data.tar.gz: 4b8d438007691efc8a71188635864dfe22c4f9d79fec9400b85f460c15ebe1062038a307994400a9c4b59248e0b523fb78c8d8942b0b7d7520b43b431800ec53
data/lib/geocodio.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'geocodio/address'
2
+ require 'geocodio/address_set'
3
+ require 'geocodio/client'
4
+
5
+ require 'geocodio/version'
6
+
7
+ module Geocodio
8
+ end
@@ -0,0 +1,47 @@
1
+ module Geocodio
2
+ class Address
3
+ attr_accessor :number
4
+ attr_accessor :street
5
+ attr_accessor :suffix
6
+ attr_accessor :city
7
+ attr_accessor :state
8
+ attr_accessor :zip
9
+
10
+ attr_accessor :latitude
11
+ attr_accessor :longitude
12
+ alias :lat :latitude
13
+ alias :lng :longitude
14
+
15
+ # How accurage geocod.io deemed this result to be given the original query.
16
+ #
17
+ # @return [Float] a number between 0 and 1
18
+ attr_accessor :accuracy
19
+
20
+ def initialize(payload = {})
21
+ if payload['address_components']
22
+ @number = payload['address_components']['number']
23
+ @street = payload['address_components']['street']
24
+ @suffix = payload['address_components']['suffix']
25
+ @city = payload['address_components']['city']
26
+ @state = payload['address_components']['state']
27
+ @zip = payload['address_components']['zip']
28
+ end
29
+
30
+ if payload['location']
31
+ @latitude = payload['location']['lat']
32
+ @longitude = payload['location']['lng']
33
+ end
34
+
35
+ @accuracy = payload['accuracy']
36
+
37
+ @formatted_address = payload['formatted_address']
38
+ end
39
+
40
+ # Formats the address in the standard way.
41
+ #
42
+ # @return [String] a formatted address
43
+ def to_s
44
+ @formatted_address
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,37 @@
1
+ # AddressSet is a collection of Geocodio::Address objects that get returned from
2
+ # a query to geocod.io. Because one query can return multiple results, each with
3
+ # an accuracy, a collection to manage them is needed. Most of the time, the user
4
+ # should only need to use the #best method.
5
+ module Geocodio
6
+ class AddressSet
7
+ include Enumerable
8
+
9
+ # Returns the query that retrieved this result set.
10
+ #
11
+ # @return [String] the original query
12
+ attr_reader :query
13
+
14
+ def initialize(query, *addresses)
15
+ @query = query
16
+ @addresses = addresses
17
+ end
18
+
19
+ def each(&block)
20
+ @addresses.each(&block)
21
+ end
22
+
23
+ # Returns the result that geocod.io deemed the most accurate for the query.
24
+ #
25
+ # @return [Geocodio::Address] the most accurate address
26
+ def best
27
+ max_by(&:accuracy)
28
+ end
29
+
30
+ # Returns the number of addresses contained in this result set.
31
+ #
32
+ # @return [Integer] the number of addresses
33
+ def size
34
+ @addresses.size
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,110 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'cgi'
4
+
5
+ require 'geocodio/client/error'
6
+ require 'geocodio/client/response'
7
+
8
+ module Geocodio
9
+ class Client
10
+ CONTENT_TYPE = 'application/json'
11
+ METHODS = {
12
+ :get => Net::HTTP::Get,
13
+ :post => Net::HTTP::Post,
14
+ :put => Net::HTTP::Put,
15
+ :delete => Net::HTTP::Delete
16
+ }
17
+ HOST = 'api.geocod.io'
18
+ BASE_PATH = '/v1'
19
+ PORT = 80
20
+
21
+ def initialize(api_key = ENV['GEOCODIO_API_KEY'])
22
+ @api_key = api_key
23
+ end
24
+
25
+ # Geocodes one or more addresses. If one address is specified, a GET request
26
+ # is submitted to http://api.geocod.io/v1/geocode. Multiple addresses will
27
+ # instead submit a POST request.
28
+ #
29
+ # @param addresses [Array] one or more String addresses
30
+ # @return [Geocodio::Address, Array<Geocodio::AddressSet>] One or more Address Sets
31
+ def geocode(*addresses)
32
+ addresses = addresses.first if addresses.first.is_a?(Array)
33
+
34
+ if addresses.size < 1
35
+ raise ArgumentError, 'You must provide at least one address to geocode.'
36
+ elsif addresses.size == 1
37
+ geocode_single(addresses.first)
38
+ else
39
+ geocode_batch(addresses)
40
+ end
41
+ end
42
+
43
+ # Sends a GET request to http://api.geocod.io/v1/parse to correctly dissect
44
+ # an address into individual parts. As this endpoint does not do any
45
+ # geocoding, parts missing from the passed address will be missing from the
46
+ # result.
47
+ #
48
+ # @param address [String] the full or partial address to parse
49
+ # @return [Geocodio::Address] a parsed and formatted Address
50
+ def parse(address)
51
+ Address.new get('/parse', q: address).body
52
+ end
53
+
54
+ private
55
+
56
+ METHODS.each do |method, _|
57
+ define_method(method) do |path, params = {}, options = {}|
58
+ request method, path, options.merge(params: params)
59
+ end
60
+ end
61
+
62
+ def geocode_single(address)
63
+ response = get '/geocode', q: address
64
+ results = response.body['results']
65
+ query = response.body['input']['formatted_address']
66
+ addresses = results.map { |result| Address.new(result) }
67
+
68
+ AddressSet.new(query, *addresses)
69
+ end
70
+
71
+ def geocode_batch(addresses)
72
+ response = post '/geocode', {}, body: addresses
73
+ result_sets = response.body['results']
74
+
75
+ result_sets.map do |result_set|
76
+ query = result_set['response']['input']['formatted_address']
77
+ results = result_set['response']['results']
78
+ addresses = results.map { |result| Address.new(result) }
79
+
80
+ AddressSet.new(query, *addresses)
81
+ end
82
+ end
83
+
84
+ def request(method, path, options)
85
+ path += "?api_key=#{@api_key}"
86
+
87
+ if params = options[:params] and !params.empty?
88
+ q = params.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }
89
+ path += "&#{q.join('&')}"
90
+ end
91
+
92
+ req = METHODS[method].new(BASE_PATH + path, 'Accept' => CONTENT_TYPE)
93
+
94
+ if options.key?(:body)
95
+ req['Content-Type'] = CONTENT_TYPE
96
+ req.body = options[:body] ? JSON.dump(options[:body]) : ''
97
+ end
98
+
99
+ http = Net::HTTP.new HOST, PORT
100
+ res = http.start { http.request(req) }
101
+
102
+ case res
103
+ when Net::HTTPSuccess
104
+ return Response.new(res)
105
+ else
106
+ raise Error, res
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,15 @@
1
+ module Geocodio
2
+ class Client
3
+ class Error < RuntimeError
4
+ attr_reader :response
5
+
6
+ def initialize(response)
7
+ @response, @json = response, JSON.parse(response.body)
8
+ end
9
+
10
+ def body() @json end
11
+ def message() body['error'] end
12
+ alias :error :message
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ require 'json'
2
+
3
+ module Geocodio
4
+ class Client
5
+ class Response
6
+ attr_reader :body
7
+
8
+ def initialize(response)
9
+ @body = JSON.parse(response.body)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Geocodio
2
+ class Version
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ PATCH = 0
6
+
7
+ def self.to_s
8
+ [MAJOR, MINOR, PATCH].join('.')
9
+ end
10
+ end
11
+
12
+ VERSION = Version.to_s
13
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geocodio::AddressSet do
4
+ let(:geocodio) { Geocodio::Client.new }
5
+ let(:addresses) do
6
+ [
7
+ '1 Infinite Loop Cupertino CA 95014',
8
+ '54 West Colorado Boulevard Pasadena CA 91105',
9
+ '826 Howard Street San Francisco CA 94103'
10
+ ]
11
+ end
12
+
13
+ subject(:address_set) do
14
+ VCR.use_cassette('batch_geocode') do
15
+ geocodio.geocode(*addresses).last
16
+ end
17
+ end
18
+
19
+ it 'has a size' do
20
+ expect(address_set.size).to eq(2)
21
+ end
22
+
23
+ it 'has a best' do
24
+ expect(address_set.best).to be_a(Geocodio::Address)
25
+ expect(address_set.best.accuracy).to eq(1)
26
+ end
27
+
28
+ it 'references the original query' do
29
+ expect(address_set.query).to eq('826 Howard St, San Francisco CA, 94103')
30
+ end
31
+ end
@@ -0,0 +1,97 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geocodio::Address do
4
+ let(:geocodio) { Geocodio::Client.new }
5
+
6
+ context 'when parsed' do
7
+ subject(:address) do
8
+ VCR.use_cassette('parse') do
9
+ geocodio.parse('1 Infinite Loop Cupertino CA 95014')
10
+ end
11
+ end
12
+
13
+ it 'has a number' do
14
+ expect(address.number).to eq('1')
15
+ end
16
+
17
+ it 'has a street' do
18
+ expect(address.street).to eq('Infinite')
19
+ end
20
+
21
+ it 'has a suffix' do
22
+ expect(address.suffix).to eq('Loop')
23
+ end
24
+
25
+ it 'has a city' do
26
+ expect(address.city).to eq('Cupertino')
27
+ end
28
+
29
+ it 'has a state' do
30
+ expect(address.state).to eq('CA')
31
+ end
32
+
33
+ it 'has a zip' do
34
+ expect(address.zip).to eq('95014')
35
+ end
36
+
37
+ it 'does not have a latitude' do
38
+ expect(address.latitude).to be_nil
39
+ expect(address.lat).to be_nil
40
+ end
41
+
42
+ it 'does not have a longitude' do
43
+ expect(address.longitude).to be_nil
44
+ expect(address.lng).to be_nil
45
+ end
46
+
47
+ it 'does not have an accuracy' do
48
+ expect(address.accuracy).to be_nil
49
+ end
50
+ end
51
+
52
+ context 'when geocoded' do
53
+ subject(:address) do
54
+ VCR.use_cassette('geocode') do
55
+ geocodio.geocode('1 Infinite Loop Cupertino CA 95014').best
56
+ end
57
+ end
58
+
59
+ it 'has a number' do
60
+ expect(address.number).to eq('1')
61
+ end
62
+
63
+ it 'has a street' do
64
+ expect(address.street).to eq('Infinite')
65
+ end
66
+
67
+ it 'has a suffix' do
68
+ expect(address.suffix).to eq('Loop')
69
+ end
70
+
71
+ it 'has a city' do
72
+ expect(address.city).to eq('Monta Vista')
73
+ end
74
+
75
+ it 'has a state' do
76
+ expect(address.state).to eq('CA')
77
+ end
78
+
79
+ it 'has a zip' do
80
+ expect(address.zip).to eq('95014')
81
+ end
82
+
83
+ it 'has a latitude' do
84
+ expect(address.latitude).to eq(37.331669)
85
+ expect(address.lat).to eq(37.331669)
86
+ end
87
+
88
+ it 'has a longitude' do
89
+ expect(address.longitude).to eq(-122.03074)
90
+ expect(address.lng).to eq(-122.03074)
91
+ end
92
+
93
+ it 'has an accuracy' do
94
+ expect(address.accuracy).to eq(1)
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geocodio::Client do
4
+ let(:geocodio) { Geocodio::Client.new }
5
+ let(:address) { '1 Infinite Loop Cupertino CA 95014' }
6
+
7
+ it 'requires an API key' do
8
+ VCR.use_cassette('invalid_key') do
9
+ expect { geocodio.geocode(address) }.to raise_error(Geocodio::Client::Error)
10
+ end
11
+ end
12
+
13
+ it 'parses an address into components' do
14
+ VCR.use_cassette('parse') do
15
+ result = geocodio.parse(address)
16
+
17
+ expect(result).to be_a(Geocodio::Address)
18
+ end
19
+ end
20
+
21
+ it 'geocodes a single address' do
22
+ VCR.use_cassette('geocode') do
23
+ addresses = geocodio.geocode(address)
24
+
25
+ expect(addresses.size).to eq(1)
26
+ expect(addresses).to be_a(Geocodio::AddressSet)
27
+ end
28
+ end
29
+
30
+ it 'geocodes multiple addresses' do
31
+ VCR.use_cassette('batch_geocode') do
32
+ addresses = [
33
+ '1 Infinite Loop Cupertino CA 95014',
34
+ '54 West Colorado Boulevard Pasadena CA 91105',
35
+ '826 Howard Street San Francisco CA 94103'
36
+ ]
37
+
38
+ addresses = geocodio.geocode(*addresses)
39
+
40
+ expect(addresses.size).to eq(3)
41
+ addresses.each { |address| expect(address).to be_a(Geocodio::AddressSet) }
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,23 @@
1
+ # Measure test coverage.
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+
5
+ require 'geocodio'
6
+ require 'webmock/rspec'
7
+ require 'vcr'
8
+
9
+ ENV['GEOCODIO_API_KEY'] ||= 'secret_api_key'
10
+
11
+ VCR.configure do |c|
12
+ c.cassette_library_dir = 'spec/vcr_cassettes'
13
+ c.hook_into :webmock
14
+ c.filter_sensitive_data('secret_api_key') { ENV['GEOCODIO_API_KEY'] }
15
+ end
16
+
17
+ RSpec.configure do |config|
18
+ # Run specs in random order to surface order dependencies. If you find an
19
+ # order dependency and want to debug it, you can fix the order by providing
20
+ # the seed, which is printed after each run.
21
+ # --seed 1234
22
+ config.order = 'random'
23
+ end
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.geocod.io/v1/geocode?api_key=secret_api_key
6
+ body:
7
+ encoding: UTF-8
8
+ string: "[\"1 Infinite Loop Cupertino CA 95014\",\"54 West Colorado Boulevard
9
+ Pasadena CA 91105\",\"826 Howard Street San Francisco CA 94103\"]"
10
+ headers:
11
+ Accept:
12
+ - application/json
13
+ Accept-Encoding:
14
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
15
+ User-Agent:
16
+ - Ruby
17
+ Content-Type:
18
+ - application/json
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Date:
25
+ - Tue, 21 Jan 2014 20:08:06 GMT
26
+ Server:
27
+ - Apache
28
+ X-Powered-By:
29
+ - PHP/5.4.24
30
+ Cache-Control:
31
+ - no-cache
32
+ Access-Control-Allow-Origin:
33
+ - "*"
34
+ Transfer-Encoding:
35
+ - chunked
36
+ Content-Type:
37
+ - application/json
38
+ body:
39
+ encoding: UTF-8
40
+ string: "{\"results\":[{\"query\":\"1 Infinite Loop Cupertino CA 95014\",\"response\":{\"input\":{\"address_components\":{\"number\":\"1\",\"street\":\"Infinite\",\"suffix\":\"Loop\",\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\"},\"formatted_address\":\"1
41
+ Infinite Loop, Cupertino CA, 95014\"},\"results\":[{\"address_components\":{\"number\":\"1\",\"street\":\"Infinite\",\"suffix\":\"Loop\",\"city\":\"Monta
42
+ Vista\",\"state\":\"CA\",\"zip\":\"95014\"},\"formatted_address\":\"1 Infinite
43
+ Loop, Monta Vista CA, 95014\",\"location\":{\"lat\":37.331669,\"lng\":-122.03074},\"accuracy\":1}]}},{\"query\":\"54
44
+ West Colorado Boulevard Pasadena CA 91105\",\"response\":{\"input\":{\"address_components\":{\"number\":\"54\",\"predirectional\":\"W\",\"street\":\"Colorado\",\"suffix\":\"Blvd\",\"city\":\"Pasadena\",\"state\":\"CA\",\"zip\":\"91105\"},\"formatted_address\":\"54
45
+ W Colorado Blvd, Pasadena CA, 91105\"},\"results\":[{\"address_components\":{\"number\":\"54\",\"predirectional\":\"W\",\"street\":\"Colorado\",\"suffix\":\"Blvd\",\"city\":\"Pasadena\",\"state\":\"CA\",\"zip\":\"91105\"},\"formatted_address\":\"54
46
+ W Colorado Blvd, Pasadena CA, 91105\",\"location\":{\"lat\":34.145760590909,\"lng\":-118.15204363636},\"accuracy\":1},{\"address_components\":{\"number\":\"54\",\"predirectional\":\"W\",\"street\":\"Colorado\",\"suffix\":\"Blvd\",\"city\":\"Pasadena\",\"state\":\"CA\",\"zip\":\"91105\"},\"formatted_address\":\"54
47
+ W Colorado Blvd, Pasadena CA, 91105\",\"location\":{\"lat\":34.1457634625,\"lng\":-118.15170725},\"accuracy\":0.8}]}},{\"query\":\"826
48
+ Howard Street San Francisco CA 94103\",\"response\":{\"input\":{\"address_components\":{\"number\":\"826\",\"street\":\"Howard\",\"suffix\":\"St\",\"city\":\"San
49
+ Francisco\",\"state\":\"CA\",\"zip\":\"94103\"},\"formatted_address\":\"826
50
+ Howard St, San Francisco CA, 94103\"},\"results\":[{\"address_components\":{\"number\":\"826\",\"street\":\"Howard\",\"suffix\":\"St\",\"city\":\"San
51
+ Francisco\",\"state\":\"CA\",\"zip\":\"94103\"},\"formatted_address\":\"826
52
+ Howard St, San Francisco CA, 94103\",\"location\":{\"lat\":37.7815,\"lng\":-122.404933},\"accuracy\":1},{\"address_components\":{\"number\":\"826\",\"street\":\"Howard\",\"suffix\":\"St\",\"city\":\"San
53
+ Francisco\",\"state\":\"CA\",\"zip\":\"94103\"},\"formatted_address\":\"826
54
+ Howard St, San Francisco CA, 94103\",\"location\":{\"lat\":37.781552539474,\"lng\":-122.40486656579},\"accuracy\":0.8}]}}]}"
55
+ http_version:
56
+ recorded_at: Tue, 21 Jan 2014 20:08:08 GMT
57
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,43 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.geocod.io/v1/geocode?api_key=secret_api_key&q=1%20Infinite%20Loop%20Cupertino%20CA%2095014
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 21 Jan 2014 19:55:27 GMT
23
+ Server:
24
+ - Apache
25
+ X-Powered-By:
26
+ - PHP/5.4.24
27
+ Cache-Control:
28
+ - no-cache
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ body:
36
+ encoding: UTF-8
37
+ string: "{\"input\":{\"address_components\":{\"number\":\"1\",\"street\":\"Infinite\",\"suffix\":\"Loop\",\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\"},\"formatted_address\":\"1
38
+ Infinite Loop, Cupertino CA, 95014\"},\"results\":[{\"address_components\":{\"number\":\"1\",\"street\":\"Infinite\",\"suffix\":\"Loop\",\"city\":\"Monta
39
+ Vista\",\"state\":\"CA\",\"zip\":\"95014\"},\"formatted_address\":\"1 Infinite
40
+ Loop, Monta Vista CA, 95014\",\"location\":{\"lat\":37.331669,\"lng\":-122.03074},\"accuracy\":1}]}"
41
+ http_version:
42
+ recorded_at: Tue, 21 Jan 2014 19:55:28 GMT
43
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.geocod.io/v1/geocode?api_key=secret_api_key&q=1%20Infinite%20Loop%20Cupertino%20CA%2095014
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 403
19
+ message: Forbidden
20
+ headers:
21
+ Date:
22
+ - Tue, 21 Jan 2014 20:47:20 GMT
23
+ Server:
24
+ - Apache
25
+ X-Powered-By:
26
+ - PHP/5.4.24
27
+ Cache-Control:
28
+ - no-cache
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ body:
36
+ encoding: UTF-8
37
+ string: "{\"error\":\"Invalid API key\"}"
38
+ http_version:
39
+ recorded_at: Tue, 21 Jan 2014 20:47:21 GMT
40
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.geocod.io/v1/parse?api_key=secret_api_key&q=1%20Infinite%20Loop%20Cupertino%20CA%2095014
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 21 Jan 2014 19:39:24 GMT
23
+ Server:
24
+ - Apache
25
+ X-Powered-By:
26
+ - PHP/5.4.24
27
+ Cache-Control:
28
+ - no-cache
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Content-Type:
34
+ - application/json
35
+ body:
36
+ encoding: UTF-8
37
+ string: "{\"address_components\":{\"number\":\"1\",\"street\":\"Infinite\",\"suffix\":\"Loop\",\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\"},\"formatted_address\":\"1
38
+ Infinite Loop, Cupertino CA, 95014\"}"
39
+ http_version:
40
+ recorded_at: Tue, 21 Jan 2014 19:39:25 GMT
41
+ recorded_with: VCR 2.8.0
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: geocodio
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Celis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: webmock
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Geocodio is a geocoding service that aims to fill a void in the community
84
+ by allowing developers to geocode large amounts of addresses without worrying about
85
+ daily limits and high costs.
86
+ email:
87
+ - me@davidcel.is
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - lib/geocodio.rb
93
+ - lib/geocodio/address.rb
94
+ - lib/geocodio/address_set.rb
95
+ - lib/geocodio/client.rb
96
+ - lib/geocodio/client/error.rb
97
+ - lib/geocodio/client/response.rb
98
+ - lib/geocodio/version.rb
99
+ - spec/address_set_spec.rb
100
+ - spec/address_spec.rb
101
+ - spec/client_spec.rb
102
+ - spec/spec_helper.rb
103
+ - spec/vcr_cassettes/batch_geocode.yml
104
+ - spec/vcr_cassettes/geocode.yml
105
+ - spec/vcr_cassettes/invalid_key.yml
106
+ - spec/vcr_cassettes/parse.yml
107
+ homepage: https://github.com/davidcelis/geocodio
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.2.0
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: An unofficial Ruby client library for geocod.io
131
+ test_files:
132
+ - spec/address_set_spec.rb
133
+ - spec/address_spec.rb
134
+ - spec/client_spec.rb
135
+ - spec/spec_helper.rb
136
+ - spec/vcr_cassettes/batch_geocode.yml
137
+ - spec/vcr_cassettes/geocode.yml
138
+ - spec/vcr_cassettes/invalid_key.yml
139
+ - spec/vcr_cassettes/parse.yml