noaa-alerts 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,12 +17,16 @@ Or install it yourself as:
17
17
  $ gem install noaa-alerts
18
18
 
19
19
  ## Usage
20
+ Instantiate `Noaa::Client` with a two letter US state abbreviation. The result is an array of `Noaa::Alert` objects relevant attributes (`description`, `event`, `severity`, `locations`, etc).
20
21
 
21
22
  require 'noaa-alerts'
22
23
  noaa = Noaa::Client.new('ny')
24
+ alert = noaa.alerts[0]
23
25
 
24
- puts noaa.alerts[0].description # => 'THE NATIONAL WEATHER SERVICE IN UPTON NY HAS ISSUED A\n* SEVERE THUNDERSTORM WARNING FOR...'
25
- puts noaa.alerts[0].locations.join(', ') # => 'Rockland, Westchester'
26
+ puts alert.locations.join(', ') # => 'Rockland, Westchester'
27
+ puts alert.description # => 'THE NATIONAL WEATHER SERVICE IN UPTON NY HAS ISSUED A\n* SEVERE THUNDERSTORM WARNING FOR...'
28
+ puts alert.event # => 'Special Weather Statement'
29
+ ...
26
30
 
27
31
  ## Requirements
28
32
 
data/lib/alert.rb CHANGED
@@ -2,7 +2,7 @@ require "noaa-alerts/version"
2
2
 
3
3
  module Noaa
4
4
  class Alert
5
- attr_reader :description, :locations, :identifier, :effective_at, :expires_at, :event, :urgency, :severity, :headline
5
+ attr_reader :description, :locations, :identifier, :effective_at, :expires_at, :event, :urgency, :severity, :headline, :sent_at
6
6
 
7
7
  def initialize(entry)
8
8
  @description = ""
@@ -14,6 +14,7 @@ module Noaa
14
14
  @identifier = ""
15
15
  @effective_at = nil
16
16
  @expires_at = nil
17
+ @sent_at = nil
17
18
  handle_entry(entry)
18
19
  end
19
20
 
@@ -27,6 +28,7 @@ module Noaa
27
28
  @headline = entry['info']['headline']
28
29
  @locations = entry['info']['area']['areaDesc'].split('; ')
29
30
  @identifier = entry['identifier']
31
+ @sent_at = Time.parse(entry['sent'])
30
32
  @effective_at = Time.parse(entry['info']['effective'])
31
33
  @expires_at = Time.parse(entry['info']['expires'])
32
34
  end
@@ -1,3 +1,3 @@
1
1
  module Noaa
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -13,20 +13,20 @@ end
13
13
 
14
14
  describe Noaa, :vcr do
15
15
  describe ".initialize" do
16
- subject { Noaa::Client.new("ak") }
16
+ subject { Noaa::Client.new("ny") }
17
17
 
18
18
  its(:alerts) { should_not be_empty }
19
19
 
20
20
  describe Noaa::Alert do
21
- subject { Noaa::Client.new("ak").alerts.first }
21
+ subject { Noaa::Client.new("ny").alerts.first }
22
22
 
23
- its(:description) { should_not be_nil }
24
23
  its(:event) { should_not be_empty }
25
24
  its(:urgency) { should_not be_empty }
26
25
  its(:severity) { should_not be_empty }
27
26
  its(:headline) { should_not be_empty }
28
27
  its(:locations) { should_not be_empty }
29
28
  its(:identifier) { should_not be_empty }
29
+ its(:sent_at) { should be_an_instance_of Time }
30
30
  its(:effective_at) { should be_an_instance_of Time }
31
31
  its(:expires_at) { should be_an_instance_of Time }
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noaa-alerts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-22 00:00:00.000000000 Z
12
+ date: 2012-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &70303393653120 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.8.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70303393653120
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.2
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &70303393652600 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70303393652600
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &70303393651720 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 2.9.0
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70303393651720
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.9.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: webmock
49
- requirement: &70303393650780 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 1.8.7
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70303393650780
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.7
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: vcr
60
- requirement: &70303393650180 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,7 +85,12 @@ dependencies:
65
85
  version: 2.2.2
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70303393650180
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.2.2
69
94
  description: A Ruby library for consuming NOAA National Weather Service severe weather
70
95
  alerts.
71
96
  email:
@@ -106,9 +131,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
131
  version: '0'
107
132
  requirements: []
108
133
  rubyforge_project:
109
- rubygems_version: 1.8.16
134
+ rubygems_version: 1.8.24
110
135
  signing_key:
111
136
  specification_version: 3
112
137
  summary: Fetch and format feeds from the NOAA.
113
138
  test_files:
114
139
  - spec/noaa_alerts_spec.rb
140
+ has_rdoc: