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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2c011d91fdbf6eea99d6f884f0cd222ad31fe87
4
- data.tar.gz: 13c03c63910acbb3d5b9ecc539fea067addb9975
3
+ metadata.gz: 3eb184edcb1533b580449ffd0cee1c58f3751fdd
4
+ data.tar.gz: b076f9e5dfee150269e08ef61fd4c8c0f40a374e
5
5
  SHA512:
6
- metadata.gz: 26eee2cde6faf81ed68692d2343bcca542fd80323b0efa37dc3c966a85341699ed8ef0cbfdfc432f8520240a77a6d0f508c27b7a3fdfe96fc7dd8987ffc21a1a
7
- data.tar.gz: 1173896df3153928a07460c59e7685af7f10dee33a7693065ae3099c7eba280830382497c4db3537687877ef79d97331aca6593bb8b1c3c6e01c4a9c05181fcb
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Ouch
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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 number_of_beds
22
- @hospital.phone.must_equal 914
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ouch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dickeyxxx