gogo_maps 0.0.2 → 0.0.3
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 +1 -1
- data/lib/gogo_maps/version.rb +1 -1
- data/lib/gogo_maps.rb +18 -8
- data/spec/gogo_maps_spec.rb +9 -0
- 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: def747f175577c50c24ec743f8ec1f36ba81432a
|
4
|
+
data.tar.gz: b4eefda51bfe0ef6faae5c4bb0754ad482d956e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c83df3d052eec4e53f226a3a1952ae99f721eaae1795c1cfe3bd710f8dd345a0ac80a22f2b1207490c1f5011aa5ad8e8fe55b91d37692329da2f422cd04f787a
|
7
|
+
data.tar.gz: 8507b6a82df33761d1c848a1b3c03a0b3e749d69afe6a4af9597a2c203700ec44af42bed3771fe7398456ecbf87fb974ae7dd48652344c638e089b312b0a6728
|
data/README.md
CHANGED
data/lib/gogo_maps/version.rb
CHANGED
data/lib/gogo_maps.rb
CHANGED
@@ -3,14 +3,24 @@ require 'faraday'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module GogoMaps
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
class << self
|
7
|
+
# @param Hash opts - to support below Ruby1.9x.
|
8
|
+
def get(opts={})
|
9
|
+
fail 'Should provide either address or latlng' unless opts[:address] || opts[:latlng]
|
10
|
+
|
11
|
+
GoogleMapClient.call(
|
12
|
+
{ language: :ja, sensor: false }.merge(opts),
|
13
|
+
opts[:address] ? :to_latlng : :to_address
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def random
|
18
|
+
lat = ((-160..160).to_a.sample + rand).round(8)
|
19
|
+
lng = ((-160..160).to_a.sample + rand).round(8)
|
20
|
+
get(latlng:[lat, lng].join(','))
|
21
|
+
rescue
|
22
|
+
random #FIXIT:
|
23
|
+
end
|
14
24
|
end
|
15
25
|
|
16
26
|
class GoogleMapClient
|
data/spec/gogo_maps_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
describe GogoMaps do
|
4
5
|
it 'has a version number' do
|
@@ -45,5 +46,13 @@ describe GogoMaps do
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
49
|
+
context '#random' do
|
50
|
+
it 'should return proper parameters' do
|
51
|
+
expect(
|
52
|
+
GogoMaps.random
|
53
|
+
).not_to be_nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
end
|
49
58
|
end
|