jdpace-weatherman 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
1
  require 'ostruct'
2
+ require 'date'
3
+ require 'time'
2
4
 
3
5
  class WeatherManResponse
4
- attr_reader :current_conditions, :forecast, :api_url, :unit_temperature, :unit_distance, :unit_speed, :unit_pressure, :links
6
+ attr_reader :current_conditions, :forecast, :api_url, :unit_temperature, :unit_distance, :unit_speed, :unit_pressure, :links, :local_time
5
7
 
6
8
  def initialize(simple_xml, url = nil)
7
9
  @current_conditions = simple_xml['cc'] ? build_current_conditions(simple_xml['cc'][0]) : nil
@@ -16,6 +18,9 @@ class WeatherManResponse
16
18
  @unit_speed = simple_xml['head'][0]['us'][0]
17
19
  @unit_pressure = simple_xml['head'][0]['up'][0]
18
20
 
21
+ # Capture some location info
22
+ @local_time = Time.parse(simple_xml['loc'][0]['tm'][0])
23
+
19
24
  # The api url that was called to generate this response
20
25
  @api_url = url
21
26
  end
@@ -15,6 +15,10 @@ describe WeatherManResponse, 'built from a default response' do
15
15
  @weather.unit_pressure.should eql('in')
16
16
  end
17
17
 
18
+ it 'should grab the local time' do
19
+ @weather.local_time.should == Time.parse('7:17 PM')
20
+ end
21
+
18
22
  it 'should build a CurrentConditions object' do
19
23
  @weather.current_conditions.should be_kind_of(WeatherManCurrentConditions)
20
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jdpace-weatherman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Pace
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-29 00:00:00 -07:00
12
+ date: 2008-10-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency