google_maps_geocoder 0.7.1 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/CONTRIBUTING.md +14 -2
- data/.github/ISSUE_TEMPLATE/bug-report.md +1 -1
- data/.github/ISSUE_TEMPLATE/feature_request.md +1 -0
- data/.github/ISSUE_TEMPLATE/task.md +21 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +29 -3
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/publish.yml +24 -0
- data/.github/workflows/test.yml +33 -0
- data/.simplecov +15 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/Gemfile +2 -0
- data/README.md +14 -6
- data/Rakefile +2 -0
- data/SECURITY.md +16 -0
- data/certs/ivanoblomov.pem +25 -0
- data/google_maps_geocoder.gemspec +14 -6
- data/lib/google_maps_geocoder/google_maps_geocoder.rb +8 -4
- data/lib/google_maps_geocoder/version.rb +3 -1
- data/spec/lib/google_maps_geocoder_spec.rb +8 -2
- data/spec/spec_helper.rb +2 -6
- data.tar.gz.sig +0 -0
- metadata +117 -37
- metadata.gz.sig +0 -0
- data/.github/ISSUE_TEMPLATE.md +0 -17
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199a0d174e4d20c3ae3729e928ba4beef461e48aaa173c1e143a23125a2a2ecb
|
4
|
+
data.tar.gz: 2cec3def39626191c9e2bf7bbf4db038f76f1004b2ace817a92a338e4cb1f89f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d97c1f39d866b8fe92c81302bc91ace6ef06a35edda54836ec10a858784a37bb72a840182687f81437a307f29df2c04cbf072c263f12532fe4c20b23f694467
|
7
|
+
data.tar.gz: 7a8c93b2a0a2dde27abb7678b0a413b1360b2bf855b9cb97176d616e7528b132984f462f3d0d1ee60bf86f0132bd5f7666a81991aea36d28d45ec8a8ae942f61
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/.github/CONTRIBUTING.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# How to contribute
|
2
2
|
|
3
|
+
## **New to open-source?**
|
4
|
+
|
5
|
+
Try your hand at one of the small tasks ideal for new or casual contributors that are [up-for-grabs](https://github.com/ivanoblomov/google_maps_geocoder/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs). Welcome to the community!
|
6
|
+
|
3
7
|
## **Did you find a bug?**
|
4
8
|
|
5
9
|
1. **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/ivanoblomov/google_maps_geocoder/issues).
|
@@ -11,12 +15,20 @@
|
|
11
15
|
|
12
16
|
## **Did you write a patch that fixes a bug or adds a new feature?**
|
13
17
|
|
14
|
-
1. **Add specs** that either
|
18
|
+
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!*
|
15
19
|
|
16
|
-
2. **Confirm your last build passes** on
|
20
|
+
2. **Confirm your last build passes** on your GitHub branch or PR.
|
17
21
|
|
18
22
|
3. **Update the inline documentation.** Format it with [YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md). For example, see [`GoogleMapsGeocoder.new`](https://github.com/ivanoblomov/google_maps_geocoder/blob/github-templates/lib/google_maps_geocoder/google_maps_geocoder.rb#L43-L50).
|
19
23
|
|
20
24
|
4. [Open a pull request](https://github.com/ivanoblomov/google_maps_geocoder/compare) with the patch or feature. Follow the template's directions.
|
21
25
|
|
26
|
+
## Developer Certificate of Origin (DCO)
|
27
|
+
|
28
|
+
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.
|
29
|
+
|
30
|
+
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).
|
31
|
+
|
32
|
+
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.
|
33
|
+
|
22
34
|
## Thanks for contributing!
|
@@ -0,0 +1,21 @@
|
|
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?
|
@@ -4,6 +4,32 @@ Closes: #
|
|
4
4
|
What problem does this pull request solve? This should be close to the goal of the issue this pull request addresses.
|
5
5
|
|
6
6
|
# Approach
|
7
|
-
1. Describe the approach you chose to solve the above problem.
|
8
|
-
|
9
|
-
|
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>
|
@@ -0,0 +1,11 @@
|
|
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"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: publish
|
2
|
+
on:
|
3
|
+
workflow_dispatch:
|
4
|
+
jobs:
|
5
|
+
build:
|
6
|
+
name: Build + Publish
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby 2.7
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 2.7
|
14
|
+
- run: bundle install
|
15
|
+
- name: Publish to RubyGems
|
16
|
+
env:
|
17
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
18
|
+
run: |
|
19
|
+
mkdir -p $HOME/.gem
|
20
|
+
touch $HOME/.gem/credentials
|
21
|
+
chmod 0600 $HOME/.gem/credentials
|
22
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
23
|
+
gem build *.gemspec
|
24
|
+
gem push *.gem
|
@@ -0,0 +1,33 @@
|
|
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
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: [2.5, 2.6, 2.7, 3.0]
|
15
|
+
steps:
|
16
|
+
- name: Checkout code
|
17
|
+
uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
- name: Install dependencies
|
23
|
+
run: bundle install
|
24
|
+
- name: Run tests
|
25
|
+
env:
|
26
|
+
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
|
27
|
+
run: bundle exec rake
|
28
|
+
- name: Coveralls
|
29
|
+
uses: coverallsapp/github-action@master
|
30
|
+
with:
|
31
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
32
|
+
- name: Rubocop
|
33
|
+
run: bundle ex rubocop
|
data/.simplecov
ADDED
@@ -0,0 +1,15 @@
|
|
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
ADDED
@@ -0,0 +1,10 @@
|
|
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
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# GoogleMapsGeocoder
|
2
2
|
|
3
|
-
|
4
|
-
[![Code Climate](https://codeclimate.com/github/ivanoblomov/google_maps_geocoder.
|
3
|
+
![Build status](https://github.com/ivanoblomov/google_maps_geocoder/workflows/test/badge.svg)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/ivanoblomov/google_maps_geocoder.svg)](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](
|
7
|
-
[![
|
8
|
-
[![
|
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
|
+
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/92/badge)](https://bestpractices.coreinfrastructure.org/projects/92)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/google_maps_geocoder.svg)](https://rubygems.org/gems/google_maps_geocoder)
|
9
9
|
|
10
10
|
A simple Plain Old Ruby Object wrapper for geocoding with Google Maps.
|
11
11
|
|
@@ -94,8 +94,16 @@ For compatibility with [Geocoder](https://github.com/alexreisner/geocoder), the
|
|
94
94
|
* `GoogleMapsGeocoder#state`
|
95
95
|
* `GoogleMapsGeocoder#state_code`
|
96
96
|
|
97
|
+
## Documentation
|
98
|
+
|
99
|
+
Complete RDoc documentation is available at [RubyDoc.info](https://www.rubydoc.info/gems/google_maps_geocoder).
|
100
|
+
|
97
101
|
## [Contributing to GoogleMapsGeocoder](https://github.com/ivanoblomov/google_maps_geocoder/blob/master/.github/CONTRIBUTING.md)
|
98
102
|
|
103
|
+
## Cheers!
|
104
|
+
|
105
|
+
<a href="https://www.buymeacoffee.com/oblomov" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-green.png" alt="Buy Me A Coffee" height="41" width="174" ></a>
|
106
|
+
|
99
107
|
## Copyright
|
100
108
|
|
101
|
-
Copyright © 2011-
|
109
|
+
Copyright © 2011-2021 Roderick Monje. See [LICENSE.txt](https://github.com/ivanoblomov/google_maps_geocoder/blob/master/LICENSE.txt) for further details.
|
data/Rakefile
CHANGED
data/SECURITY.md
ADDED
@@ -0,0 +1,16 @@
|
|
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/ivanoblomov/google_maps_geocoder/pulls?q=is%3Apr+is%3Aclosed+author%3Aapp%2Fdependabot).
|
6
|
+
|
7
|
+
| Version | Supported |
|
8
|
+
| ------- | ------------------ |
|
9
|
+
| 0.7.5 | :white_check_mark: |
|
10
|
+
| < 0.7.5 | :x: |
|
11
|
+
|
12
|
+
## Reporting a Vulnerability
|
13
|
+
|
14
|
+
1. To report a security vulnerability, [open an issue](https://github.com/ivanoblomov/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.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIEQDCCAqigAwIBAgIBATANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpyb2Qv
|
3
|
+
REM9Zm92ZWFjZW50cmFsL0RDPWNvbTAeFw0yMTExMTUwMzEwMTRaFw0yMjExMTUw
|
4
|
+
MzEwMTRaMCUxIzAhBgNVBAMMGnJvZC9EQz1mb3ZlYWNlbnRyYWwvREM9Y29tMIIB
|
5
|
+
ojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAsMm8RdCTuhYTnbH5a8pesLYn
|
6
|
+
BD7cLPkeNfPWp8ohGVXL3988lRBYHwI/LRhxKXncmwmjYFWjuyR1m3e+EgmpBO3e
|
7
|
+
gCn4G9paWlwvPF+dSBF4pjhPtYBSXMFDfoeUTyHuNCcQOFJUMSAxo1pg9S9KvslC
|
8
|
+
Y1fpstOJtVnUjoeT8BRQAqV0WZuzFhgj74oSoHP/ETEd7Uzw/ST/kKgtNGcxoIYu
|
9
|
+
FEqAfEsqEpV0d6FbExYmVTR12288MaGGrfc6Y/QC1VC6RhEYG8Sn8a3utqkn7y47
|
10
|
+
0J6SROECo5x9TWU0s3HDco06jYb5sV1cGsDYXFpEczxJ9i1YVX2IDvYrpZsSJLzq
|
11
|
+
tfCdJ2jIj4rnMjGMg/kschfDnBKRIt8p7LlDhc0p/m0fYO4JQpWbvCc/F5vmUzpF
|
12
|
+
kRbiNr30dkYqDbfvcdQUWBOa5rSyZOIQiW6kfK9ZbLjBGFeP8pwSNME+yfJsZObS
|
13
|
+
AIiSqYtcP4mMriBLi+x981z1kpjTGZSWOpZrgAELAgMBAAGjezB5MAkGA1UdEwQC
|
14
|
+
MAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQzajljgeoJIjO/4h4X7ve/jYWVSDAf
|
15
|
+
BgNVHREEGDAWgRRyb2RAZm92ZWFjZW50cmFsLmNvbTAfBgNVHRIEGDAWgRRyb2RA
|
16
|
+
Zm92ZWFjZW50cmFsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAqqybBWM9gIPn8Quj
|
17
|
+
R8L0HPEE/1NjNLrlNG1DhJ8MAbYFA7mo4bWp4kjXwVdw+TMQZfrLjXLgmfiTvzxV
|
18
|
+
cE10liYjCWQNxectkkYmOsCBlEDfOngNKdl3QJ+Y5+SEsqfKYhZXZypn+SwuXx8F
|
19
|
+
LuVPsP7/R6VlrI8WbtPU1oSfM+rmdpUZzDcvmtvy1S+tPfFWalo8tSXPg0gE3Nis
|
20
|
+
UZAwHu8x3v5N7lxtjJa+s9ARkH/BO5Uytz1XrUmUWLQqo9ZJtqbZ/iV9HEWhG+xx
|
21
|
+
lR8SnXcsohvP/eIY2BTyBay0eOb9BwGHmnAVRiiAfLvCftzHtBEBr6jCKESSYDuc
|
22
|
+
bUIRDNLzRjl2KOoNLjKymicWrBdz1roBpy8cFIDzi6ebE45ve/xoZbsGJ3zaLo9T
|
23
|
+
G5iWAeYsmSjJxz7iOZOsx+vPCwMy7j6nWF2CDbaxioGR/hIqNbVBveCCRyjyunD3
|
24
|
+
kvv576EuULmQcLpOKwB3RlxAG7j8JJl4ueqjF+rz7x1lBqEU
|
25
|
+
-----END CERTIFICATE-----
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path('lib/google_maps_geocoder/version', __dir__)
|
2
4
|
Gem::Specification.new do |s|
|
3
5
|
s.name = 'google_maps_geocoder'
|
@@ -9,20 +11,26 @@ Gem::Specification.new do |s|
|
|
9
11
|
'Ruby object.'
|
10
12
|
s.homepage = 'https://github.com/ivanoblomov/google_maps_geocoder'
|
11
13
|
s.authors = ['Roderick Monje']
|
14
|
+
s.cert_chain = ['certs/ivanoblomov.pem']
|
12
15
|
s.email = 'rod@foveacentral.com'
|
16
|
+
s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
|
13
17
|
|
14
|
-
s.add_development_dependency 'codeclimate-test-reporter', '~>
|
15
|
-
s.add_development_dependency '
|
16
|
-
s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
18
|
+
s.add_development_dependency 'codeclimate-test-reporter', '~> 1'
|
19
|
+
s.add_development_dependency 'rake', '>= 12.3.3', '~> 13.0'
|
17
20
|
s.add_development_dependency 'rspec', '~> 3'
|
18
|
-
s.add_development_dependency 'rubocop', '
|
21
|
+
s.add_development_dependency 'rubocop', '< 1.23'
|
22
|
+
s.add_development_dependency 'rubocop-rake', '~> 0'
|
23
|
+
s.add_development_dependency 'rubocop-rspec', '~> 2'
|
24
|
+
s.add_development_dependency 'simplecov', '~> 0.18'
|
25
|
+
s.add_development_dependency 'simplecov-lcov', '~> 0.8'
|
19
26
|
|
20
|
-
s.add_runtime_dependency 'activesupport', '
|
21
|
-
s.add_runtime_dependency 'rack', '
|
27
|
+
s.add_runtime_dependency 'activesupport', '>= 4.1.11', '< 7.0'
|
28
|
+
s.add_runtime_dependency 'rack', '>= 2.1.4', '< 2.3.0'
|
22
29
|
|
23
30
|
s.files = `git ls-files`.split "\n"
|
24
31
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split "\n"
|
25
32
|
s.executables = `git ls-files -- bin/*`.split("\n")
|
26
33
|
.map { |f| File.basename f }
|
27
34
|
s.require_paths = ['lib']
|
35
|
+
s.required_ruby_version = '>= 2.5'
|
28
36
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# Copyright the GoogleMapsGeocoder contributors.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
1
5
|
require 'active_support'
|
2
6
|
require 'logger'
|
3
7
|
require 'net/http'
|
@@ -15,7 +19,7 @@ class GoogleMapsGeocoder
|
|
15
19
|
city country_long_name country_short_name county lat lng postal_code
|
16
20
|
state_long_name state_short_name
|
17
21
|
].freeze
|
18
|
-
GOOGLE_MAPS_API = 'https://maps.googleapis.com/maps/api/geocode/json'
|
22
|
+
GOOGLE_MAPS_API = 'https://maps.googleapis.com/maps/api/geocode/json'
|
19
23
|
|
20
24
|
ALL_ADDRESS_SEGMENTS = (
|
21
25
|
GOOGLE_ADDRESS_SEGMENTS + %i[formatted_address formatted_street_address]
|
@@ -70,7 +74,7 @@ class GoogleMapsGeocoder
|
|
70
74
|
raise GeocodingError, @json if @json.blank? || status != 'OK'
|
71
75
|
|
72
76
|
set_attributes_from_json
|
73
|
-
Logger.new(
|
77
|
+
Logger.new($stderr).info('GoogleMapsGeocoder') do
|
74
78
|
"Geocoded \"#{address}\" => \"#{formatted_address}\""
|
75
79
|
end
|
76
80
|
end
|
@@ -119,7 +123,7 @@ class GoogleMapsGeocoder
|
|
119
123
|
def initialize(json = {})
|
120
124
|
@json = json
|
121
125
|
if (message = @json['error_message'])
|
122
|
-
Logger.new(
|
126
|
+
Logger.new($stderr).error(message)
|
123
127
|
end
|
124
128
|
super @json['status']
|
125
129
|
end
|
@@ -147,7 +151,7 @@ class GoogleMapsGeocoder
|
|
147
151
|
|
148
152
|
def parse_address_component_type(type, name = 'long_name')
|
149
153
|
address_component = @json['results'][0]['address_components'].detect do |ac|
|
150
|
-
ac['types']
|
154
|
+
ac['types']&.include?(type)
|
151
155
|
end
|
152
156
|
address_component && address_component[name]
|
153
157
|
end
|
@@ -1,7 +1,12 @@
|
|
1
|
-
|
1
|
+
# Copyright the GoogleMapsGeocoder contributors.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require "#{File.dirname(__FILE__)}/../spec_helper"
|
2
6
|
# rubocop:disable Metrics/BlockLength
|
3
7
|
describe GoogleMapsGeocoder do
|
4
8
|
before(:all) do
|
9
|
+
# rubocop:disable Lint/RedundantCopDisableDirective, Style/RedundantBegin
|
5
10
|
begin
|
6
11
|
@exact_match = GoogleMapsGeocoder.new('White House')
|
7
12
|
rescue SocketError
|
@@ -9,6 +14,7 @@ describe GoogleMapsGeocoder do
|
|
9
14
|
rescue RuntimeError
|
10
15
|
@query_limit = true
|
11
16
|
end
|
17
|
+
# rubocop:enable Lint/RedundantCopDisableDirective, Style/RedundantBegin
|
12
18
|
end
|
13
19
|
|
14
20
|
before(:each) do
|
@@ -35,7 +41,7 @@ describe GoogleMapsGeocoder do
|
|
35
41
|
it { expect(subject.country_long_name).to eq 'United States' }
|
36
42
|
it do
|
37
43
|
expect(subject.formatted_address)
|
38
|
-
.to match(/1600 Pennsylvania
|
44
|
+
.to match(/1600 Pennsylvania Avenue NW, Washington, DC 20500, USA/)
|
39
45
|
end
|
40
46
|
end
|
41
47
|
context 'coordinates' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simplecov'
|
2
|
-
SimpleCov.start
|
3
|
-
require 'coveralls'
|
4
|
-
Coveralls.wear!
|
5
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
6
|
-
Coveralls::SimpleCov::Formatter
|
7
|
-
)
|
8
4
|
require 'rubygems'
|
9
5
|
require 'bundler'
|
10
6
|
begin
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_maps_geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roderick Monje
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEQDCCAqigAwIBAgIBATANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpyb2Qv
|
14
|
+
REM9Zm92ZWFjZW50cmFsL0RDPWNvbTAeFw0yMTExMTUwMzEwMTRaFw0yMjExMTUw
|
15
|
+
MzEwMTRaMCUxIzAhBgNVBAMMGnJvZC9EQz1mb3ZlYWNlbnRyYWwvREM9Y29tMIIB
|
16
|
+
ojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAsMm8RdCTuhYTnbH5a8pesLYn
|
17
|
+
BD7cLPkeNfPWp8ohGVXL3988lRBYHwI/LRhxKXncmwmjYFWjuyR1m3e+EgmpBO3e
|
18
|
+
gCn4G9paWlwvPF+dSBF4pjhPtYBSXMFDfoeUTyHuNCcQOFJUMSAxo1pg9S9KvslC
|
19
|
+
Y1fpstOJtVnUjoeT8BRQAqV0WZuzFhgj74oSoHP/ETEd7Uzw/ST/kKgtNGcxoIYu
|
20
|
+
FEqAfEsqEpV0d6FbExYmVTR12288MaGGrfc6Y/QC1VC6RhEYG8Sn8a3utqkn7y47
|
21
|
+
0J6SROECo5x9TWU0s3HDco06jYb5sV1cGsDYXFpEczxJ9i1YVX2IDvYrpZsSJLzq
|
22
|
+
tfCdJ2jIj4rnMjGMg/kschfDnBKRIt8p7LlDhc0p/m0fYO4JQpWbvCc/F5vmUzpF
|
23
|
+
kRbiNr30dkYqDbfvcdQUWBOa5rSyZOIQiW6kfK9ZbLjBGFeP8pwSNME+yfJsZObS
|
24
|
+
AIiSqYtcP4mMriBLi+x981z1kpjTGZSWOpZrgAELAgMBAAGjezB5MAkGA1UdEwQC
|
25
|
+
MAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQzajljgeoJIjO/4h4X7ve/jYWVSDAf
|
26
|
+
BgNVHREEGDAWgRRyb2RAZm92ZWFjZW50cmFsLmNvbTAfBgNVHRIEGDAWgRRyb2RA
|
27
|
+
Zm92ZWFjZW50cmFsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAqqybBWM9gIPn8Quj
|
28
|
+
R8L0HPEE/1NjNLrlNG1DhJ8MAbYFA7mo4bWp4kjXwVdw+TMQZfrLjXLgmfiTvzxV
|
29
|
+
cE10liYjCWQNxectkkYmOsCBlEDfOngNKdl3QJ+Y5+SEsqfKYhZXZypn+SwuXx8F
|
30
|
+
LuVPsP7/R6VlrI8WbtPU1oSfM+rmdpUZzDcvmtvy1S+tPfFWalo8tSXPg0gE3Nis
|
31
|
+
UZAwHu8x3v5N7lxtjJa+s9ARkH/BO5Uytz1XrUmUWLQqo9ZJtqbZ/iV9HEWhG+xx
|
32
|
+
lR8SnXcsohvP/eIY2BTyBay0eOb9BwGHmnAVRiiAfLvCftzHtBEBr6jCKESSYDuc
|
33
|
+
bUIRDNLzRjl2KOoNLjKymicWrBdz1roBpy8cFIDzi6ebE45ve/xoZbsGJ3zaLo9T
|
34
|
+
G5iWAeYsmSjJxz7iOZOsx+vPCwMy7j6nWF2CDbaxioGR/hIqNbVBveCCRyjyunD3
|
35
|
+
kvv576EuULmQcLpOKwB3RlxAG7j8JJl4ueqjF+rz7x1lBqEU
|
36
|
+
-----END CERTIFICATE-----
|
37
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
38
|
dependencies:
|
13
39
|
- !ruby/object:Gem::Dependency
|
14
40
|
name: codeclimate-test-reporter
|
@@ -16,110 +42,158 @@ dependencies:
|
|
16
42
|
requirements:
|
17
43
|
- - "~>"
|
18
44
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
45
|
+
version: '1'
|
20
46
|
type: :development
|
21
47
|
prerelease: false
|
22
48
|
version_requirements: !ruby/object:Gem::Requirement
|
23
49
|
requirements:
|
24
50
|
- - "~>"
|
25
51
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
52
|
+
version: '1'
|
27
53
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
54
|
+
name: rake
|
29
55
|
requirement: !ruby/object:Gem::Requirement
|
30
56
|
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 12.3.3
|
31
60
|
- - "~>"
|
32
61
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
62
|
+
version: '13.0'
|
34
63
|
type: :development
|
35
64
|
prerelease: false
|
36
65
|
version_requirements: !ruby/object:Gem::Requirement
|
37
66
|
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 12.3.3
|
38
70
|
- - "~>"
|
39
71
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
72
|
+
version: '13.0'
|
41
73
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
74
|
+
name: rspec
|
43
75
|
requirement: !ruby/object:Gem::Requirement
|
44
76
|
requirements:
|
45
77
|
- - "~>"
|
46
78
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
|
79
|
+
version: '3'
|
80
|
+
type: :development
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
49
85
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
86
|
+
version: '3'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: rubocop
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "<"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.23'
|
51
94
|
type: :development
|
52
95
|
prerelease: false
|
53
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "<"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '1.23'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: rubocop-rake
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
54
104
|
requirements:
|
55
105
|
- - "~>"
|
56
106
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
58
|
-
|
107
|
+
version: '0'
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
59
113
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
114
|
+
version: '0'
|
61
115
|
- !ruby/object:Gem::Dependency
|
62
|
-
name: rspec
|
116
|
+
name: rubocop-rspec
|
63
117
|
requirement: !ruby/object:Gem::Requirement
|
64
118
|
requirements:
|
65
119
|
- - "~>"
|
66
120
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
121
|
+
version: '2'
|
68
122
|
type: :development
|
69
123
|
prerelease: false
|
70
124
|
version_requirements: !ruby/object:Gem::Requirement
|
71
125
|
requirements:
|
72
126
|
- - "~>"
|
73
127
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
128
|
+
version: '2'
|
75
129
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
130
|
+
name: simplecov
|
77
131
|
requirement: !ruby/object:Gem::Requirement
|
78
132
|
requirements:
|
79
133
|
- - "~>"
|
80
134
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
135
|
+
version: '0.18'
|
82
136
|
type: :development
|
83
137
|
prerelease: false
|
84
138
|
version_requirements: !ruby/object:Gem::Requirement
|
85
139
|
requirements:
|
86
140
|
- - "~>"
|
87
141
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
142
|
+
version: '0.18'
|
89
143
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
144
|
+
name: simplecov-lcov
|
91
145
|
requirement: !ruby/object:Gem::Requirement
|
92
146
|
requirements:
|
93
147
|
- - "~>"
|
94
148
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
149
|
+
version: '0.8'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0.8'
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: activesupport
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
96
161
|
- - ">="
|
97
162
|
- !ruby/object:Gem::Version
|
98
163
|
version: 4.1.11
|
164
|
+
- - "<"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '7.0'
|
99
167
|
type: :runtime
|
100
168
|
prerelease: false
|
101
169
|
version_requirements: !ruby/object:Gem::Requirement
|
102
170
|
requirements:
|
103
|
-
- - "~>"
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '4.1'
|
106
171
|
- - ">="
|
107
172
|
- !ruby/object:Gem::Version
|
108
173
|
version: 4.1.11
|
174
|
+
- - "<"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '7.0'
|
109
177
|
- !ruby/object:Gem::Dependency
|
110
178
|
name: rack
|
111
179
|
requirement: !ruby/object:Gem::Requirement
|
112
180
|
requirements:
|
113
|
-
- - "
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: 2.1.4
|
184
|
+
- - "<"
|
114
185
|
- !ruby/object:Gem::Version
|
115
|
-
version: 2.
|
186
|
+
version: 2.3.0
|
116
187
|
type: :runtime
|
117
188
|
prerelease: false
|
118
189
|
version_requirements: !ruby/object:Gem::Requirement
|
119
190
|
requirements:
|
120
|
-
- - "
|
191
|
+
- - ">="
|
121
192
|
- !ruby/object:Gem::Version
|
122
|
-
version: 2.1.
|
193
|
+
version: 2.1.4
|
194
|
+
- - "<"
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: 2.3.0
|
123
197
|
description: Geocode a location without worrying about parsing Google Maps' response.
|
124
198
|
GoogleMapsGeocoder wraps it in a plain-old Ruby object.
|
125
199
|
email: rod@foveacentral.com
|
@@ -129,16 +203,22 @@ extra_rdoc_files: []
|
|
129
203
|
files:
|
130
204
|
- ".document"
|
131
205
|
- ".github/CONTRIBUTING.md"
|
132
|
-
- ".github/ISSUE_TEMPLATE.md"
|
133
206
|
- ".github/ISSUE_TEMPLATE/bug-report.md"
|
134
207
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
208
|
+
- ".github/ISSUE_TEMPLATE/task.md"
|
135
209
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
210
|
+
- ".github/dependabot.yml"
|
211
|
+
- ".github/workflows/publish.yml"
|
212
|
+
- ".github/workflows/test.yml"
|
136
213
|
- ".gitignore"
|
137
|
-
- ".
|
214
|
+
- ".simplecov"
|
215
|
+
- CODE_OF_CONDUCT.md
|
138
216
|
- Gemfile
|
139
217
|
- LICENSE.txt
|
140
218
|
- README.md
|
141
219
|
- Rakefile
|
220
|
+
- SECURITY.md
|
221
|
+
- certs/ivanoblomov.pem
|
142
222
|
- google_maps_geocoder.gemspec
|
143
223
|
- lib/google_maps_geocoder/google_maps_geocoder.rb
|
144
224
|
- lib/google_maps_geocoder/version.rb
|
@@ -148,7 +228,7 @@ homepage: https://github.com/ivanoblomov/google_maps_geocoder
|
|
148
228
|
licenses:
|
149
229
|
- MIT
|
150
230
|
metadata: {}
|
151
|
-
post_install_message:
|
231
|
+
post_install_message:
|
152
232
|
rdoc_options: []
|
153
233
|
require_paths:
|
154
234
|
- lib
|
@@ -156,15 +236,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
236
|
requirements:
|
157
237
|
- - ">="
|
158
238
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
239
|
+
version: '2.5'
|
160
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
241
|
requirements:
|
162
242
|
- - ">="
|
163
243
|
- !ruby/object:Gem::Version
|
164
244
|
version: '0'
|
165
245
|
requirements: []
|
166
|
-
rubygems_version: 3.1.
|
167
|
-
signing_key:
|
246
|
+
rubygems_version: 3.1.4
|
247
|
+
signing_key:
|
168
248
|
specification_version: 4
|
169
249
|
summary: A simple PORO wrapper for geocoding with Google Maps.
|
170
250
|
test_files:
|
metadata.gz.sig
ADDED
Binary file
|
data/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Description
|
2
|
-
|
3
|
-
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.
|
4
|
-
|
5
|
-
# Steps to Reproduce
|
6
|
-
|
7
|
-
Don't forget to point out the difference between what *should* happen and what *does* happen. Here's an example:
|
8
|
-
|
9
|
-
1. Try geocoding "1600 Pennsylvania Ave":
|
10
|
-
```ruby
|
11
|
-
white_house = GoogleMapsGeocoder.new('1600 Pennsylvania Ave')
|
12
|
-
```
|
13
|
-
2. The formatted address doesn't match the White House:
|
14
|
-
```ruby
|
15
|
-
white_house.formatted_address
|
16
|
-
=> "1600 Pennsylvania Ave, Charleston, WV 25302, USA"
|
17
|
-
```
|