google_maps_geocoder 1.0.0 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/{google_maps_geocoder/google_maps_geocoder.rb → google_maps_geocoder.rb} +14 -14
- data.tar.gz.sig +0 -0
- metadata +21 -51
- metadata.gz.sig +0 -0
- data/.document +0 -3
- data/.github/CONTRIBUTING.md +0 -68
- data/.github/ISSUE_TEMPLATE/bug-report.md +0 -23
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- data/.github/ISSUE_TEMPLATE/task.md +0 -21
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -35
- data/.github/dependabot.yml +0 -15
- data/.github/workflows/test.yml +0 -40
- data/.gitignore +0 -6
- data/.simplecov +0 -15
- data/CODE_OF_CONDUCT.md +0 -10
- data/Gemfile +0 -14
- data/LICENSE.txt +0 -20
- data/README.md +0 -117
- data/Rakefile +0 -10
- data/SECURITY.md +0 -16
- data/certs/ivanoblomov.pem +0 -26
- data/google_maps_geocoder.gemspec +0 -23
- data/lib/google_maps_geocoder/version.rb +0 -7
- data/spec/lib/google_maps_geocoder_spec.rb +0 -75
- data/spec/spec_helper.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d45704cd9fecd59b00591bd561fa45f930bed4b9376839c322228b61f68921de
|
4
|
+
data.tar.gz: 8a99a157e60fe7a5ab5cd150b4cf43f74f8a17f4c2bbd4470cfa2bdf7003885f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
78
|
+
raise GeocodingError.new(@json, logger:) if !@json || @json.empty? || status != 'OK'
|
78
79
|
|
79
80
|
set_attributes_from_json
|
80
|
-
|
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 <
|
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,21 +121,22 @@ 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
|
-
|
129
|
+
logger.error "GeocodingError.new: #{message}"
|
130
130
|
end
|
131
|
-
super
|
131
|
+
super(@json)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
private
|
136
136
|
|
137
137
|
def google_maps_request(address)
|
138
|
-
"#{GOOGLE_MAPS_API}?address=#{Rack::Utils.escape address}"\
|
139
|
-
|
138
|
+
"#{GOOGLE_MAPS_API}?address=#{Rack::Utils.escape address}" \
|
139
|
+
"&key=#{ENV.fetch('GOOGLE_MAPS_API_KEY', nil)}"
|
140
140
|
end
|
141
141
|
|
142
142
|
def google_maps_response(address)
|
@@ -181,8 +181,8 @@ class GoogleMapsGeocoder
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def parse_formatted_street_address
|
184
|
-
"#{parse_address_component_type('street_number')} "\
|
185
|
-
|
184
|
+
"#{parse_address_component_type('street_number')} " \
|
185
|
+
"#{parse_address_component_type('route')}"
|
186
186
|
end
|
187
187
|
|
188
188
|
def parse_lat
|
@@ -207,7 +207,7 @@ class GoogleMapsGeocoder
|
|
207
207
|
|
208
208
|
def set_attributes_from_json
|
209
209
|
ALL_ADDRESS_SEGMENTS.each do |segment|
|
210
|
-
instance_variable_set :"@#{segment}", send("parse_#{segment}")
|
210
|
+
instance_variable_set :"@#{segment}", send(:"parse_#{segment}")
|
211
211
|
end
|
212
212
|
end
|
213
213
|
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.
|
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
|
-
|
12
|
+
MIIENjCCAp6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADBBMQwwCgYDVQQDDANyb2Qx
|
14
13
|
HDAaBgoJkiaJk/IsZAEZFgxmb3ZlYWNlbnRyYWwxEzARBgoJkiaJk/IsZAEZFgNj
|
15
|
-
|
14
|
+
b20wHhcNMjUwODEyMjEyNzIyWhcNMjYwODEyMjEyNzIyWjBBMQwwCgYDVQQDDANy
|
16
15
|
b2QxHDAaBgoJkiaJk/IsZAEZFgxmb3ZlYWNlbnRyYWwxEzARBgoJkiaJk/IsZAEZ
|
17
16
|
FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC6asLzbFQpchSv
|
18
17
|
u+05KuCzQW39QZq65t3c0kfUsIx+WREjBw2QlM6jVItYj4euRRszLwxhSMCtMsno
|
@@ -22,20 +21,19 @@ cert_chain:
|
|
22
21
|
t9lKjWhObPgfQ7Z5bEWSWvuPnGD1zj0/Y1MNJ99M4Bt1t5OkS3L1zjg1H3ulYRlB
|
23
22
|
VWFIwC8esooXXWqG5s2XCtVjugOo1seXv8PIOCPM1HBLfYjlWAwGy0oA0kAtAs+4
|
24
23
|
OlciDLHwCJO/ChIeLNaW3f6WiDmcwI8MeyxXxw64kX9QSKP0muM4+GtE9619hPFK
|
25
|
-
RMXUFKNUlrZ6gcpyX5weP2OKwd9Z7LkVsK/
|
24
|
+
RMXUFKNUlrZ6gcpyX5weP2OKwd9Z7LkVsK/lgyxyaDqGwuajBGkCAwEAAaM5MDcw
|
26
25
|
CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFO1rwHyxg39rlp0MN5Kj
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
zYKOF/ofPEZhX7sqLK5GzDW4x1QDHAgr1YIdttVxhHADOxF4EVSJCHH0RGw=
|
26
|
+
s1uxvHyiMA0GCSqGSIb3DQEBCwUAA4IBgQAncSXXs+3oREaM04pHmIJ6ohTl7hzP
|
27
|
+
9CHmH7POzzutxm594oO9/BAcy9kQ8GCdu1nlTJPeWrR1+Sk762fwAAM3W49rXzoE
|
28
|
+
lK0KV8XKDQra4+y1YY9UtK3aNE216ejGEG1Ivn3tB2PMjQE3/gCfb2pgWwQrthQo
|
29
|
+
F4o3z3nhqtveyV+dtRKuG6dEUOhyIfuzXv+yIKa56vRxyGoGCssKpALTyNLAB2ok
|
30
|
+
20juJ/1jQaX9087CZKJHGopBtdadrhzhw+2QKhyJ5WkHiaYcOO2gvd0L3wunnZGC
|
31
|
+
iDKvkru5eJRdXv/sonGCW98QpCcedCy3kYQvf8PPKJb6dGjL53ErkEkmVtnqYY5R
|
32
|
+
SCFpPYJLnALedvuQDkxX910hwB10R5Qs3HFW3e3JlO+PgW/bCTBnEI781NWiWwPH
|
33
|
+
HVXVbmzImfeebPzKiAU0SAZv0MBxcEFRTL76C3ED4KKiWQpgQ9a3hAd30VNH8zq7
|
34
|
+
2b3lmk0PtyDS4JiKdH7aEiM7Zy+2eWIvbfI=
|
37
35
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
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:
|
47
|
-
- - "<"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 3.1.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:
|
57
|
-
- - "<"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 3.1.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,33 +56,12 @@ executables: []
|
|
64
56
|
extensions: []
|
65
57
|
extra_rdoc_files: []
|
66
58
|
files:
|
67
|
-
-
|
68
|
-
- ".github/CONTRIBUTING.md"
|
69
|
-
- ".github/ISSUE_TEMPLATE/bug-report.md"
|
70
|
-
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
71
|
-
- ".github/ISSUE_TEMPLATE/task.md"
|
72
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
73
|
-
- ".github/dependabot.yml"
|
74
|
-
- ".github/workflows/test.yml"
|
75
|
-
- ".gitignore"
|
76
|
-
- ".simplecov"
|
77
|
-
- CODE_OF_CONDUCT.md
|
78
|
-
- Gemfile
|
79
|
-
- LICENSE.txt
|
80
|
-
- README.md
|
81
|
-
- Rakefile
|
82
|
-
- SECURITY.md
|
83
|
-
- certs/ivanoblomov.pem
|
84
|
-
- google_maps_geocoder.gemspec
|
85
|
-
- lib/google_maps_geocoder/google_maps_geocoder.rb
|
86
|
-
- lib/google_maps_geocoder/version.rb
|
87
|
-
- spec/lib/google_maps_geocoder_spec.rb
|
88
|
-
- spec/spec_helper.rb
|
59
|
+
- lib/google_maps_geocoder.rb
|
89
60
|
homepage: https://github.com/FoveaCentral/google_maps_geocoder
|
90
61
|
licenses:
|
91
62
|
- MIT
|
92
|
-
metadata:
|
93
|
-
|
63
|
+
metadata:
|
64
|
+
rubygems_mfa_required: 'true'
|
94
65
|
rdoc_options: []
|
95
66
|
require_paths:
|
96
67
|
- lib
|
@@ -98,15 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
69
|
requirements:
|
99
70
|
- - ">="
|
100
71
|
- !ruby/object:Gem::Version
|
101
|
-
version: '3.
|
72
|
+
version: '3.1'
|
102
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
74
|
requirements:
|
104
75
|
- - ">="
|
105
76
|
- !ruby/object:Gem::Version
|
106
77
|
version: '0'
|
107
78
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
79
|
+
rubygems_version: 3.7.1
|
110
80
|
specification_version: 4
|
111
81
|
summary: A simple PORO wrapper for geocoding with Google Maps.
|
112
82
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/.document
DELETED
data/.github/CONTRIBUTING.md
DELETED
@@ -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!
|
@@ -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>
|
data/.github/dependabot.yml
DELETED
@@ -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"
|
data/.github/workflows/test.yml
DELETED
@@ -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
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,14 +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', ['>= 12.3.3', '~> 13.0']
|
9
|
-
gem 'rspec', '~> 3'
|
10
|
-
gem 'rubocop', '< 1.63'
|
11
|
-
gem 'rubocop-rake', '~> 0'
|
12
|
-
gem 'rubocop-rspec', '~> 2'
|
13
|
-
gem 'simplecov', '~> 0.18'
|
14
|
-
gem 'simplecov-lcov', '~> 0.8'
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011-2022 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,117 +0,0 @@
|
|
1
|
-
# GoogleMapsGeocoder
|
2
|
-
|
3
|
-
[](https://github.com/FoveaCentral/google_maps_geocoder/actions/workflows/test.yml)
|
4
|
-
[](https://codeclimate.com/github/FoveaCentral/google_maps_geocoder)
|
5
|
-
[](https://coveralls.io/github/FoveaCentral/google_maps_geocoder?branch=master)
|
6
|
-
[](https://bestpractices.coreinfrastructure.org/projects/92)
|
7
|
-
[](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
|
-
## Cheers!
|
112
|
-
|
113
|
-
<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>
|
114
|
-
|
115
|
-
## Copyright
|
116
|
-
|
117
|
-
Copyright © 2011-2024 Roderick Monje. See [LICENSE.txt](LICENSE.txt) for further details.
|
data/Rakefile
DELETED
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.0 | :white_check_mark: |
|
10
|
-
| < 1.0.0 | :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.
|
data/certs/ivanoblomov.pem
DELETED
@@ -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,23 +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 =~ /gem\z/
|
17
|
-
|
18
|
-
s.add_runtime_dependency 'rack', '>= 2.1.4', '< 3.1.0'
|
19
|
-
|
20
|
-
s.files = `git ls-files`.split "\n"
|
21
|
-
s.require_paths = ['lib']
|
22
|
-
s.required_ruby_version = '>= 3.0'
|
23
|
-
end
|
@@ -1,75 +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 'with "White House"' do
|
10
|
-
subject(:geocoder) do
|
11
|
-
GoogleMapsGeocoder.new('White House')
|
12
|
-
rescue SocketError
|
13
|
-
pending 'waiting for a network connection'
|
14
|
-
rescue GoogleMapsGeocoder::GeocodingError => e
|
15
|
-
raise if e.json['status'] == 'REQUEST_DENIED'
|
16
|
-
|
17
|
-
pending 'waiting for query limit to pass'
|
18
|
-
end
|
19
|
-
|
20
|
-
it { should be_partial_match }
|
21
|
-
it { should_not be_exact_match }
|
22
|
-
|
23
|
-
context 'address' do
|
24
|
-
it do
|
25
|
-
expect(geocoder.formatted_street_address)
|
26
|
-
.to eq '1600 Pennsylvania Avenue Northwest'
|
27
|
-
end
|
28
|
-
it { expect(geocoder.city).to eq 'Washington' }
|
29
|
-
it { expect(geocoder.state_long_name).to eq 'District of Columbia' }
|
30
|
-
it { expect(geocoder.state_short_name).to eq 'DC' }
|
31
|
-
it { expect(geocoder.postal_code).to eq '20500' }
|
32
|
-
it { expect(geocoder.country_short_name).to eq 'US' }
|
33
|
-
it { expect(geocoder.country_long_name).to eq 'United States' }
|
34
|
-
it do
|
35
|
-
expect(geocoder.formatted_address)
|
36
|
-
.to match(/1600 Pennsylvania Avenue NW, Washington, DC 20500, USA/)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'coordinates' do
|
41
|
-
it { expect(geocoder.lat).to be_within(0.005).of(38.8976633) }
|
42
|
-
it { expect(geocoder.lng).to be_within(0.005).of(-77.0365739) }
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'Geocoder API' do
|
46
|
-
it { expect(geocoder.address).to eq subject.formatted_address }
|
47
|
-
it { expect(geocoder.coordinates).to eq [subject.lat, subject.lng] }
|
48
|
-
it { expect(geocoder.country).to eq subject.country_long_name }
|
49
|
-
it { expect(geocoder.country_code).to eq subject.country_short_name }
|
50
|
-
it { expect(geocoder.latitude).to eq subject.lat }
|
51
|
-
it { expect(geocoder.longitude).to eq subject.lng }
|
52
|
-
it { expect(geocoder.state).to eq subject.state_long_name }
|
53
|
-
it { expect(geocoder.state_code).to eq subject.state_short_name }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'when API key is invalid' do
|
58
|
-
around do |example|
|
59
|
-
original_key = ENV['GOOGLE_MAPS_API_KEY']
|
60
|
-
ENV['GOOGLE_MAPS_API_KEY'] = 'invalid_key'
|
61
|
-
example.run
|
62
|
-
ENV['GOOGLE_MAPS_API_KEY'] = original_key
|
63
|
-
end
|
64
|
-
|
65
|
-
subject(:geocoder) do
|
66
|
-
GoogleMapsGeocoder.new('nowhere that comes to mind')
|
67
|
-
rescue SocketError
|
68
|
-
pending 'waiting for a network connection'
|
69
|
-
end
|
70
|
-
|
71
|
-
it { expect { geocoder }.to raise_error GoogleMapsGeocoder::GeocodingError }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
# 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(:example) do
|
20
|
-
quiet_logger = Logger.new(IO::NULL)
|
21
|
-
allow(Logger).to receive(:new).and_return(quiet_logger)
|
22
|
-
end
|
23
|
-
|
24
|
-
config.after(:example) do
|
25
|
-
allow(Logger).to receive(:new).and_call_original
|
26
|
-
end
|
27
|
-
end
|