shipping-forecast 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shipping_forecast.rb +19 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44ab3dff9fe31c2e2457decacab42dbbb9d807d1
4
- data.tar.gz: 60fc5367c05599971be2e3e52b437059b6a03436
3
+ metadata.gz: 7c2d8b852be63a17f17f6e60f9891f9df93ec832
4
+ data.tar.gz: 9dff1d3c07fcbc440b33580ee7c57d12d50368dc
5
5
  SHA512:
6
- metadata.gz: b8bfc1018065308325ffc58a277f93bb1488044f83664ca03399263c139b213ae26bd471154f407a380c22ff27ed6fee97b1b84d7bbe22cc1aa5707935b05c84
7
- data.tar.gz: 6de1341cb3c9d2d6fe2c892929717a572b01ca0ab26b4880d850a3a3cc0b55b84e1a071ff0ee5ea5ccc2d2c75772d6ff64f74483fa635219b221101962c52b78
6
+ metadata.gz: b0c92e47bddd83ea519016145714bfefae8c6167d98aee1745d34412e3606a85b5bebdbbb380b742e65effe11e319b4609c0d3df3d624b8ec31041bd255116be
7
+ data.tar.gz: 0b2821f1a89b0e43c162544625f4e4cb8503d19c9020519b6cfbe090ccd29910559229766975e83f149709dbd9de01678c4b2d0b55b7d570a1bc32a8121ea71a
@@ -4,7 +4,16 @@ require 'ostruct'
4
4
  class ShippingForecast
5
5
  URL = "http://www.bbc.co.uk/weather/coast_and_sea/shipping_forecast"
6
6
 
7
- # Public: Returns a hash of OpenStruct objects, each representint a location report
7
+ # Public: Returns a hash of OpenStruct objects, each representing a location report.
8
+ #
9
+ # Contents of each report:
10
+ # warning — If there is a warning in effect, returns an OpenStruct object with attributes:
11
+ # title – The title of the warning, e.g., "Gale Warning"
12
+ # issued – When the warning was issued
13
+ # summary – The text summary of the warning
14
+ # wind – The wind conditions
15
+ # seas – The current sea conditions
16
+ # visibility – The current visibility report
8
17
  def self.report
9
18
  @raw_report ||= new.raw_report
10
19
  end
@@ -49,20 +58,20 @@ class ShippingForecast
49
58
  # Warnings, if any
50
59
  warning = OpenStruct.new
51
60
  warning_detail = area.search(".warning-detail")
52
- warning[:title] = warning_detail.search("strong").text.gsub(':', '')
53
- warning[:issued] = warning_detail.search(".issued").text
54
- warning[:summary] = warning_detail.search(".summary").text
61
+ warning.title = warning_detail.search("strong").text.gsub(':', '')
62
+ warning.issued = warning_detail.search(".issued").text
63
+ warning.summary = warning_detail.search(".summary").text
55
64
 
56
65
  # Build the hash
57
66
  area_hash = OpenStruct.new
58
67
  breakdown = area.search("ul").children.search("span")
59
68
 
60
- area_hash[:warning] = warning
61
- area_hash[:location] = location
62
- area_hash[:wind] = breakdown[0].text
63
- area_hash[:seas] = breakdown[1].text
64
- area_hash[:weather] = breakdown[2].text
65
- area_hash[:visibility] = breakdown[3].text
69
+ area_hash.warning = warning
70
+ area_hash.location = location
71
+ area_hash.wind = breakdown[0].text
72
+ area_hash.seas = breakdown[1].text
73
+ area_hash.weather = breakdown[2].text
74
+ area_hash.visibility = breakdown[3].text
66
75
 
67
76
  locations[location] = area_hash
68
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipping-forecast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ted Nyman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-03 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize