eaternet 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eaternet/lives_1_0/business.rb +11 -0
- data/lib/eaternet/version.rb +1 -1
- data/test/eaternet/agencies/sf_test.rb +2 -2
- data/test/eaternet/lives_1_0/business_test.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ffa77ddf5e2d9f787bb516b1206a0b9c5cb2f7c
|
4
|
+
data.tar.gz: 26f5a359b99a7c0bdfc1fc2fdf2ecd44f4cfa303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad46d6fe42affe217a5d480ac13675332d824c8bd0dc70bf4416e636bf8f486a6aa040c3cd4e9fed1c8e552e3ad15b0ecae9f4a3633097658f3195034b76efc2
|
7
|
+
data.tar.gz: 10cd96cb296d09ba0b2d70f9646556e2d79cb5157a5de534006b029f24bd55cc194e38b305337977647822a514977274da5dea3de68a9a789f56b705bb137a67
|
@@ -57,9 +57,11 @@ module Eaternet
|
|
57
57
|
validates :business_id, :name, :address,
|
58
58
|
type: String,
|
59
59
|
presence: true
|
60
|
+
|
60
61
|
validates :city, :state, :postal_code, :phone_number,
|
61
62
|
type: String,
|
62
63
|
allow_nil: true
|
64
|
+
|
63
65
|
validates :latitude,
|
64
66
|
numericality:
|
65
67
|
{
|
@@ -67,6 +69,7 @@ module Eaternet
|
|
67
69
|
less_than_or_equal_to: 90
|
68
70
|
},
|
69
71
|
allow_nil: true
|
72
|
+
|
70
73
|
validates :longitude,
|
71
74
|
numericality:
|
72
75
|
{
|
@@ -75,6 +78,14 @@ module Eaternet
|
|
75
78
|
},
|
76
79
|
allow_nil: true
|
77
80
|
|
81
|
+
def latitude
|
82
|
+
Float(@latitude) unless @latitude.nil?
|
83
|
+
end
|
84
|
+
|
85
|
+
def longitude
|
86
|
+
Float(@longitude) unless @latitude.nil?
|
87
|
+
end
|
88
|
+
|
78
89
|
def ==(other)
|
79
90
|
business_id == other.business_id
|
80
91
|
end
|
data/lib/eaternet/version.rb
CHANGED
@@ -24,8 +24,8 @@ class SfTest < Minitest::Test
|
|
24
24
|
assert_equal 'San Francisco', b.city
|
25
25
|
assert_equal '94104', b.postal_code
|
26
26
|
assert_equal 'CA', b.state
|
27
|
-
assert_equal
|
28
|
-
assert_equal
|
27
|
+
assert_equal 37.791116, b.latitude
|
28
|
+
assert_equal -122.403816, b.longitude
|
29
29
|
assert_equal '', b.phone_number
|
30
30
|
end
|
31
31
|
end
|
@@ -41,6 +41,19 @@ class BusinessTest < Minitest::Test
|
|
41
41
|
refute_nil business
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_returns_float_lat_and_long
|
45
|
+
business = Eaternet::Lives_1_0::Business.new do |i|
|
46
|
+
i.business_id = '789123hjd'
|
47
|
+
i.name = 'Starbucks'
|
48
|
+
i.address = '123 Happy Lane'
|
49
|
+
i.latitude = PORTLAND_OR_US[:lat].to_s
|
50
|
+
i.longitude = PORTLAND_OR_US[:lon].to_s
|
51
|
+
end
|
52
|
+
|
53
|
+
assert_instance_of Float, business.latitude
|
54
|
+
assert_instance_of Float, business.longitude
|
55
|
+
end
|
56
|
+
|
44
57
|
def test_rejects_invalid_latitude
|
45
58
|
assert_raises(ArgumentError) {
|
46
59
|
Eaternet::Lives_1_0::Business.new do |i|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eaternet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robb Shecter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|