gogo_maps 0.2.71820000 → 0.2.71826000

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db4c8634368f5b0e01be00a13572a0d4079a5638
4
- data.tar.gz: 459464e04f19070b0ed0cde7aec6b209b5da43e8
3
+ metadata.gz: d53ead4b755746521142ce9344272a713f80f6d8
4
+ data.tar.gz: 741b4c685bb81c0876711a91859aefc1f2429b1c
5
5
  SHA512:
6
- metadata.gz: 271b8ba101defcf6623efc0805216d9d0e8fada4852e462ac798039a9937bc9afb64166189ecf06a393eaf5162df871dccd17b5331ebc685ba006acfe62b82ae
7
- data.tar.gz: 8080f8c88f15558b0fcb6b4b3983df5f7a6569cb499a6a6b657c86a2985d38f629b13d55cd1d36106aaf26d6af10141f2e415438a2109c45047a17d10efed96c
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.get(address: '長野県上高井郡高山村')
20
+ GogoMaps.get_latlng('長野県上高井郡高山村')
21
21
  # => { lat: 36.6797676, lng: 138.3632554}
22
22
 
23
- GogoMaps.get(address: '神奈川県横浜市港北区日吉')
23
+ GogoMaps.get_latlng('神奈川県横浜市港北区日吉')
24
24
  # => { lat: 35.5565107, lng: 139.6460026 }
25
25
 
26
26
  # Lat and lng to Address.
27
- GogoMaps.get(latlng: '35.6506135,139.7539103')
27
+ GogoMaps.get_address('35.6506135,139.7539103')
28
28
  # => '日本, 東京都港区芝1丁目11−14'
29
29
 
30
- GogoMaps.get(latlng: '37.358126,-122.050636', language: :en)
30
+ GogoMaps.get_address('37.358126,-122.050636', language: :en)
31
31
  # => '902 Rockefeller Drive, Sunnyvale, CA 94087, USA'
32
32
  ```
33
33
 
@@ -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
- # @param Hash opts - to support below Ruby1.9x.
16
- def get_address(latlng, opts={})
14
+ def get_address(lat, lng, opts={})
17
15
  GoogleMapClient.call(
18
- { latlng: latlng, language: :ja, sensor: false }.merge(opts),
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 = ((-180..180).to_a.sample + rand).round(8)
25
- lng = ((-180..180).to_a.sample + rand).round(8)
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
@@ -1,4 +1,4 @@
1
1
  module GogoMaps
2
2
  # Napier's constant
3
- VERSION = "0.2.71820000"
3
+ VERSION = "0.2.71826000"
4
4
  end
@@ -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('35.6506135,139.7539103')
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.358126,-122.050636', language: :en)
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
  )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gogo_maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.71820000
4
+ version: 0.2.71826000
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka