gogo_maps 0.2.71820000 → 0.2.71826000
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
- data/README.md +4 -4
- data/lib/gogo_maps.rb +4 -7
- data/lib/gogo_maps/version.rb +1 -1
- data/spec/gogo_maps_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d53ead4b755746521142ce9344272a713f80f6d8
|
4
|
+
data.tar.gz: 741b4c685bb81c0876711a91859aefc1f2429b1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f994d1fe46726c45fc1144144cef0268ceddffdc7c2eec6d7ae7990c130f9ab5ab101d576506512d97c509875cd2e3cc9bbfa27d00af21ddb73f47e0059be1
|
7
|
+
data.tar.gz: c11c45c246464f860bb8e1fc260c28dd4db58305551d052a87b7629ee829304ae528fae6be29f93ffdc77f7a70f67f7ea9c71885b4f40424023baf919700433e
|
data/README.md
CHANGED
@@ -17,17 +17,17 @@ or
|
|
17
17
|
require 'gogo_maps'
|
18
18
|
|
19
19
|
# Address to lat and lng.
|
20
|
-
GogoMaps.
|
20
|
+
GogoMaps.get_latlng('長野県上高井郡高山村')
|
21
21
|
# => { lat: 36.6797676, lng: 138.3632554}
|
22
22
|
|
23
|
-
GogoMaps.
|
23
|
+
GogoMaps.get_latlng('神奈川県横浜市港北区日吉')
|
24
24
|
# => { lat: 35.5565107, lng: 139.6460026 }
|
25
25
|
|
26
26
|
# Lat and lng to Address.
|
27
|
-
GogoMaps.
|
27
|
+
GogoMaps.get_address('35.6506135,139.7539103')
|
28
28
|
# => '日本, 東京都港区芝1丁目11−14'
|
29
29
|
|
30
|
-
GogoMaps.
|
30
|
+
GogoMaps.get_address('37.358126,-122.050636', language: :en)
|
31
31
|
# => '902 Rockefeller Drive, Sunnyvale, CA 94087, USA'
|
32
32
|
```
|
33
33
|
|
data/lib/gogo_maps.rb
CHANGED
@@ -4,7 +4,6 @@ require 'json'
|
|
4
4
|
|
5
5
|
module GogoMaps
|
6
6
|
class << self
|
7
|
-
# @param Hash opts - to support below Ruby1.9x.
|
8
7
|
def get_latlng(address, opts={})
|
9
8
|
GoogleMapClient.call(
|
10
9
|
{ address: address, language: :ja, sensor: false }.merge(opts),
|
@@ -12,18 +11,16 @@ module GogoMaps
|
|
12
11
|
)
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
def get_address(latlng, opts={})
|
14
|
+
def get_address(lat, lng, opts={})
|
17
15
|
GoogleMapClient.call(
|
18
|
-
{ latlng:
|
16
|
+
{ latlng: "#{lat},#{lng}", language: :ja, sensor: false }.merge(opts),
|
19
17
|
:to_address
|
20
18
|
)
|
21
19
|
end
|
22
20
|
|
23
21
|
def random(opts={})
|
24
|
-
lat
|
25
|
-
|
26
|
-
get_address([lat, lng].join(','), opts)
|
22
|
+
lat,lng = (0..1).map{ ((-180..180).to_a.sample + rand).round(8) }
|
23
|
+
get_address(lat, lng, opts)
|
27
24
|
rescue
|
28
25
|
random #FIXIT:
|
29
26
|
end
|
data/lib/gogo_maps/version.rb
CHANGED
data/spec/gogo_maps_spec.rb
CHANGED
@@ -29,12 +29,12 @@ describe GogoMaps do
|
|
29
29
|
describe 'get_address' do
|
30
30
|
it 'should return proper parameters' do
|
31
31
|
expect(
|
32
|
-
GogoMaps.get_address(
|
32
|
+
GogoMaps.get_address(35.6506135, 139.7539103)
|
33
33
|
).to eq(
|
34
34
|
'日本, 東京都港区芝1丁目11−14'
|
35
35
|
)
|
36
36
|
expect(
|
37
|
-
GogoMaps.get_address(
|
37
|
+
GogoMaps.get_address(37.358126, -122.050636, language: :en)
|
38
38
|
).to eq(
|
39
39
|
'902 Rockefeller Drive, Sunnyvale, CA 94087, USA'
|
40
40
|
)
|