ouch 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/ouch/info.rb +10 -2
- data/lib/ouch/version.rb +1 -1
- data/test/ouch_test.rb +6 -2
- 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: 3eb184edcb1533b580449ffd0cee1c58f3751fdd
|
4
|
+
data.tar.gz: b076f9e5dfee150269e08ef61fd4c8c0f40a374e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c016de10a58900854a59330ab79a0bc801eb0e7d29f6240d834c18bac48f187a53a05dc2c40a78d58b1ffd6131a6cca4652b4d14328e6b6cb074d805431aa220
|
7
|
+
data.tar.gz: b6899fdd430dfb7a945a709ba338698864503308f600fbba634bad72f76d29d03cedd1dcaee1c8899f4011a5932cc5a00dfef91c626c1876943bb5894335f04c
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ hospital.name # => "Cedars-Sinai Medical Center"
|
|
31
31
|
hospital.address # => "8700 Beverly Boulevard Los Angeles, CA 90048-1865"
|
32
32
|
hospital.phone # => "310-423-5000"
|
33
33
|
hospital.number_of_beds # => 914
|
34
|
+
hospital.url # => "http://www.ushospitalfinder.com/hospital/Cedars-Sinai-Medical-Center-Los-Angeles-CA"
|
34
35
|
```
|
35
36
|
|
36
37
|
## Contributing
|
data/lib/ouch/info.rb
CHANGED
@@ -7,8 +7,8 @@ module Ouch
|
|
7
7
|
conn = Faraday.new("http://www.ushospitalfinder.com")
|
8
8
|
response = conn.get '/hospitals/search', { search_query: 'hospital', lat: lat, lng: lng }
|
9
9
|
page = Nokogiri::HTML.parse(response.body)
|
10
|
-
url = page.css('#list tr:first a')[0][:href]
|
11
|
-
response = conn.get(url)
|
10
|
+
@url = page.css('#list tr:first a')[0][:href]
|
11
|
+
response = conn.get(@url)
|
12
12
|
page = Nokogiri::HTML.parse(response.body)
|
13
13
|
details = page.css('#detail-center p:has(b)')
|
14
14
|
@data = details.inject({}) do |data, detail|
|
@@ -28,5 +28,13 @@ module Ouch
|
|
28
28
|
def phone
|
29
29
|
@data["Phone:"]
|
30
30
|
end
|
31
|
+
|
32
|
+
def number_of_beds
|
33
|
+
@data["Number of Beds:"].to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
def url
|
37
|
+
"http://www.ushospitalfinder.com#{@url}"
|
38
|
+
end
|
31
39
|
end
|
32
40
|
end
|
data/lib/ouch/version.rb
CHANGED
data/test/ouch_test.rb
CHANGED
@@ -18,7 +18,11 @@ class TestOuch < MiniTest::Unit::TestCase
|
|
18
18
|
@hospital.phone.must_equal "310-423-5000"
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
@hospital.
|
21
|
+
def test_number_of_beds
|
22
|
+
@hospital.number_of_beds.must_equal 914
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_url
|
26
|
+
@hospital.url.must_equal 'http://www.ushospitalfinder.com/hospital/Cedars-Sinai-Medical-Center-Los-Angeles-CA'
|
23
27
|
end
|
24
28
|
end
|