geo_locator 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: 0a7d11b260f776e20225709d37d0d9084ea1fe75
4
- data.tar.gz: f07c259078e44c84cb8e9c624ffd858ba8110bad
3
+ metadata.gz: 6964af6982d53c2e42020945baad868c8a5e2808
4
+ data.tar.gz: 6f6fce62138237298cb32ead652da2bb6a062d0a
5
5
  SHA512:
6
- metadata.gz: 93e61b7523ca92577c4410e60d73b3dabe830c8e981248e2f95b20d09f17b45c4bc25a347aa6ada2b4cddff9c89c31d0dfb7df17feacd876a90b269f34d23784
7
- data.tar.gz: 6edc764a8dadc54bad9968a80c31dc83b5bf328ac8f7696f8cfda8ca685cb3b6f4f4e5d4c50662a777a8baf7fd782dfe36e1bb4879657003d2b34ffa8610beb5
6
+ metadata.gz: f07ebd402b310593e5b51ee93cc05e2a0fa6019e2a03bbf1a40c88898828293948b0373fab0f0d9a97ec32767e2b13bff81a90a5e6eb42f160cb2d9d97529fc1
7
+ data.tar.gz: c5fdc7b0e3d3781163e896f7a318365e2da8be09981680abcd6d4bb8c0f08517b935167c66008775467d6f95bbdbf3ec287c10b009603ea9f93d7dd46c75cb03
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GeoLocator
2
2
 
3
- TODO: Write a gem description
3
+ A gem which packages a offline database to geocode zip codes and locations without the need for an external web service.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,13 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ```ruby
22
+ $ irb
23
+ 2.1.0 :001 > require "geo_locator"
24
+ => true
25
+ 2.1.0 :002 > GeoLocator.locate(zip_code: 12681)
26
+ => [{:lat=>52.5392572203694, :lon=>13.5398499484887}]
27
+ ```
22
28
 
23
29
  ## Contributing
24
30
 
data/lib/geo_locator.rb CHANGED
@@ -35,6 +35,7 @@ class GeoLocator
35
35
  end
36
36
 
37
37
  def self.locate(options = {})
38
+ self.new.locate(options)
38
39
  end
39
40
 
40
41
  def initialize(options = {})
@@ -1,3 +1,3 @@
1
1
  class GeoLocator
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -11,6 +11,10 @@ describe GeoLocator do
11
11
  it "is a class level proxy for the class method _locate without the need for instantiation" do
12
12
  expect(GeoLocator).to respond_to(:locate)
13
13
  end
14
+
15
+ it "returns a array of geo locations if a zip_code is given" do
16
+ expect(GeoLocator.locate(zip_code: 33100)).to eq([{:lat=>51.7240488542403, :lon=>8.82975311690181}])
17
+ end
14
18
  end
15
19
 
16
20
  describe ".new" do
@@ -24,6 +28,10 @@ describe GeoLocator do
24
28
  it "is an instance level proxy for the class method _locate" do
25
29
  expect(geo_locator).to respond_to(:locate)
26
30
  end
31
+
32
+ it "returns a array of geo locations if a zip_code is given" do
33
+ expect(GeoLocator.locate(zip_code: 33100)).to eq([{:lat=>51.7240488542403, :lon=>8.82975311690181}])
34
+ end
27
35
  end
28
36
  end
29
37
 
@@ -39,7 +47,6 @@ describe GeoLocator do
39
47
  end
40
48
 
41
49
  it "expects a sqlite3 database named geo_locator.sqlite3 in the gems root dir" do
42
- #true # expect(File.exist?(File.expand_path("../geo_locator.sqlite3", File.dirname(__FILE__)))).to eq(true)
43
50
  end
44
51
 
45
52
  it "needs to be called with a database connection" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_locator
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
  - Michael Sievers