google_maps_geocoder 1.1 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/google_maps_geocoder.rb +98 -16
- data.tar.gz.sig +0 -0
- metadata +24 -23
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04d445c8366e6292e9ec6648c7481d2dc7f3552591042d700d561fced7c14173
|
|
4
|
+
data.tar.gz: 14653cc8574c36ee32aacb19f5134396143966f2f57baa13bb60be48c01da5eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15e9e5ca1822fdb62de2a8092f9e7bf9929dd75531fa1de73579ffa2c9266c246f9ba04b9dbdc69c8f9cb959e473b029fd30c6de0120ef5a46c55e414cb0f9f2
|
|
7
|
+
data.tar.gz: 746640c71ad9e4dd518c5196d66b32236f31456e42ac010e037b477b730fa24c562f996b011b377a148c5382f4f50bb875d4b402dcebb02c86bed7e9f7b679a5
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/google_maps_geocoder.rb
CHANGED
|
@@ -14,7 +14,7 @@ require 'rack'
|
|
|
14
14
|
# chez_barack.formatted_address
|
|
15
15
|
# => "1600 Pennsylvania Avenue Northwest, President's Park,
|
|
16
16
|
# Washington, DC 20500, USA"
|
|
17
|
-
# rubocop:disable Metrics/ClassLength
|
|
17
|
+
# rubocop:disable-next Metrics/ClassLength
|
|
18
18
|
class GoogleMapsGeocoder
|
|
19
19
|
GOOGLE_ADDRESS_SEGMENTS = %i[
|
|
20
20
|
city country_long_name country_short_name county lat lng postal_code
|
|
@@ -28,7 +28,7 @@ class GoogleMapsGeocoder
|
|
|
28
28
|
).freeze
|
|
29
29
|
private_constant :ALL_ADDRESS_SEGMENTS
|
|
30
30
|
|
|
31
|
-
#
|
|
31
|
+
# The complete formatted address with standardized abbreviations.
|
|
32
32
|
#
|
|
33
33
|
# @return [String] the complete formatted address
|
|
34
34
|
# @example
|
|
@@ -37,36 +37,114 @@ class GoogleMapsGeocoder
|
|
|
37
37
|
# Washington, DC 20500, USA"
|
|
38
38
|
attr_reader :formatted_address
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
# The formatted street address with standardized abbreviations.
|
|
41
41
|
#
|
|
42
42
|
# @return [String] the formatted street address
|
|
43
43
|
# @example
|
|
44
44
|
# chez_barack.formatted_street_address
|
|
45
45
|
# => "1600 Pennsylvania Avenue Northwest"
|
|
46
46
|
attr_reader :formatted_street_address
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
# The address' city.
|
|
49
|
+
#
|
|
50
|
+
# @return [String] city
|
|
51
|
+
# @example
|
|
52
|
+
# chez_barack.city
|
|
53
|
+
# => "Washington"
|
|
54
|
+
# :attr_reader: city
|
|
55
|
+
|
|
56
|
+
# The address' country as a full string.
|
|
57
|
+
#
|
|
58
|
+
# @return [String] country
|
|
59
|
+
# @example
|
|
60
|
+
# chez_barack.country_long_name
|
|
61
|
+
# => "United States"
|
|
62
|
+
# :attr_reader: country_long_name
|
|
63
|
+
|
|
64
|
+
# The address' country as an abbreviated string.
|
|
65
|
+
#
|
|
66
|
+
# @return [String] country
|
|
67
|
+
# @example
|
|
68
|
+
# chez_barack.country_short_name
|
|
69
|
+
# => "US"
|
|
70
|
+
# :attr_reader: country_short_name
|
|
71
|
+
|
|
72
|
+
# The address' county.
|
|
73
|
+
#
|
|
74
|
+
# @return [String] county
|
|
75
|
+
# @example
|
|
76
|
+
# chez_barack.county
|
|
77
|
+
# => nil
|
|
78
|
+
# :attr_reader: county
|
|
79
|
+
|
|
80
|
+
# The address' latitude as a float.
|
|
81
|
+
#
|
|
82
|
+
# @return [Float] latitude
|
|
83
|
+
# @example
|
|
84
|
+
# chez_barack.lat
|
|
85
|
+
# => 38.8976763
|
|
86
|
+
# :attr_reader: lat
|
|
87
|
+
|
|
88
|
+
# The address' longitude as a float.
|
|
89
|
+
#
|
|
90
|
+
# @return [Float] longitude
|
|
91
|
+
# @example
|
|
92
|
+
# chez_barack.lng
|
|
93
|
+
# => -77.0365298
|
|
94
|
+
# :attr_reader: lng
|
|
95
|
+
|
|
96
|
+
# The address' postal code.
|
|
97
|
+
#
|
|
98
|
+
# @return [String] postal code
|
|
99
|
+
# @example
|
|
100
|
+
# chez_barack.postal_code
|
|
101
|
+
# => "20500"
|
|
102
|
+
# :attr_reader: postal_code
|
|
103
|
+
|
|
104
|
+
# The address' state as a full string.
|
|
105
|
+
#
|
|
106
|
+
# @return [String] state
|
|
107
|
+
# @example
|
|
108
|
+
# chez_barack.state_long_name
|
|
109
|
+
# => "District of Columbia"
|
|
110
|
+
# :attr_reader: state_long_name
|
|
111
|
+
|
|
112
|
+
# The address' state as an abbreviated string.
|
|
113
|
+
#
|
|
114
|
+
# @return [String] state
|
|
115
|
+
# @example
|
|
116
|
+
# chez_barack.state_short_name
|
|
117
|
+
# => "DC"
|
|
118
|
+
# :attr_reader: state_short_name
|
|
48
119
|
attr_reader(*GOOGLE_ADDRESS_SEGMENTS)
|
|
49
120
|
|
|
50
|
-
#
|
|
121
|
+
# The formatted address as a comma-delimited string.
|
|
122
|
+
# @return [String] the complete formatted address
|
|
51
123
|
alias address formatted_address
|
|
52
|
-
#
|
|
124
|
+
# The address' country as a full string.
|
|
125
|
+
# @return [String] country
|
|
53
126
|
alias country country_long_name
|
|
54
|
-
#
|
|
127
|
+
# The address' country as an abbreviated string.
|
|
128
|
+
# @return [String] country
|
|
55
129
|
alias country_code country_short_name
|
|
56
|
-
#
|
|
130
|
+
# The address' latitude as a float.
|
|
131
|
+
# @return [Float] latitude
|
|
57
132
|
alias latitude lat
|
|
58
|
-
#
|
|
133
|
+
# The address' longitude as a float.
|
|
134
|
+
# @return [Float] longitude
|
|
59
135
|
alias longitude lng
|
|
60
|
-
#
|
|
136
|
+
# The address' state as a full string.
|
|
137
|
+
# @return [String] state
|
|
61
138
|
alias state state_long_name
|
|
62
|
-
#
|
|
139
|
+
# The address' state as an abbreviated string.
|
|
140
|
+
# @return [String] state
|
|
63
141
|
alias state_code state_short_name
|
|
64
142
|
|
|
65
143
|
# Geocodes the specified address and wraps the results in a GoogleMapsGeocoder
|
|
66
144
|
# object.
|
|
67
145
|
#
|
|
68
|
-
# @param
|
|
69
|
-
# @param
|
|
146
|
+
# @param [String] address a geocodable address
|
|
147
|
+
# @param [Logger] logger a standard Logger, defaults to standard error
|
|
70
148
|
# @return [GoogleMapsGeocoder] the Google Maps result for the specified
|
|
71
149
|
# address
|
|
72
150
|
# @example
|
|
@@ -82,6 +160,11 @@ class GoogleMapsGeocoder
|
|
|
82
160
|
end
|
|
83
161
|
|
|
84
162
|
# Returns the address' coordinates as an array of floats.
|
|
163
|
+
#
|
|
164
|
+
# @return [Array] the latitude and longitude in an array
|
|
165
|
+
# @example
|
|
166
|
+
# chez_barack.coordinates
|
|
167
|
+
# => [38.8975862, -77.0366871]
|
|
85
168
|
def coordinates
|
|
86
169
|
[lat, lng]
|
|
87
170
|
end
|
|
@@ -120,8 +203,8 @@ class GoogleMapsGeocoder
|
|
|
120
203
|
|
|
121
204
|
# Initialize a GeocodingError wrapping the JSON returned by Google Maps.
|
|
122
205
|
#
|
|
123
|
-
# @param
|
|
124
|
-
# @param
|
|
206
|
+
# @param [Hash] json Google Maps' JSON response
|
|
207
|
+
# @param [Logger] logger a standard Logger
|
|
125
208
|
# @return [GeocodingError] the geocoding error
|
|
126
209
|
def initialize(json = {}, logger:)
|
|
127
210
|
@json = json
|
|
@@ -211,4 +294,3 @@ class GoogleMapsGeocoder
|
|
|
211
294
|
end
|
|
212
295
|
end
|
|
213
296
|
end
|
|
214
|
-
# rubocop:enable Metrics/ClassLength
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google_maps_geocoder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roderick Monje
|
|
@@ -9,29 +9,30 @@ bindir: bin
|
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
12
|
-
|
|
12
|
+
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQwwCgYDVQQDDANyb2Qx
|
|
13
13
|
HDAaBgoJkiaJk/IsZAEZFgxmb3ZlYWNlbnRyYWwxEzARBgoJkiaJk/IsZAEZFgNj
|
|
14
|
-
|
|
14
|
+
b20wHhcNMjYxMTE2MjIxOTEyWhcNMjcxMTE2MjIxOTEyWjBBMQwwCgYDVQQDDANy
|
|
15
15
|
b2QxHDAaBgoJkiaJk/IsZAEZFgxmb3ZlYWNlbnRyYWwxEzARBgoJkiaJk/IsZAEZ
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCrDjcO+XHCTDQr
|
|
17
|
+
jBZ25cr137Z1mDK4Jyltw5YOJRluRFBXW03+KPMYtkAoR5TRpr+d/01tRyo0I8Cr
|
|
18
|
+
oWxVsT1fc6iOP9pVKstOZgIOwxjuON3ttkq8VJIQiY1DmyjZMW4/a1mPALBYGxIY
|
|
19
|
+
m95b5qSdiTBIYn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Yvq1GVTB9KeBxRRCBQW3XlIZEjqgm
|
|
34
|
+
N1NpxIQ9A/eQwClfvkcHJePuxXdV+pmNVggV844hZnuqBrQcCbU2VY5SxVAjzcoF
|
|
35
|
+
+DTht1JkNly7/9lKTGN6nE0j2X4zih6FBXUQtMiiHoR7T3PTOqgd35tXtTU=
|
|
35
36
|
-----END CERTIFICATE-----
|
|
36
37
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
37
38
|
dependencies:
|
|
@@ -76,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
77
|
- !ruby/object:Gem::Version
|
|
77
78
|
version: '0'
|
|
78
79
|
requirements: []
|
|
79
|
-
rubygems_version:
|
|
80
|
+
rubygems_version: 4.0.6
|
|
80
81
|
specification_version: 4
|
|
81
82
|
summary: A simple PORO wrapper for geocoding with Google Maps.
|
|
82
83
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|