eaternet 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eaternet/agencies/nyc.rb +10 -4
- data/lib/eaternet/version.rb +1 -1
- data/test/eaternet/nyc_adapter_test.rb +26 -3
- 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: ff6175db527668d8bd514bb319d2e13208518be4
|
4
|
+
data.tar.gz: 1a6230beb016725a566d0ab090d599859dd13c4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31841f71e071ae88ff56be7eb528c488bfe7c4471274f4d54e5772be869b656007b88f83d9cdae955919e2448fc9961abdc52236375be8cf92624fc9b08ae101
|
7
|
+
data.tar.gz: 7bfd07a732ebfd9db5723328d64e342f49197bc3ca75fd55b518daba2c7be645d086cb1e52320db695d1bfa6f4ac5a7bb773fec14f9ac835d615045abcb3d864
|
@@ -94,7 +94,7 @@ module Eaternet
|
|
94
94
|
end
|
95
95
|
|
96
96
|
|
97
|
-
private
|
97
|
+
# private
|
98
98
|
|
99
99
|
def try_to_create_business(row)
|
100
100
|
business(row)
|
@@ -115,11 +115,13 @@ module Eaternet
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def business(row)
|
118
|
+
address = "#{cleanup(row['BUILDING'])} #{cleanup(row['STREET'])}"
|
119
|
+
|
118
120
|
Business.new do |b|
|
119
121
|
b.business_id = business_id(row)
|
120
|
-
b.name = row['DBA']
|
121
|
-
b.address =
|
122
|
-
b.city = row['BORO']
|
122
|
+
b.name = row['DBA'].titleize
|
123
|
+
b.address = address.titleize
|
124
|
+
b.city = row['BORO'].titleize
|
123
125
|
b.postal_code = row['ZIPCODE']
|
124
126
|
b.state = 'NY'
|
125
127
|
b.phone_number = row['PHONE']
|
@@ -205,6 +207,10 @@ module Eaternet
|
|
205
207
|
def self.download_via_url(a_file)
|
206
208
|
a_file.write(open(CSV_URL).read)
|
207
209
|
end
|
210
|
+
|
211
|
+
def cleanup(a_string)
|
212
|
+
a_string.strip.gsub(/ +/, ' ')
|
213
|
+
end
|
208
214
|
end
|
209
215
|
end
|
210
216
|
end
|
data/lib/eaternet/version.rb
CHANGED
@@ -9,6 +9,18 @@ MORRIS_PARK_CSV = 'test/fixtures/morris-park-bake-shop.csv'
|
|
9
9
|
class NycAdapterTest < Minitest::Test
|
10
10
|
@@nyc = Eaternet::Nyc.new(csv_path: MORRIS_PARK_CSV)
|
11
11
|
|
12
|
+
def setup
|
13
|
+
@may_may_data = {
|
14
|
+
'CAMIS' => '40358429',
|
15
|
+
'DBA' => 'MAY MAY KITCHEN',
|
16
|
+
'BUILDING' => '1269 ',
|
17
|
+
'STREET' => 'SUTTER AVENUE ',
|
18
|
+
'BORO' => 'BROOKLYN',
|
19
|
+
'ZIPCODE' => '11208',
|
20
|
+
'PHONE' => '7182354485'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
12
24
|
#
|
13
25
|
# Businesses
|
14
26
|
#
|
@@ -20,9 +32,9 @@ class NycAdapterTest < Minitest::Test
|
|
20
32
|
def test_businesses_returns_lives_attributes
|
21
33
|
b = @@nyc.businesses.first
|
22
34
|
assert_equal '30075445', b.business_id
|
23
|
-
assert_equal '
|
24
|
-
assert_equal '1007
|
25
|
-
assert_equal '
|
35
|
+
assert_equal 'Morris Park Bake Shop', b.name
|
36
|
+
assert_equal '1007 Morris Park Ave', b.address
|
37
|
+
assert_equal 'Bronx', b.city
|
26
38
|
assert_equal '10462', b.postal_code
|
27
39
|
assert_equal 'NY', b.state
|
28
40
|
assert_equal '7188924968', b.phone_number
|
@@ -32,6 +44,17 @@ class NycAdapterTest < Minitest::Test
|
|
32
44
|
assert_equal 1, @@nyc.businesses.to_a.size
|
33
45
|
end
|
34
46
|
|
47
|
+
def test_cleans_up_whitespace_1
|
48
|
+
b = @@nyc.business(@may_may_data)
|
49
|
+
assert_equal '1269 Sutter Avenue', b.address
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_cleans_up_whitespace_2
|
53
|
+
@may_may_data['STREET'] = 'EAST 52 STREET '
|
54
|
+
b = @@nyc.business(@may_may_data)
|
55
|
+
assert_equal '1269 East 52 Street', b.address
|
56
|
+
end
|
57
|
+
|
35
58
|
#
|
36
59
|
# Inspections
|
37
60
|
#
|