google_maps_geocoder 1.0.1 → 1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1b75a6d688d7ae2c78598419106c233c97b4e3d3670de878f91cdba8c12d920
4
- data.tar.gz: 3df70e06f88e78962ca11daf667c2e03057de045883534d8c80eb52cc4119edd
3
+ metadata.gz: d45704cd9fecd59b00591bd561fa45f930bed4b9376839c322228b61f68921de
4
+ data.tar.gz: 8a99a157e60fe7a5ab5cd150b4cf43f74f8a17f4c2bbd4470cfa2bdf7003885f
5
5
  SHA512:
6
- metadata.gz: 204f47f4a4b6ee052e21c2f8fb16664dfb0cd7ea69e65b52522842cd0514d68c452209ca17e0a639c7f1acdb2bf817346a700eee6a3667457cd7ab4c047379e9
7
- data.tar.gz: e2d04e07a9d445f9795a7226be2327b0a29921923ca1471b8cdfa74b1436aca4db9a68315198d3dd228c87c62148e1eeb4d5983197bc8bfbff135dd6be4abd19
6
+ metadata.gz: 0623df2d43e6a72c86f1e185940928ed99112b0c2cdac9f49200409e502f266af0519dd09fef20120cb34f231bdb95693a07424e4e261d57166aa2256bba6fbc
7
+ data.tar.gz: c2d6b26554daba5c31f48656b1393713d8df80a551974b13dd4837c9b92f3639080bd984e041f47f317f00cab97c7139b96815f4943320a759ffd532410a4a29
checksums.yaml.gz.sig CHANGED
Binary file
@@ -66,20 +66,19 @@ class GoogleMapsGeocoder
66
66
  # object.
67
67
  #
68
68
  # @param address [String] a geocodable address
69
+ # @param logger [Logger] a standard Logger, defaults to standard error
69
70
  # @return [GoogleMapsGeocoder] the Google Maps result for the specified
70
71
  # address
71
72
  # @example
72
73
  # chez_barack = GoogleMapsGeocoder.new '1600 Pennsylvania DC'
73
- def initialize(address)
74
+ def initialize(address, logger: Logger.new($stderr))
74
75
  @json = address.is_a?(String) ? google_maps_response(address) : address
75
76
  status = @json && @json['status']
76
77
  raise RuntimeError if status == 'OVER_QUERY_LIMIT'
77
- raise GeocodingError, @json if !@json || @json.empty? || status != 'OK'
78
+ raise GeocodingError.new(@json, logger:) if !@json || @json.empty? || status != 'OK'
78
79
 
79
80
  set_attributes_from_json
80
- Logger.new($stderr).info('GoogleMapsGeocoder') do
81
- "Geocoded \"#{address}\" => \"#{formatted_address}\""
82
- end
81
+ logger.info('GoogleMapsGeocoder') { "Geocoded \"#{address}\" => \"#{formatted_address}\"" }
83
82
  end
84
83
 
85
84
  # Returns the address' coordinates as an array of floats.
@@ -108,7 +107,7 @@ class GoogleMapsGeocoder
108
107
  end
109
108
 
110
109
  # A geocoding error returned by Google Maps.
111
- class GeocodingError < StandardError
110
+ class GeocodingError < RuntimeError
112
111
  # Returns the complete JSON response from Google Maps as a Hash.
113
112
  #
114
113
  # @return [Hash] Google Maps' JSON response
@@ -122,11 +121,12 @@ class GoogleMapsGeocoder
122
121
  # Initialize a GeocodingError wrapping the JSON returned by Google Maps.
123
122
  #
124
123
  # @param json [Hash] Google Maps' JSON response
124
+ # @param logger [Logger] a standard Logger
125
125
  # @return [GeocodingError] the geocoding error
126
- def initialize(json = {})
126
+ def initialize(json = {}, logger:)
127
127
  @json = json
128
128
  if (message = @json['error_message'])
129
- Logger.new($stderr).error(message)
129
+ logger.error "GeocodingError.new: #{message}"
130
130
  end
131
131
  super(@json)
132
132
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_maps_geocoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roderick Monje
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain:
11
10
  - |
12
11
  -----BEGIN CERTIFICATE-----
13
- MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQwwCgYDVQQDDANyb2Qx
12
+ MIIEN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Q9a3hAd30VNH8zq7
34
+ 2b3lmk0PtyDS4JiKdH7aEiM7Zy+2eWIvbfI=
37
35
  -----END CERTIFICATE-----
38
- date: 2024-10-31 00:00:00.000000000 Z
36
+ date: 1980-01-02 00:00:00.000000000 Z
39
37
  dependencies:
40
38
  - !ruby/object:Gem::Dependency
41
39
  name: rack
@@ -43,20 +41,14 @@ dependencies:
43
41
  requirements:
44
42
  - - ">="
45
43
  - !ruby/object:Gem::Version
46
- version: 2.1.4
47
- - - "<"
48
- - !ruby/object:Gem::Version
49
- version: 3.2.0
44
+ version: '0'
50
45
  type: :runtime
51
46
  prerelease: false
52
47
  version_requirements: !ruby/object:Gem::Requirement
53
48
  requirements:
54
49
  - - ">="
55
50
  - !ruby/object:Gem::Version
56
- version: 2.1.4
57
- - - "<"
58
- - !ruby/object:Gem::Version
59
- version: 3.2.0
51
+ version: '0'
60
52
  description: Geocode a location without worrying about parsing Google Maps' response.
61
53
  GoogleMapsGeocoder wraps it in a plain-old Ruby object.
62
54
  email: rod@foveacentral.com
@@ -64,36 +56,12 @@ executables: []
64
56
  extensions: []
65
57
  extra_rdoc_files: []
66
58
  files:
67
- - ".document"
68
- - ".github/CONTRIBUTING.md"
69
- - ".github/FUNDING.yml"
70
- - ".github/ISSUE_TEMPLATE/bug-report.md"
71
- - ".github/ISSUE_TEMPLATE/feature_request.md"
72
- - ".github/ISSUE_TEMPLATE/task.md"
73
- - ".github/PULL_REQUEST_TEMPLATE.md"
74
- - ".github/dependabot.yml"
75
- - ".github/workflows/test.yml"
76
- - ".gitignore"
77
- - ".rubocop.yml"
78
- - ".simplecov"
79
- - CODE_OF_CONDUCT.md
80
- - Gemfile
81
- - LICENSE.txt
82
- - README.md
83
- - Rakefile
84
- - SECURITY.md
85
- - certs/ivanoblomov.pem
86
- - google_maps_geocoder.gemspec
87
- - lib/google_maps_geocoder/google_maps_geocoder.rb
88
- - lib/google_maps_geocoder/version.rb
89
- - spec/lib/google_maps_geocoder_spec.rb
90
- - spec/spec_helper.rb
59
+ - lib/google_maps_geocoder.rb
91
60
  homepage: https://github.com/FoveaCentral/google_maps_geocoder
92
61
  licenses:
93
62
  - MIT
94
63
  metadata:
95
64
  rubygems_mfa_required: 'true'
96
- post_install_message:
97
65
  rdoc_options: []
98
66
  require_paths:
99
67
  - lib
@@ -101,15 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
69
  requirements:
102
70
  - - ">="
103
71
  - !ruby/object:Gem::Version
104
- version: '3.0'
72
+ version: '3.1'
105
73
  required_rubygems_version: !ruby/object:Gem::Requirement
106
74
  requirements:
107
75
  - - ">="
108
76
  - !ruby/object:Gem::Version
109
77
  version: '0'
110
78
  requirements: []
111
- rubygems_version: 3.5.6
112
- signing_key:
79
+ rubygems_version: 3.7.1
113
80
  specification_version: 4
114
81
  summary: A simple PORO wrapper for geocoding with Google Maps.
115
82
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/.document DELETED
@@ -1,3 +0,0 @@
1
- lib/**/*.rb
2
- LICENSE.txt
3
- README.md
@@ -1,68 +0,0 @@
1
- # How to contribute
2
-
3
- ## Background
4
-
5
- ### Branches and pull requests
6
-
7
- To make a contribution:
8
-
9
- 1. create a new branch for a given set of logical changes
10
-
11
- 2. open a pull request for the main branch
12
-
13
- 3. request a review
14
- 1. click Reviewers from the main tab of the PR
15
- 2. select one or more contributors
16
-
17
- 4. wait for feedback
18
-
19
- For more information, see GitHub's documentation on [creating branches](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository) and [pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests).
20
-
21
- ### How we handle proposals
22
-
23
- We use GitHub to track proposed changes via its [issue tracker](https://github.com/FoveaCentral/google_maps_geocoder/issues) and [pull requests](https://github.com/FoveaCentral/google_maps_geocoder/pulls). Specific changes are proposed using those mechanisms. Issues are assigned to an individual, who works it, and then marks it complete. If there are questions or objections, the conversation area of that issue or pull request is used to resolve it.
24
-
25
- ### Two-person review
26
-
27
- Our policy is that at least 50% of all proposed modifications will be reviewed before release by a person other than the author, to determine if it is a worthwhile modification and free of known issues which would argue against its inclusion.
28
-
29
- We achieve this by splitting proposals into two kinds:
30
-
31
- 1. Low-risk modifications. These modifications are being proposed by people authorized to commit directly, pass all tests, and are unlikely to have problems. These include documentation/text updates and/or updates to existing gems (especially minor updates) where no risks (such as a security risk) have been identified. The project lead can decide whenther any particular modification is low-risk.
32
-
33
- 2. Other modifications. These other modifications need to be reviewed by someone else or the project lead can decide to accept the modification. Typically this is done by creating a branch and a pull request so that it can be reviewed before accepting it.
34
-
35
- ### Developer Certificate of Origin (DCO)
36
-
37
- All contributions (including pull requests) must agree to the [Developer Certificate of Origin (DCO) version 1.1](https://developercertificate.org). This is a developer's certification that he or she has the right to submit the patch for inclusion into the project.
38
-
39
- Simply submitting a contribution implies this agreement, however, please include a `Signed-off-by` tag in the PR (this tag is a conventional way to confirm that you agree to the DCO).
40
-
41
- It's not practical to fix old contributions in git, so if one is forgotten, do not try to fix them. We presume that if someone sometimes used a DCO, a commit without a DCO is an accident and the DCO still applies.
42
-
43
- ## Types of contributions
44
-
45
- ### **New to open-source?**
46
-
47
- Try your hand at one of the small tasks ideal for new or casual contributors that are [up-for-grabs](https://github.com/FoveaCentral/google_maps_geocoder/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs). Welcome to the community!
48
-
49
- ### **Did you find a bug?**
50
-
51
- 1. **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/FoveaCentral/google_maps_geocoder/issues).
52
-
53
- 2. If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/FoveaCentral/google_maps_geocoder/issues/new/choose). Be sure to include:
54
- 1. a **title and clear description**
55
- 2. as much **relevant information** as possible
56
- 3. a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
57
-
58
- ### **Did you write a patch that fixes a bug or adds a new feature?**
59
-
60
- 1. **Add specs** that either *reproduce the bug* or *cover the new feature*. In the former's case, *make sure it fails without the fix!*
61
-
62
- 2. **Confirm your last build passes** on your GitHub branch or PR.
63
-
64
- 3. **Update the inline documentation.** Format it with [YARD](https://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md). For example, see [`GoogleMapsGeocoder.new`](../lib/google_maps_geocoder/google_maps_geocoder.rb).
65
-
66
- 4. [Open a pull request](https://github.com/FoveaCentral/google_maps_geocoder/compare) with the patch or feature. Follow the template's directions.
67
-
68
- ## Thanks for contributing!
data/.github/FUNDING.yml DELETED
@@ -1,14 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: ivanoblomov
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
- polar: # Replace with a single Polar username
13
- buy_me_a_coffee: oblomov
14
- custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,23 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- labels: 'bug'
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
- ```
@@ -1,17 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- labels: 'feature'
5
- ---
6
-
7
- # Goal
8
- 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."
9
-
10
- # Description
11
- 1. Provide as much background as you need to familiarize the implementer with the problem to be solved.
12
- 2. Include:
13
- * screenshots
14
- * links to other issues or pull requests
15
-
16
- # Success Criteria
17
- How would a stakeholder test whether the feature was completed successfully?
@@ -1,21 +0,0 @@
1
- ---
2
- name: Task
3
- about: Define a task to complete
4
- title: ''
5
- labels: 'task'
6
- assignees: ''
7
-
8
- ---
9
- # Task
10
-
11
- ## Goal
12
-
13
- Explain the goal of this task.
14
-
15
- ## Description
16
-
17
- Provide whatever background the assignee would need to complete the task. This can include screenshots or links to other issues or pull requests.
18
-
19
- ## Success Criteria
20
-
21
- How can stakeholders tell whether the task was completed successfully or not?
@@ -1,35 +0,0 @@
1
- # Closes: #
2
-
3
- ## Goal
4
- What problem does this pull request solve? This should be close to the goal of the issue this pull request addresses.
5
-
6
- ## Approach
7
- 1. **Describe, in numbered steps, the approach you chose** to solve the above problem.
8
- 1. This will help code reviewers get oriented quickly.
9
- 2. It will also document for future maintainers exactly what changed (and why) when this PR was merged.
10
- 2. **Add specs** that either *reproduce the bug* or *cover the new feature*. In the former's case, *make sure it fails without the fix!*
11
- 3. Document any new public methods using standard RDoc syntax, or update the existing RDoc for any modified public methods. As an example, see the RDoc for `GoogleMapsGeocoder.new`:
12
-
13
- ```ruby
14
- # Geocodes the specified address and wraps the results in a GoogleMapsGeocoder
15
- # object.
16
- #
17
- # @param address [String] a geocodable address
18
- # @return [GoogleMapsGeocoder] the Google Maps result for the specified
19
- # address
20
- # @example
21
- # chez_barack = GoogleMapsGeocoder.new '1600 Pennsylvania DC'
22
- def initialize(address)
23
- @json = address.is_a?(String) ? google_maps_response(address) : address
24
- status = @json && @json['status']
25
- raise RuntimeError if status == 'OVER_QUERY_LIMIT'
26
- raise GeocodingError, @json if @json.blank? || status != 'OK'
27
-
28
- set_attributes_from_json
29
- Logger.new($stderr).info('GoogleMapsGeocoder') do
30
- "Geocoded \"#{address}\" => \"#{formatted_address}\""
31
- end
32
- end
33
- ```
34
-
35
- Signed-off-by: YOUR NAME <YOUR.EMAIL@EXAMPLE.COM>
@@ -1,15 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "bundler" # See documentation for possible values
9
- directory: "/" # Location of package manifests
10
- schedule:
11
- interval: "daily"
12
- - package-ecosystem: "github-actions"
13
- directory: "/"
14
- schedule:
15
- interval: "weekly"
@@ -1,40 +0,0 @@
1
- # Download the latest Ruby patch versions, install dependencies, and run tests.
2
- name: test
3
- on:
4
- push:
5
- paths-ignore:
6
- - '**.md'
7
- - '**.txt'
8
- jobs:
9
- test:
10
- environment: staging
11
- runs-on: ubuntu-latest
12
- name: Ruby ${{ matrix.ruby-version }}
13
- strategy:
14
- matrix:
15
- ruby-version: ['3.0', 3.1, 3.2, 3.3]
16
- steps:
17
- - name: Checkout code
18
- uses: actions/checkout@v4
19
- - name: Set up Ruby ${{ matrix.ruby-version }}
20
- uses: ruby/setup-ruby@v1
21
- with:
22
- ruby-version: ${{ matrix.ruby-version }}
23
- bundler-cache: true # 'bundle install' and cache
24
- - name: Run tests
25
- env:
26
- GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
27
- run: bundle exec rake
28
- - name: Send Code Climate coverage
29
- uses: aktions/codeclimate-test-reporter@v1
30
- with:
31
- codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
32
- command: after-build --coverage-input-type lcov
33
- - name: Send Coveralls coverage
34
- uses: coverallsapp/github-action@master
35
- with:
36
- github-token: ${{ secrets.GITHUB_TOKEN }}
37
- - name: Run RuboCop
38
- run: bundle exec rubocop
39
- - name: Run Inch
40
- run: bundle exec inch --pedantic
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *.gem
2
- .DS_Store
3
- coverage
4
- doc
5
- Gemfile.lock
6
- tmp
data/.rubocop.yml DELETED
@@ -1,7 +0,0 @@
1
- require:
2
- - rubocop-performance
3
- - rubocop-rake
4
- - rubocop-rspec
5
-
6
- AllCops:
7
- NewCops: enable
data/.simplecov DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'simplecov-lcov'
4
-
5
- SimpleCov::Formatter::LcovFormatter.config do |c|
6
- c.report_with_single_file = true
7
- c.single_report_path = 'coverage/lcov.info'
8
- end
9
- SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
10
- [
11
- SimpleCov::Formatter::HTMLFormatter,
12
- SimpleCov::Formatter::LcovFormatter
13
- ]
14
- )
15
- SimpleCov.start
data/CODE_OF_CONDUCT.md DELETED
@@ -1,10 +0,0 @@
1
- # The Ruby Community Conduct Guideline
2
-
3
- We have picked the following conduct guideline based on an early proposed draft of the PostgreSQL CoC, for Ruby developers community for safe, productive collaboration. Each Ruby related community (conference etc.) may pick their own Code of Conduct.
4
-
5
- This document provides community guidelines for a safe, respectful, productive, and collaborative place for any person who is willing to contribute to the Ruby community. It applies to all “collaborative space”, which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.).
6
-
7
- * Participants will be tolerant of opposing views.
8
- * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
9
- * When interpreting the words and actions of others, participants should always assume good intentions.
10
- * Behaviour which can be reasonably considered harassment will not be tolerated.
data/Gemfile DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- gemspec
5
-
6
- gem 'inch', '~> 0.8'
7
- gem 'pry', '~> 0.14.1'
8
- gem 'rake', '~> 13'
9
- gem 'rspec', '~> 3'
10
- gem 'rubocop', '< 1.68'
11
- gem 'rubocop-performance', require: false
12
- gem 'rubocop-rake', require: false
13
- gem 'rubocop-rspec', require: false
14
- gem 'simplecov', '~> 0.18'
15
- gem 'simplecov-lcov', '~> 0.8'
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011-2024 Roderick Monje
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,113 +0,0 @@
1
- # GoogleMapsGeocoder
2
-
3
- [![Build status](https://github.com/FoveaCentral/google_maps_geocoder/workflows/test/badge.svg)](https://github.com/FoveaCentral/google_maps_geocoder/actions/workflows/test.yml)
4
- [![Code Climate](https://codeclimate.com/github/FoveaCentral/google_maps_geocoder.svg)](https://codeclimate.com/github/FoveaCentral/google_maps_geocoder)
5
- [![Coverage Status](https://coveralls.io/repos/github/FoveaCentral/google_maps_geocoder/badge.svg?branch=master)](https://coveralls.io/github/FoveaCentral/google_maps_geocoder?branch=master)
6
- [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/92/badge)](https://bestpractices.coreinfrastructure.org/projects/92)
7
- [![Gem Version](https://badge.fury.io/rb/google_maps_geocoder.svg)](https://rubygems.org/gems/google_maps_geocoder)
8
-
9
- A simple Plain Old Ruby Object wrapper for geocoding with Google Maps.
10
-
11
- ## Installation
12
-
13
- 1. Set your Google Maps API key, which Google now requires, as an environment variable:
14
-
15
- ```bash
16
- export GOOGLE_MAPS_API_KEY=[your key]
17
- ```
18
-
19
- 2. Add `GoogleMapsGeocoder` to your Gemfile and run `bundle`:
20
-
21
- ```ruby
22
- gem 'google_maps_geocoder'
23
- ```
24
-
25
- Or try it out in `irb` with:
26
-
27
- ```ruby
28
- require './lib/google_maps_geocoder/google_maps_geocoder'
29
- ```
30
-
31
- ### Security note
32
-
33
- `GoogleMapsGeocoder` is cryptographically signed. To insure the gem you install hasn’t been tampered with, add my public key as a trusted certificate and then install:
34
-
35
- ```sh
36
- gem cert --add <(curl -Ls https://raw.github.com/FoveaCentral/google_maps_geocoder/master/certs/ivanoblomov.pem)
37
- gem install google_maps_geocoder -P HighSecurity
38
- ```
39
-
40
- ## Ready to Go in One Step
41
-
42
- ```ruby
43
- chez_barack = GoogleMapsGeocoder.new '1600 Pennsylvania DC'
44
- ```
45
-
46
- ## Usage
47
-
48
- Get the complete, formatted address:
49
-
50
- ```ruby
51
- chez_barack.formatted_address
52
- => "1600 Pennsylvania Avenue Northwest, President's Park, Washington, DC 20500, USA"
53
- ```
54
-
55
- ...standardized name of the city:
56
-
57
- ```ruby
58
- chez_barack.city
59
- => "Washington"
60
- ```
61
-
62
- ...full name of the state or region:
63
-
64
- ```ruby
65
- chez_barack.state_long_name
66
- => "District of Columbia"
67
- ```
68
-
69
- ...standard abbreviation for the state/region:
70
-
71
- ```ruby
72
- chez_barack.state_short_name
73
- => "DC"
74
- ```
75
-
76
- ## API
77
-
78
- The complete, hopefully self-explanatory, API is:
79
-
80
- * `GoogleMapsGeocoder#city`
81
- * `GoogleMapsGeocoder#country_long_name`
82
- * `GoogleMapsGeocoder#country_short_name`
83
- * `GoogleMapsGeocoder#county`
84
- * `GoogleMapsGeocoder#exact_match?`
85
- * `GoogleMapsGeocoder#formatted_address`
86
- * `GoogleMapsGeocoder#formatted_street_address`
87
- * `GoogleMapsGeocoder#lat`
88
- * `GoogleMapsGeocoder#lng`
89
- * `GoogleMapsGeocoder#partial_match?`
90
- * `GoogleMapsGeocoder#postal_code`
91
- * `GoogleMapsGeocoder#state_long_name`
92
- * `GoogleMapsGeocoder#state_short_name`
93
-
94
- For compatibility with [Geocoder](https://github.com/alexreisner/geocoder), the following aliases are also available:
95
-
96
- * `GoogleMapsGeocoder#address`
97
- * `GoogleMapsGeocoder#coordinates`
98
- * `GoogleMapsGeocoder#country`
99
- * `GoogleMapsGeocoder#country_code`
100
- * `GoogleMapsGeocoder#latitude`
101
- * `GoogleMapsGeocoder#longitude`
102
- * `GoogleMapsGeocoder#state`
103
- * `GoogleMapsGeocoder#state_code`
104
-
105
- ## Documentation
106
-
107
- Complete RDoc documentation is available at [RubyDoc.info](https://www.rubydoc.info/gems/google_maps_geocoder).
108
-
109
- ## [Contributing to GoogleMapsGeocoder](.github/CONTRIBUTING.md)
110
-
111
- ## Copyright
112
-
113
- Copyright © 2011-2024 Roderick Monje. See [LICENSE.txt](LICENSE.txt) for further details.
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler'
4
- require 'bundler/gem_tasks'
5
- require 'rspec/core/rake_task'
6
- RSpec::Core::RakeTask.new(:test) do |t|
7
- t.pattern = 'spec/*/*_spec.rb'
8
- t.verbose = false
9
- end
10
- task default: :test
data/SECURITY.md DELETED
@@ -1,16 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates) automatically [patches known vulnerabilities](https://github.com/FoveaCentral/google_maps_geocoder/pulls?q=is%3Apr+is%3Aclosed+author%3Aapp%2Fdependabot).
6
-
7
- | Version | Supported |
8
- | ------- | ------------------ |
9
- | 1.0.1 | :white_check_mark: |
10
- | < 1.0.1 | :x: |
11
-
12
- ## Reporting a Vulnerability
13
-
14
- 1. To report a security vulnerability, [open an issue](https://github.com/FoveaCentral/google_maps_geocoder/issues/new/choose).
15
- 2. Updates are made within 48 hours.
16
- 3. If the vulnerability is accepted, we'll try to patch it within a week.
@@ -1,26 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQwwCgYDVQQDDANyb2Qx
3
- HDAaBgoJkiaJk/IsZAEZFgxmb3ZlYWNlbnRyYWwxEzARBgoJkiaJk/IsZAEZFgNj
4
- b20wHhcNMjQwMzI5MjIzNDUxWhcNMjUwMzI5MjIzNDUxWjBBMQwwCgYDVQQDDANy
5
- b2QxHDAaBgoJkiaJk/IsZAEZFgxmb3ZlYWNlbnRyYWwxEzARBgoJkiaJk/IsZAEZ
6
- FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC6asLzbFQpchSv
7
- u+05KuCzQW39QZq65t3c0kfUsIx+WREjBw2QlM6jVItYj4euRRszLwxhSMCtMsno
8
- Fhas9eZ47esUhxIElQngrsBP0kwLUHQj/EYCDVN2xnMlicoE0zgOXiUkk6PTZZme
9
- 8SYSFJANVDOdRgr5Q17nWQKPS1l3OqoD+fkM+kO/ey2KTXvv4AFxfwe9o/bk6LjF
10
- f4AzxKPmxsYbtgJHiu38gYb2IMh5JE5B0dUQ5pnQJbdTNtHI9YWoVpyIhIj/aOwN
11
- t9lKjWhObPgfQ7Z5bEWSWvuPnGD1zj0/Y1MNJ99M4Bt1t5OkS3L1zjg1H3ulYRlB
12
- VWFIwC8esooXXWqG5s2XCtVjugOo1seXv8PIOCPM1HBLfYjlWAwGy0oA0kAtAs+4
13
- OlciDLHwCJO/ChIeLNaW3f6WiDmcwI8MeyxXxw64kX9QSKP0muM4+GtE9619hPFK
14
- RMXUFKNUlrZ6gcpyX5weP2OKwd9Z7LkVsK/lgyxyaDqGwuajBGkCAwEAAaN7MHkw
15
- CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFO1rwHyxg39rlp0MN5Kj
16
- s1uxvHyiMB8GA1UdEQQYMBaBFHJvZEBmb3ZlYWNlbnRyYWwuY29tMB8GA1UdEgQY
17
- MBaBFHJvZEBmb3ZlYWNlbnRyYWwuY29tMA0GCSqGSIb3DQEBCwUAA4IBgQBg9aO1
18
- 1OhvQMbzefkcxE1QxuqwGzBh8kNiE2JL5FSGTtgFbXKqM1eeA0GWeZnksSVXOX40
19
- 01HDxW8CHdBnyNGorJPgbypZNI+gpi5bYKox0en7jj+88k9VA4fIbR+a/6sUSDsZ
20
- 82qpicz/Q+qkfnhQxHJ1Cj0lrZBq0Kuc+ooNxE4U3VT25CQCvUN9dlgyMZsH15ND
21
- DpektzMLDzH4suOVGK09j7C3sTyVdwI5UkN8ix27Me0N4zPxjjYo0HFXIRNhEjVF
22
- DWm9LGr9npmhQtd3A3ZyASawp+UUZ5pdc57YaBRDrJdFZr9056MpeByj+Fsg5Jkh
23
- 4o08iHs5bMPDyXBcj5XsYDLwAwTANPjGWGRNvrnY3KGGWdRMgtni3NJyMRCZ5tIT
24
- UNicoJ8NJMgduyTPvZBJtvUPddQr1yAL66/l+CFewbGb/1DbqfSvA2atfUobhDrG
25
- zYKOF/ofPEZhX7sqLK5GzDW4x1QDHAgr1YIdttVxhHADOxF4EVSJCHH0RGw=
26
- -----END CERTIFICATE-----
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('lib/google_maps_geocoder/version', __dir__)
4
- Gem::Specification.new do |s|
5
- s.name = 'google_maps_geocoder'
6
- s.version = GoogleMapsGeocoder::VERSION.dup
7
- s.licenses = ['MIT']
8
- s.summary = 'A simple PORO wrapper for geocoding with Google Maps.'
9
- s.description = 'Geocode a location without worrying about parsing Google ' \
10
- "Maps' response. GoogleMapsGeocoder wraps it in a plain-old " \
11
- 'Ruby object.'
12
- s.homepage = 'https://github.com/FoveaCentral/google_maps_geocoder'
13
- s.authors = ['Roderick Monje']
14
- s.cert_chain = ['certs/ivanoblomov.pem']
15
- s.email = 'rod@foveacentral.com'
16
- s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME.end_with?('gem')
17
-
18
- s.add_dependency 'rack', '>= 2.1.4', '< 3.2.0'
19
-
20
- s.files = `git ls-files`.split "\n"
21
- s.require_paths = ['lib']
22
- s.required_ruby_version = '>= 3.0'
23
- s.metadata['rubygems_mfa_required'] = 'true'
24
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # A simple PORO wrapper for geocoding with Google Maps.
4
- class GoogleMapsGeocoder
5
- # This gem's version.
6
- VERSION = '1.0.1' unless defined?(GoogleMapsGeocoder::VERSION)
7
- end
@@ -1,120 +0,0 @@
1
- # Copyright the GoogleMapsGeocoder contributors.
2
- # SPDX-License-Identifier: MIT
3
- # frozen_string_literal: true
4
-
5
- require "#{File.dirname(__FILE__)}/../spec_helper"
6
- # rubocop:disable Metrics/BlockLength
7
- RSpec.describe GoogleMapsGeocoder do
8
- describe '#new' do
9
- context 'when API key is valid' do
10
- # rubocop:disable RSpec/NestedGroups
11
- context 'with "White House"' do
12
- subject(:geocoder) do
13
- described_class.new('White House')
14
- rescue SocketError
15
- pending 'waiting for a network connection'
16
- rescue GoogleMapsGeocoder::GeocodingError => e
17
- raise if e.json['status'] == 'REQUEST_DENIED'
18
-
19
- pending 'waiting for query limit to pass'
20
- end
21
-
22
- it { is_expected.to be_partial_match }
23
- it { is_expected.not_to be_exact_match }
24
-
25
- describe '#formatted_street_address' do
26
- it { expect(geocoder.formatted_street_address).to eq '1600 Pennsylvania Avenue Northwest' }
27
- end
28
-
29
- describe '#city' do
30
- it { expect(geocoder.city).to eq 'Washington' }
31
- end
32
-
33
- describe '#state_long_name' do
34
- it { expect(geocoder.state_long_name).to eq 'District of Columbia' }
35
- end
36
-
37
- describe '#state_short_name' do
38
- it { expect(geocoder.state_short_name).to eq 'DC' }
39
- end
40
-
41
- describe '#postal_code' do
42
- it { expect(geocoder.postal_code).to eq '20500' }
43
- end
44
-
45
- describe '#country_short_name' do
46
- it { expect(geocoder.country_short_name).to eq 'US' }
47
- end
48
-
49
- describe '#country_long_name' do
50
- it { expect(geocoder.country_long_name).to eq 'United States' }
51
- end
52
-
53
- describe '#formatted_address' do
54
- it { expect(geocoder.formatted_address).to match(/1600 Pennsylvania Avenue NW, Washington, DC 20500, USA/) }
55
- end
56
-
57
- describe '#lat' do
58
- it { expect(geocoder.lat).to be_within(0.005).of(38.8976633) }
59
- end
60
-
61
- describe '#lng' do
62
- it { expect(geocoder.lng).to be_within(0.005).of(-77.0365739) }
63
- end
64
-
65
- context 'when using Geocoder API' do
66
- describe '#address' do
67
- it { expect(geocoder.address).to eq geocoder.formatted_address }
68
- end
69
-
70
- describe '#coordinates' do
71
- it { expect(geocoder.coordinates).to eq [geocoder.lat, geocoder.lng] }
72
- end
73
-
74
- describe '#country' do
75
- it { expect(geocoder.country).to eq geocoder.country_long_name }
76
- end
77
-
78
- describe '#country_code' do
79
- it { expect(geocoder.country_code).to eq geocoder.country_short_name }
80
- end
81
-
82
- describe '#latitude' do
83
- it { expect(geocoder.latitude).to eq geocoder.lat }
84
- end
85
-
86
- describe '#longitude' do
87
- it { expect(geocoder.longitude).to eq geocoder.lng }
88
- end
89
-
90
- describe '#state' do
91
- it { expect(geocoder.state).to eq geocoder.state_long_name }
92
- end
93
-
94
- describe '#state_code' do
95
- it { expect(geocoder.state_code).to eq geocoder.state_short_name }
96
- end
97
- end
98
- end
99
- # rubocop:enable RSpec/NestedGroups
100
- end
101
-
102
- context 'when API key is invalid' do
103
- subject(:geocoder) do
104
- described_class.new('nowhere that comes to mind')
105
- rescue SocketError
106
- pending 'waiting for a network connection'
107
- end
108
-
109
- around do |example|
110
- original_key = ENV.fetch('GOOGLE_MAPS_API_KEY', nil)
111
- ENV['GOOGLE_MAPS_API_KEY'] = 'invalid_key'
112
- example.run
113
- ENV['GOOGLE_MAPS_API_KEY'] = original_key
114
- end
115
-
116
- it { expect { geocoder }.to raise_error GoogleMapsGeocoder::GeocodingError }
117
- end
118
- end
119
- end
120
- # rubocop:enable Metrics/BlockLength
data/spec/spec_helper.rb DELETED
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'pry'
4
- require 'simplecov'
5
- require 'rubygems'
6
- require 'bundler'
7
- begin
8
- Bundler.setup(:default, :development)
9
- rescue Bundler::BundlerError => e
10
- warn e.message
11
- warn 'Run `bundle install` to install missing gems'
12
- exit e.status_code
13
- end
14
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
- $LOAD_PATH.unshift(File.dirname(__FILE__))
16
- require 'google_maps_geocoder/google_maps_geocoder'
17
- # silence output
18
- RSpec.configure do |config|
19
- config.before do
20
- quiet_logger = Logger.new(IO::NULL)
21
- allow(Logger).to receive(:new).and_return(quiet_logger)
22
- end
23
-
24
- config.after do
25
- allow(Logger).to receive(:new).and_call_original
26
- end
27
- end