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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77e5eba4e7e66a37b5ff65fc956c806e90c093bc
4
- data.tar.gz: bf25955da9d889e04161fd0f952e4bf51c26a244
3
+ metadata.gz: def747f175577c50c24ec743f8ec1f36ba81432a
4
+ data.tar.gz: b4eefda51bfe0ef6faae5c4bb0754ad482d956e4
5
5
  SHA512:
6
- metadata.gz: 6392d9778628fd901ac67ad600affe5b4ff6f48b28de84a4897a744c58fb490efb9602e1f8a70d45be214d8f5f43be17d253f92e30b8d9e04c42808d751be5d4
7
- data.tar.gz: d0e87ba852cca5c5cceae219b0c842410059dd3c50e10373caaf871dc000aced3ab679810a3399599e3ec3e77e431043a666272adcd4730cf7eb417313dce015
6
+ metadata.gz: c83df3d052eec4e53f226a3a1952ae99f721eaae1795c1cfe3bd710f8dd345a0ac80a22f2b1207490c1f5011aa5ad8e8fe55b91d37692329da2f422cd04f787a
7
+ data.tar.gz: 8507b6a82df33761d1c848a1b3c03a0b3e749d69afe6a4af9597a2c203700ec44af42bed3771fe7398456ecbf87fb974ae7dd48652344c638e089b312b0a6728
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GogoMaps
2
2
 
3
- Super simple geocode interface for Ruby.
3
+ Super simple geocode interface for Ruby, by using awesome GoogleMaps API
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,3 +1,3 @@
1
1
  module GogoMaps
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/gogo_maps.rb CHANGED
@@ -3,14 +3,24 @@ require 'faraday'
3
3
  require 'json'
4
4
 
5
5
  module GogoMaps
6
- # @param Hash opts - to support below Ruby1.9x.
7
- def self.get(opts={})
8
- fail 'Should provide either address or latlng' unless opts[:address] || opts[:latlng]
9
-
10
- GoogleMapClient.call(
11
- { language: :ja, sensor: false }.merge(opts),
12
- opts[:address] ? :to_latlng : :to_address
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
@@ -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
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.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka