starbucks 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,12 +26,14 @@ To use:
26
26
  Starbucks.find_nearest(38.8903694152832, -77.0319595336914) { |bucks|
27
27
  puts bucks.name
28
28
  puts bucks.address
29
+ puts bucks.miles_away
29
30
  }
30
31
 
31
32
  # Alternative form
32
33
  bucks = Starbucks.find_nearest(38.8903694152832, -77.0319595336914)
33
34
  puts bucks.name
34
35
  puts bucks.address
36
+ puts bucks.miles_away
35
37
 
36
38
  # Get the nearest 30 and print out all their attributes (there's a bunch, which I won't list here)
37
39
  Starbucks.find(lat, lon).each { |bucks|
@@ -7,5 +7,11 @@ module Starbucks
7
7
  def name
8
8
  fetch("Name")
9
9
  end
10
+
11
+ def miles_away
12
+ meters = address.fetch("Distance")
13
+ # 1 mile = 1609.344 meters
14
+ meters.to_f / 1609.344
15
+ end
10
16
  end
11
17
  end
@@ -1,3 +1,3 @@
1
1
  module Starbucks
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: starbucks
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Muller
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- hash: 1699508342898785995
69
+ hash: 1797797517597016140
70
70
  segments:
71
71
  - 0
72
72
  version: "0"
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
76
  - - ">="
77
77
  - !ruby/object:Gem::Version
78
- hash: 1699508342898785995
78
+ hash: 1797797517597016140
79
79
  segments:
80
80
  - 0
81
81
  version: "0"