google_maps_geocoder 0.6.0 → 0.7.3

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
- SHA1:
3
- metadata.gz: 92a146ad04baf20283ba5a60779df8febfe4e73c
4
- data.tar.gz: 69643ee376cd858858a514a47e047214d3d01212
2
+ SHA256:
3
+ metadata.gz: 0ec2ea9a6913811873ce04ea917f4d3de3d5f6a2b3c0a4df87770001cc599b44
4
+ data.tar.gz: 91d1670a2cc3d051ea73b8228e71d23294a9b4f7a4cc9298650659e7ea871840
5
5
  SHA512:
6
- metadata.gz: 897ee589156b6be42b27c2d3dfce893686b6dbe34d7d0620cbcf6fe569ed157f5e68723190f534285866ce90f4465315fccb94e529abf9e3a3a869a1863a9549
7
- data.tar.gz: 86ca105f64c38e9acbe2b5e2e54317abaf9d69b6663f04868958a14e13ec71e9a7adde2432097f8c77ea36dc096b9be6e422906e9bbb93f121cbff72b8e78833
6
+ metadata.gz: 01eaf6fd04d74efc6508181f3b2bce70999dd2d685514595cda29e60b80bda81cbc25b24b455b78acda847fa7296dd919fb9da8002377a3a90a9b06fcf372889
7
+ data.tar.gz: e2387c5b2b6413ef69c14b96b82b999199b694c137c191e3ce3e997d3b45fd888b9bfa72244da5c0dc03e2419687fd9799497c9bc38e781891a5293facf4d703
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+
5
+ ---
6
+
7
+ # Description
8
+
9
+ Provide as much background as you need to get the implementer up to speed on the problem to be solved. This can also include screenshots and links to other issues or pull requests.
10
+
11
+ # Steps to Reproduce
12
+
13
+ Don't forget to point out the difference between what *should* happen and what *does* happen. Here's an example:
14
+
15
+ 1. Try geocoding "1600 Pennsylvania Ave":
16
+ ```ruby
17
+ white_house = GoogleMapsGeocoder.new('1600 Pennsylvania Ave')
18
+ ```
19
+ 2. The formatted address doesn't match the White House:
20
+ ```ruby
21
+ white_house.formatted_address
22
+ => "1600 Pennsylvania Ave, Charleston, WV 25302, USA"
23
+ ```
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ ---
5
+
6
+ # Goal
7
+ Explain this issue's purpose. Focus on the problem that needs to be solved and *not* a particular solution. For example: "Make it easier for users to reset their passwords."
8
+
9
+ # Description
10
+ 1. Provide as much background as you need to familiarize the implementer with the problem to be solved.
11
+ 2. Include:
12
+ * screenshots
13
+ * links to other issues or pull requests
14
+
15
+ # Success Criteria
16
+ How would a stakeholder test whether the feature was completed successfully?
data/.travis.yml CHANGED
@@ -1,6 +1,10 @@
1
- sudo: false
2
1
  rvm:
3
- - 2.2.5
2
+ - 2.2.10
3
+ - 2.3.8
4
+ - 2.4.10
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.7.1
4
8
  script:
5
9
  - bundle exec rake
6
10
  - bundle exec rubocop
data/README.md CHANGED
@@ -1,27 +1,33 @@
1
1
  # GoogleMapsGeocoder
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/ivanoblomov/google_maps_geocoder.png)](http://travis-ci.org/ivanoblomov/google_maps_geocoder)
3
+ [![Build Status](https://secure.travis-ci.org/ivanoblomov/google_maps_geocoder.svg)](https://travis-ci.org/ivanoblomov/google_maps_geocoder)
4
4
  [![Code Climate](https://codeclimate.com/github/ivanoblomov/google_maps_geocoder.png)](https://codeclimate.com/github/ivanoblomov/google_maps_geocoder)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/ivanoblomov/google_maps_geocoder/badge.svg?branch=master)](https://coveralls.io/github/ivanoblomov/google_maps_geocoder?branch=master)
6
- [![Inline docs](http://inch-ci.org/github/Ivanoblomov/google_maps_geocoder.svg?branch=master)](http://inch-ci.org/github/Ivanoblomov/google_maps_geocoder)
7
- [![Gem Version](https://badge.fury.io/rb/google_maps_geocoder.svg)](http://badge.fury.io/rb/google_maps_geocoder)
6
+ [![Inline docs](https://inch-ci.org/github/Ivanoblomov/google_maps_geocoder.svg?branch=master)](https://inch-ci.org/github/Ivanoblomov/google_maps_geocoder)
7
+ [![Gem Version](https://badge.fury.io/rb/google_maps_geocoder.svg)](https://rubygems.org/gems/google_maps_geocoder)
8
8
  [![security](https://hakiri.io/github/ivanoblomov/google_maps_geocoder/master.svg)](https://hakiri.io/github/ivanoblomov/google_maps_geocoder/master)
9
9
 
10
10
  A simple Plain Old Ruby Object wrapper for geocoding with Google Maps.
11
11
 
12
12
  ## Installation
13
13
 
14
- Add GoogleMapsGeocoder to your Gemfile and run `bundle`:
14
+ 1. Set your Google Maps API key, which Google now requires, as an environment variable:
15
15
 
16
- ```ruby
17
- gem 'google_maps_geocoder'
18
- ```
16
+ ```bash
17
+ export GOOGLE_MAPS_API_KEY=[your key]
18
+ ```
19
19
 
20
- Or try it out in `irb` with:
20
+ 2. Add `GoogleMapsGeocoder` to your Gemfile and run `bundle`:
21
21
 
22
- ```ruby
23
- require './lib/google_maps_geocoder/google_maps_geocoder'
24
- ```
22
+ ```ruby
23
+ gem 'google_maps_geocoder'
24
+ ```
25
+
26
+ Or try it out in `irb` with:
27
+
28
+ ```ruby
29
+ require './lib/google_maps_geocoder/google_maps_geocoder'
30
+ ```
25
31
 
26
32
  ## Ready to Go in One Step
27
33
 
@@ -77,16 +83,19 @@ The complete, hopefully self-explanatory, API is:
77
83
  * `GoogleMapsGeocoder#state_long_name`
78
84
  * `GoogleMapsGeocoder#state_short_name`
79
85
 
80
- ## Google Maps API Key (Optional)
86
+ For compatibility with [Geocoder](https://github.com/alexreisner/geocoder), the following aliases are also available:
81
87
 
82
- To have GoogleMapsGeocoder use your Google Maps API key, set it as an environment variable:
83
-
84
- ```bash
85
- export GOOGLE_MAPS_API_KEY=[your key]
86
- ```
88
+ * `GoogleMapsGeocoder#address`
89
+ * `GoogleMapsGeocoder#coordinates`
90
+ * `GoogleMapsGeocoder#country`
91
+ * `GoogleMapsGeocoder#country_code`
92
+ * `GoogleMapsGeocoder#latitude`
93
+ * `GoogleMapsGeocoder#longitude`
94
+ * `GoogleMapsGeocoder#state`
95
+ * `GoogleMapsGeocoder#state_code`
87
96
 
88
97
  ## [Contributing to GoogleMapsGeocoder](https://github.com/ivanoblomov/google_maps_geocoder/blob/master/.github/CONTRIBUTING.md)
89
98
 
90
99
  ## Copyright
91
100
 
92
- Copyright © 2011-2018 Roderick Monje. See [LICENSE.txt](https://github.com/ivanoblomov/google_maps_geocoder/blob/master/LICENSE.txt) for further details.
101
+ Copyright © 2011-2021 Roderick Monje. See [LICENSE.txt](https://github.com/ivanoblomov/google_maps_geocoder/blob/master/LICENSE.txt) for further details.
@@ -7,18 +7,18 @@ Gem::Specification.new do |s|
7
7
  s.description = 'Geocode a location without worrying about parsing Google '\
8
8
  "Maps' response. GoogleMapsGeocoder wraps it in a plain-old "\
9
9
  'Ruby object.'
10
- s.homepage = 'http://github.com/ivanoblomov/google_maps_geocoder'
10
+ s.homepage = 'https://github.com/ivanoblomov/google_maps_geocoder'
11
11
  s.authors = ['Roderick Monje']
12
12
  s.email = 'rod@foveacentral.com'
13
13
 
14
14
  s.add_development_dependency 'codeclimate-test-reporter', '~> 0'
15
15
  s.add_development_dependency 'coveralls', '~> 0'
16
- s.add_development_dependency 'rake', '~> 0'
16
+ s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
17
17
  s.add_development_dependency 'rspec', '~> 3'
18
- s.add_development_dependency 'rubocop', '~> 0'
18
+ s.add_development_dependency 'rubocop', '~> 0.49.0'
19
19
 
20
- s.add_runtime_dependency 'activesupport', '~> 4.2'
21
- s.add_runtime_dependency 'rack', '~> 1.6'
20
+ s.add_runtime_dependency 'activesupport', '~> 4.1', '>= 4.1.11'
21
+ s.add_runtime_dependency 'rack', '~> 2.1.4'
22
22
 
23
23
  s.files = `git ls-files`.split "\n"
24
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split "\n"
@@ -40,6 +40,21 @@ class GoogleMapsGeocoder
40
40
  # Self-explanatory
41
41
  attr_reader(*GOOGLE_ADDRESS_SEGMENTS)
42
42
 
43
+ # Returns the formatted address as a comma-delimited string.
44
+ alias address formatted_address
45
+ # Returns the address' country as a full string.
46
+ alias country country_long_name
47
+ # Returns the address' country as an abbreviated string.
48
+ alias country_code country_short_name
49
+ # Returns the address' latitude as a float.
50
+ alias latitude lat
51
+ # Returns the address' longitude as a float.
52
+ alias longitude lng
53
+ # Returns the address' state as a full string.
54
+ alias state state_long_name
55
+ # Returns the address' state as an abbreviated string.
56
+ alias state_code state_short_name
57
+
43
58
  # Geocodes the specified address and wraps the results in a GoogleMapsGeocoder
44
59
  # object.
45
60
  #
@@ -60,6 +75,11 @@ class GoogleMapsGeocoder
60
75
  end
61
76
  end
62
77
 
78
+ # Returns the address' coordinates as an array of floats.
79
+ def coordinates
80
+ [lat, lng]
81
+ end
82
+
63
83
  # Returns true if the address Google returns is an exact match.
64
84
  #
65
85
  # @return [boolean] whether the Google Maps result is an exact match
@@ -1,4 +1,4 @@
1
1
  # A simple PORO wrapper for geocoding with Google Maps.
2
2
  class GoogleMapsGeocoder
3
- VERSION = '0.6.0'.freeze unless defined?(GoogleMapsGeocoder::VERSION)
3
+ VERSION = '0.7.3'.freeze unless defined?(GoogleMapsGeocoder::VERSION)
4
4
  end
@@ -35,15 +35,25 @@ describe GoogleMapsGeocoder do
35
35
  it { expect(subject.country_long_name).to eq 'United States' }
36
36
  it do
37
37
  expect(subject.formatted_address)
38
- .to match(/1600 Pennsylvania Ave NW, Washington, DC 20500, USA/)
38
+ .to match(/1600 Pennsylvania Avenue NW, Washington, DC 20500, USA/)
39
39
  end
40
40
  end
41
41
  context 'coordinates' do
42
42
  it { expect(subject.lat).to be_within(0.005).of(38.8976633) }
43
43
  it { expect(subject.lng).to be_within(0.005).of(-77.0365739) }
44
44
  end
45
+ context 'Geocoder API' do
46
+ it { expect(subject.address).to eq subject.formatted_address }
47
+ it { expect(subject.coordinates).to eq [subject.lat, subject.lng] }
48
+ it { expect(subject.country).to eq subject.country_long_name }
49
+ it { expect(subject.country_code).to eq subject.country_short_name }
50
+ it { expect(subject.latitude).to eq subject.lat }
51
+ it { expect(subject.longitude).to eq subject.lng }
52
+ it { expect(subject.state).to eq subject.state_long_name }
53
+ it { expect(subject.state_code).to eq subject.state_short_name }
54
+ end
45
55
  end
46
- context 'with an invalid address' do
56
+ context 'when API key is invalid' do
47
57
  before do
48
58
  @key = ENV['GOOGLE_MAPS_API_KEY']
49
59
  ENV['GOOGLE_MAPS_API_KEY'] = 'invalid_key'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_maps_geocoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roderick Monje
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-18 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codeclimate-test-reporter
@@ -44,14 +44,20 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '12.3'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 12.3.3
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
- version: '0'
57
+ version: '12.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 12.3.3
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rspec
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -72,42 +78,48 @@ dependencies:
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0'
81
+ version: 0.49.0
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0'
88
+ version: 0.49.0
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: activesupport
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '4.2'
95
+ version: '4.1'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 4.1.11
90
99
  type: :runtime
91
100
  prerelease: false
92
101
  version_requirements: !ruby/object:Gem::Requirement
93
102
  requirements:
94
103
  - - "~>"
95
104
  - !ruby/object:Gem::Version
96
- version: '4.2'
105
+ version: '4.1'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 4.1.11
97
109
  - !ruby/object:Gem::Dependency
98
110
  name: rack
99
111
  requirement: !ruby/object:Gem::Requirement
100
112
  requirements:
101
113
  - - "~>"
102
114
  - !ruby/object:Gem::Version
103
- version: '1.6'
115
+ version: 2.1.4
104
116
  type: :runtime
105
117
  prerelease: false
106
118
  version_requirements: !ruby/object:Gem::Requirement
107
119
  requirements:
108
120
  - - "~>"
109
121
  - !ruby/object:Gem::Version
110
- version: '1.6'
122
+ version: 2.1.4
111
123
  description: Geocode a location without worrying about parsing Google Maps' response.
112
124
  GoogleMapsGeocoder wraps it in a plain-old Ruby object.
113
125
  email: rod@foveacentral.com
@@ -118,9 +130,10 @@ files:
118
130
  - ".document"
119
131
  - ".github/CONTRIBUTING.md"
120
132
  - ".github/ISSUE_TEMPLATE.md"
133
+ - ".github/ISSUE_TEMPLATE/bug-report.md"
134
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
121
135
  - ".github/PULL_REQUEST_TEMPLATE.md"
122
136
  - ".gitignore"
123
- - ".ruby-version"
124
137
  - ".travis.yml"
125
138
  - Gemfile
126
139
  - LICENSE.txt
@@ -131,11 +144,11 @@ files:
131
144
  - lib/google_maps_geocoder/version.rb
132
145
  - spec/lib/google_maps_geocoder_spec.rb
133
146
  - spec/spec_helper.rb
134
- homepage: http://github.com/ivanoblomov/google_maps_geocoder
147
+ homepage: https://github.com/ivanoblomov/google_maps_geocoder
135
148
  licenses:
136
149
  - MIT
137
150
  metadata: {}
138
- post_install_message:
151
+ post_install_message:
139
152
  rdoc_options: []
140
153
  require_paths:
141
154
  - lib
@@ -150,9 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
163
  - !ruby/object:Gem::Version
151
164
  version: '0'
152
165
  requirements: []
153
- rubyforge_project:
154
- rubygems_version: 2.4.5.1
155
- signing_key:
166
+ rubygems_version: 3.1.2
167
+ signing_key:
156
168
  specification_version: 4
157
169
  summary: A simple PORO wrapper for geocoding with Google Maps.
158
170
  test_files:
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.2.5