barometer 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -212,6 +212,7 @@ Thank you to these developers who have contributed. No contribution is too small
212
212
  * plukevdh (https://github.com/plukevdh)
213
213
  * gkop (https://github.com/gkop)
214
214
  * avit (https://github.com/avit)
215
+ * jimjeffers (https://github.com/jimjeffers)
215
216
 
216
217
  ## Links
217
218
 
@@ -63,7 +63,7 @@ module Barometer
63
63
  def detect_format
64
64
  Format.match?(@q) do |key, klass|
65
65
  @format = key
66
- @geo = Data::Geo.new(country_code: klass.country_code(@q))
66
+ @geo = Data::Geo.new(klass.geo(@q))
67
67
  @format_klass = klass
68
68
  end
69
69
  end
@@ -10,7 +10,7 @@ module Barometer
10
10
  #
11
11
  class Base
12
12
  def self.regex; raise NotImplementedError; end
13
- def self.country_code(query); nil; end
13
+ def self.geo(query); nil; end
14
14
  def self.convert_query(query); query; end
15
15
 
16
16
  def self.is?(query)
@@ -6,6 +6,13 @@ module Barometer
6
6
  #
7
7
  class Coordinates < Base
8
8
  def self.regex; /^[-]?[0-9\.]+[,]{1}\s?[-]?[0-9\.]+$/; end
9
+
10
+ def self.geo(query)
11
+ return unless query
12
+
13
+ coordinates = query.split(',')
14
+ {latitude: coordinates[0].to_f, longitude: coordinates[1].to_f}
15
+ end
9
16
  end
10
17
  end
11
18
  end
@@ -19,13 +19,15 @@ module Barometer
19
19
 
20
20
  # in some cases the first letter can designate the country
21
21
  #
22
- def self.country_code(query)
22
+ def self.geo(query)
23
23
  return unless query && query.is_a?(String)
24
24
  $:.unshift(File.dirname(__FILE__))
25
25
  @@codes ||= YAML.load_file(@@codes_file)
26
26
  return unless @@codes && @@codes['one_letter'] && @@codes['two_letter']
27
- @@codes['one_letter'][query[0..0].upcase.to_s] ||
27
+ country_code = @@codes['one_letter'][query[0..0].upcase.to_s] ||
28
28
  @@codes['two_letter'][query[0..1].upcase.to_s] || nil
29
+
30
+ {country_code: country_code}
29
31
  end
30
32
  end
31
33
  end
@@ -5,7 +5,7 @@ module Barometer
5
5
  # eg. H0H 0H0
6
6
  #
7
7
  class Postalcode < Base
8
- def self.country_code(query); "CA"; end
8
+ def self.geo(query); {country_code: 'CA'}; end
9
9
  def self.regex
10
10
  # Rules: no D, F, I, O, Q, or U anywhere
11
11
  # Basic validation: ^[ABCEGHJ-NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}
@@ -5,7 +5,7 @@ module Barometer
5
5
  # eg. 90210
6
6
  #
7
7
  class ShortZipcode < Base
8
- def self.country_code(query); "US"; end
8
+ def self.geo(query); {country_code: 'US'}; end
9
9
  def self.regex; /(^[0-9]{5}$)/; end
10
10
  end
11
11
  end
@@ -11,8 +11,11 @@ module Barometer
11
11
  @@fixes = nil
12
12
 
13
13
  def self.regex; /(^[A-Za-z]{4}[0-9]{4}$)/; end
14
- def self.country_code(query)
15
- (query && query.size >= 2) ? _fix_country(query[0..1]) : nil
14
+
15
+ def self.geo(query)
16
+ if query && query.size >= 2
17
+ { country_code: _fix_country(query[0..1]) }
18
+ end
16
19
  end
17
20
 
18
21
  private
@@ -5,7 +5,7 @@ module Barometer
5
5
  # eg. 90210 or 90210-5555
6
6
  #
7
7
  class Zipcode < Base
8
- def self.country_code(query); "US"; end
8
+ def self.geo(query); {country_code: 'US'}; end
9
9
  def self.regex; /(^[0-9]{5}$)|(^[0-9]{5}-[0-9]{4}$)/; end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Barometer
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
@@ -29,7 +29,7 @@ module Barometer
29
29
  if converted_query.format == :short_zipcode
30
30
  {zipCode: converted_query.q}
31
31
  else
32
- {lat: converted_query.latitude, long: converted_query.longitude}
32
+ {lat: converted_query.geo.latitude, long: converted_query.geo.longitude}
33
33
  end
34
34
  end
35
35
 
@@ -38,6 +38,8 @@ module Barometer
38
38
  query = Query::Base.new('40.756054,-73.986951')
39
39
  expect( query.format ).to eq :coordinates
40
40
  expect( query.geo.country_code ).to be_nil
41
+ expect( query.geo.latitude ).to eq 40.756054
42
+ expect( query.geo.longitude ).to eq -73.986951
41
43
  end
42
44
 
43
45
  it 'defaults to :unknown' do
@@ -1,15 +1,15 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Base do
4
- describe "and class methods" do
5
- describe "is?," do
6
- it "calls a stubbed undefined method" do
7
- expect { Barometer::Query::Format::Base.is?("valid") }.to raise_error(NotImplementedError)
3
+ module Barometer::Query
4
+ describe Format::Base do
5
+ describe '.is?' do
6
+ it 'raises an error by default' do
7
+ expect { Format::Base.is?('valid') }.to raise_error(NotImplementedError)
8
8
  end
9
9
  end
10
10
 
11
- it "stubs country_code" do
12
- Barometer::Query::Format::Base.country_code(nil).should be_nil
11
+ describe '.geo' do
12
+ specify { expect( Format::Base.geo(nil) ).to be_nil }
13
13
  end
14
14
  end
15
15
  end
@@ -1,13 +1,23 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Coordinates do
4
- describe ".is?" do
5
- it "returns true when valid" do
6
- Barometer::Query::Format::Coordinates.is?("40.756054,-73.986951").should be_true
3
+ module Barometer::Query
4
+ describe Format::Coordinates do
5
+ describe '.geo' do
6
+ specify { expect( Format::Coordinates.geo(nil) ).to be_nil }
7
+
8
+ it 'parses out the latitude and longitude' do
9
+ expect( Format::Coordinates.geo('11.22,33.44') ).to eq({latitude: 11.22, longitude: 33.44})
10
+ end
7
11
  end
8
12
 
9
- it "returns false when not valid" do
10
- Barometer::Query::Format::Coordinates.is?("90210").should be_false
13
+ describe '.is?' do
14
+ it 'returns true when valid' do
15
+ expect( Format::Coordinates.is?('40.756054,-73.986951') ).to be_true
16
+ end
17
+
18
+ it 'returns false when not valid' do
19
+ expect( Format::Coordinates.is?('90210') ).to be_false
20
+ end
11
21
  end
12
22
  end
13
23
  end
@@ -1,9 +1,11 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Geocode do
4
- describe ".is?" do
5
- it "returns false" do
6
- Barometer::Query::Format::Geocode.is?("New York, NY").should be_false
3
+ module Barometer::Query
4
+ describe Format::Geocode do
5
+ describe '.is?' do
6
+ it 'returns false' do
7
+ expect( Format::Geocode.is?('New York, NY') ).to be_false
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -1,20 +1,22 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Icao do
4
- it ".country_code" do
5
- Barometer::Query::Format::Icao.country_code(nil).should be_nil
6
- Barometer::Query::Format::Icao.country_code("KSFO").should == "US"
7
- Barometer::Query::Format::Icao.country_code("CYYC").should == "CA"
8
- Barometer::Query::Format::Icao.country_code("ETAA").should == "DE"
9
- end
10
-
11
- describe ".is?" do
12
- it "recognizes a valid format" do
13
- Barometer::Query::Format::Icao.is?("KSFO").should be_true
3
+ module Barometer::Query
4
+ describe Format::Icao do
5
+ describe '.geo' do
6
+ specify { expect( Format::Icao.geo(nil) ).to be_nil }
7
+ specify { expect( Format::Icao.geo('KSFO') ).to eq({country_code: 'US'}) }
8
+ specify { expect( Format::Icao.geo('CYYC') ).to eq({country_code: 'CA'}) }
9
+ specify { expect( Format::Icao.geo('ETAA') ).to eq({country_code: 'DE'}) }
14
10
  end
15
11
 
16
- it "recognizes non-valid format" do
17
- Barometer::Query::Format::Icao.is?("invalid").should be_false
12
+ describe '.is?' do
13
+ it 'recognizes a valid format' do
14
+ expect( Format::Icao.is?('KSFO') ).to be_true
15
+ end
16
+
17
+ it 'recognizes non-valid format' do
18
+ expect( Format::Icao.is?('invalid') ).to be_false
19
+ end
18
20
  end
19
21
  end
20
22
  end
@@ -1,9 +1,11 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::NoaaStationId do
4
- describe ".is?" do
5
- it "returns false" do
6
- Barometer::Query::Format::NoaaStationId.is?("").should be_false
3
+ module Barometer::Query
4
+ describe Format::NoaaStationId do
5
+ describe '.is?' do
6
+ it 'returns false' do
7
+ expect( Format::NoaaStationId.is?('') ).to be_false
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -1,18 +1,20 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Postalcode do
4
- it ".country_code" do
5
- Barometer::Query::Format::Postalcode.country_code(nil).should == "CA"
6
- Barometer::Query::Format::Postalcode.country_code("ignored").should == "CA"
7
- end
8
-
9
- describe ".is?" do
10
- it "recognizes a valid format" do
11
- Barometer::Query::Format::Postalcode.is?("T5B 4M9").should be_true
3
+ module Barometer::Query
4
+ describe Format::Postalcode do
5
+ describe '.geo' do
6
+ specify { expect( Format::Postalcode.geo(nil) ).to eq({country_code: 'CA'}) }
7
+ specify { expect( Format::Postalcode.geo('ignored') ).to eq({country_code: 'CA'}) }
12
8
  end
13
9
 
14
- it "recognizes non-valid format" do
15
- Barometer::Query::Format::Postalcode.is?("90210").should be_false
10
+ describe '.is?' do
11
+ it 'recognizes a valid format' do
12
+ expect( Format::Postalcode.is?('T5B 4M9') ).to be_true
13
+ end
14
+
15
+ it 'recognizes non-valid format' do
16
+ expect( Format::Postalcode.is?('90210') ).to be_false
17
+ end
16
18
  end
17
19
  end
18
20
  end
@@ -1,18 +1,20 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::ShortZipcode do
4
- it ".country_code" do
5
- Barometer::Query::Format::ShortZipcode.country_code(nil).should == "US"
6
- Barometer::Query::Format::ShortZipcode.country_code("ignored").should == "US"
7
- end
8
-
9
- describe ".is?" do
10
- it "recognizes a valid format" do
11
- Barometer::Query::Format::ShortZipcode.is?("90210").should be_true
3
+ module Barometer::Query
4
+ describe Format::ShortZipcode do
5
+ describe '.geo' do
6
+ specify { expect( Format::ShortZipcode.geo(nil) ).to eq({country_code: 'US'}) }
7
+ specify { expect( Format::ShortZipcode.geo('ignored') ).to eq({country_code: 'US'}) }
12
8
  end
13
9
 
14
- it "recognizes non-valid format" do
15
- Barometer::Query::Format::ShortZipcode.is?("90210-5555").should be_false
10
+ describe '.is?' do
11
+ it 'recognizes a valid format' do
12
+ expect( Format::ShortZipcode.is?('90210') ).to be_true
13
+ end
14
+
15
+ it 'recognizes non-valid format' do
16
+ expect( Format::ShortZipcode.is?('90210-5555') ).to be_false
17
+ end
16
18
  end
17
19
  end
18
20
  end
@@ -1,9 +1,11 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Unknown do
4
- describe ".is?" do
5
- it "returns true" do
6
- Barometer::Query::Format::Unknown.is?("New York, NY").should be_true
3
+ module Barometer::Query
4
+ describe Format::Unknown do
5
+ describe '.is?' do
6
+ it 'returns true' do
7
+ expect( Format::Unknown.is?('New York, NY') ).to be_true
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -1,31 +1,29 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::WeatherID do
4
- it ".country_code" do
5
- Barometer::Query::Format::WeatherID.country_code(nil).should be_nil
6
- Barometer::Query::Format::WeatherID.country_code("i").should be_nil
7
- Barometer::Query::Format::WeatherID.country_code("USGA0000").should == "US"
8
- Barometer::Query::Format::WeatherID.country_code("CAAB0000").should == "CA"
9
- Barometer::Query::Format::WeatherID.country_code("SPXX0000").should == "ES"
10
- end
3
+ module Barometer::Query
4
+ describe Format::WeatherID do
5
+ describe '.geo' do
6
+ specify { expect( Format::WeatherID.geo(nil) ).to be_nil }
7
+ specify { expect( Format::WeatherID.geo('i') ).to be_nil }
11
8
 
12
- describe ".is?" do
13
- it "recognizes a valid format" do
14
- Barometer::Query::Format::WeatherID.is?("USGA0028").should be_true
15
- end
9
+ context 'when the country code is standard' do
10
+ specify { expect( Format::WeatherID.geo('USGA0000') ).to eq({country_code: 'US'}) }
11
+ specify { expect( Format::WeatherID.geo('CAAB0000') ).to eq({country_code: 'CA'}) }
12
+ end
16
13
 
17
- it "recognizes non-valid format" do
18
- Barometer::Query::Format::WeatherID.is?("invalid").should be_false
14
+ context 'when the country code is non standard' do
15
+ specify { expect( Format::WeatherID.geo('SPXX0000') ).to eq({country_code: 'ES'}) }
16
+ end
19
17
  end
20
- end
21
18
 
22
- describe "fixing country codes" do
23
- it "doesn't fix a correct code" do
24
- Barometer::Query::Format::WeatherID.send("_fix_country", "CA").should == "CA"
25
- end
19
+ describe '.is?' do
20
+ it 'recognizes a valid format' do
21
+ expect( Format::WeatherID.is?('USGA0028') ).to be_true
22
+ end
26
23
 
27
- it "fixes an incorrect code" do
28
- Barometer::Query::Format::WeatherID.send("_fix_country", "SP").should == "ES"
24
+ it 'recognizes non-valid format' do
25
+ expect( Format::WeatherID.is?('invalid') ).to be_false
26
+ end
29
27
  end
30
28
  end
31
29
  end
@@ -1,18 +1,20 @@
1
1
  require_relative '../../spec_helper'
2
2
 
3
- describe Barometer::Query::Format::Zipcode do
4
- it ".country_code" do
5
- Barometer::Query::Format::Zipcode.country_code(nil).should == "US"
6
- Barometer::Query::Format::Zipcode.country_code("ignored").should == "US"
7
- end
8
-
9
- describe ".is?" do
10
- it "recognizes a valid format" do
11
- Barometer::Query::Format::Zipcode.is?("90210-5555").should be_true
3
+ module Barometer::Query
4
+ describe Format::Zipcode do
5
+ describe '.geo' do
6
+ specify { expect( Format::Zipcode.geo(nil) ).to eq({country_code: 'US'}) }
7
+ specify { expect( Format::Zipcode.geo('ignored') ).to eq({country_code: 'US'}) }
12
8
  end
13
9
 
14
- it "recognizes non-valid format" do
15
- Barometer::Query::Format::Zipcode.is?("invalid").should be_false
10
+ describe '.is?' do
11
+ it 'recognizes a valid format' do
12
+ expect( Format::Zipcode.is?('90210-5555') ).to be_true
13
+ end
14
+
15
+ it 'recognizes non-valid format' do
16
+ expect( Format::Zipcode.is?('invalid') ).to be_false
17
+ end
16
18
  end
17
19
  end
18
20
  end
@@ -0,0 +1,44 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ module Barometer::WeatherService
4
+ describe WeatherBug::Query do
5
+ describe '#to_param' do
6
+ let(:converted_query) { double(:converted_query).as_null_object }
7
+ let(:query) { WeatherBug::Query.new(converted_query) }
8
+
9
+ context 'when the query is a :short_zipcode' do
10
+ before { converted_query.stub(format: :short_zipcode, q: '90210') }
11
+
12
+ it 'includes the correct parameters' do
13
+ expect( query.to_param[:zipCode] ).to eq '90210'
14
+ end
15
+ end
16
+
17
+ context 'and the query is a :coordinates' do
18
+ let(:geo) { double(:geo, latitude: '11.22', longitude: '33.44') }
19
+ before { converted_query.stub(format: :coordinates, geo: geo) }
20
+
21
+ it 'includes the correct parameters' do
22
+ expect( query.to_param[:lat] ).to eq '11.22'
23
+ expect( query.to_param[:long] ).to eq '33.44'
24
+ end
25
+ end
26
+
27
+ context 'and the query is metric' do
28
+ before { converted_query.stub(metric?: true) }
29
+
30
+ it 'includes the correct parameters' do
31
+ expect( query.to_param[:UnitType] ).to eq '1'
32
+ end
33
+ end
34
+
35
+ context 'and the query is imperial' do
36
+ before { converted_query.stub(metric?: false) }
37
+
38
+ it 'includes the correct parameters' do
39
+ expect( query.to_param[:UnitType] ).to eq '0'
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,77 +1,79 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe Barometer::WeatherService::WeatherBug, vcr: {
4
- cassette_name: "WeatherService::WeatherBug"
5
- } do
3
+ module Barometer
4
+ describe WeatherService::WeatherBug, vcr: {
5
+ cassette_name: 'WeatherService::WeatherBug'
6
+ } do
6
7
 
7
- it "auto-registers this weather service as :weather_bug" do
8
- Barometer::WeatherService.source(:weather_bug).should == Barometer::WeatherService::WeatherBug
9
- end
8
+ it 'auto-registers this weather service as :weather_bug' do
9
+ expect( WeatherService.source(:weather_bug) ).to eq WeatherService::WeatherBug
10
+ end
10
11
 
11
- describe ".call" do
12
- context "when no keys provided" do
13
- let(:query) { build_query }
12
+ describe '.call' do
13
+ context 'when no keys are provided' do
14
+ let(:query) { build_query }
14
15
 
15
- it "raises error" do
16
- expect {
17
- Barometer::WeatherService::WeatherBug.call(query)
18
- }.to raise_error(Barometer::WeatherService::KeyRequired)
16
+ it 'raises an error' do
17
+ expect {
18
+ WeatherService::WeatherBug.call(query)
19
+ }.to raise_error(WeatherService::KeyRequired)
20
+ end
19
21
  end
20
- end
21
22
 
22
- context "when keys are provided" do
23
- let(:converted_query) { Barometer::ConvertedQuery.new("90210", :short_zipcode, :metric) }
24
- let(:query) { build_query.tap{|q|q.stub(:convert! => converted_query)} }
25
- let(:config) { {keys: {code: WEATHERBUG_CODE}} }
23
+ context 'when keys are provided' do
24
+ let(:converted_query) { Barometer::ConvertedQuery.new('90210', :short_zipcode, :metric) }
25
+ let(:query) { build_query.tap{|q|q.stub(:convert! => converted_query)} }
26
+ let(:config) { {keys: {code: WEATHERBUG_CODE}} }
26
27
 
27
- subject { Barometer::WeatherService::WeatherBug.call(query, config) }
28
+ subject { WeatherService::WeatherBug.call(query, config) }
28
29
 
29
- it "asks the query to convert to accepted formats" do
30
- query.should_receive(:convert!).with(:short_zipcode, :coordinates)
31
- subject
32
- end
30
+ it 'converts the query to accepted formats' do
31
+ subject
32
+ expect( query ).to have_received(:convert!).with(:short_zipcode, :coordinates).at_least(:once)
33
+ end
33
34
 
34
- it "includes the expected data" do
35
- subject.query.should == '90210'
36
- subject.format.should == :short_zipcode
37
- subject.should be_metric
35
+ it 'includes the expected data' do
36
+ expect( subject.query ).to eq '90210'
37
+ expect( subject.format ).to eq :short_zipcode
38
+ expect( subject ).to be_metric
38
39
 
39
- should have_data(:current, :observed_at).as_format(:time)
40
- should have_data(:current, :stale_at).as_format(:time)
40
+ should have_data(:current, :observed_at).as_format(:time)
41
+ should have_data(:current, :stale_at).as_format(:time)
41
42
 
42
- should have_data(:current, :humidity).as_format(:float)
43
- should have_data(:current, :condition).as_format(:string)
44
- should have_data(:current, :icon).as_format(:number)
45
- should have_data(:current, :temperature).as_format(:temperature)
46
- should have_data(:current, :dew_point).as_format(:temperature)
47
- should have_data(:current, :wind_chill).as_format(:temperature)
48
- should have_data(:current, :wind).as_format(:vector)
49
- should have_data(:current, :pressure).as_format(:pressure)
50
- should have_data(:current, :sun, :rise).as_format(:time)
51
- should have_data(:current, :sun, :set).as_format(:time)
43
+ should have_data(:current, :humidity).as_format(:float)
44
+ should have_data(:current, :condition).as_format(:string)
45
+ should have_data(:current, :icon).as_format(:number)
46
+ should have_data(:current, :temperature).as_format(:temperature)
47
+ should have_data(:current, :dew_point).as_format(:temperature)
48
+ should have_data(:current, :wind_chill).as_format(:temperature)
49
+ should have_data(:current, :wind).as_format(:vector)
50
+ should have_data(:current, :pressure).as_format(:pressure)
51
+ should have_data(:current, :sun, :rise).as_format(:time)
52
+ should have_data(:current, :sun, :set).as_format(:time)
52
53
 
53
- should have_data(:station, :id).as_value("NRTSH")
54
- should have_data(:station, :name).as_value("Campbell Hall School")
55
- should have_data(:station, :city).as_value("Valley Village")
56
- should have_data(:station, :state_code).as_value("CA")
57
- should have_data(:station, :country).as_value("USA")
58
- should have_data(:station, :zip_code).as_value("91617")
59
- should have_data(:station, :latitude).as_value(34.1536102294922)
60
- should have_data(:station, :longitude).as_value(-118.398056030273)
54
+ should have_data(:station, :id).as_value('NRTSH')
55
+ should have_data(:station, :name).as_value('Campbell Hall School')
56
+ should have_data(:station, :city).as_value('Valley Village')
57
+ should have_data(:station, :state_code).as_value('CA')
58
+ should have_data(:station, :country).as_value('USA')
59
+ should have_data(:station, :zip_code).as_value('91617')
60
+ should have_data(:station, :latitude).as_value(34.1536102294922)
61
+ should have_data(:station, :longitude).as_value(-118.398056030273)
61
62
 
62
- should have_data(:location, :city).as_value("Beverly Hills")
63
- should have_data(:location, :state_code).as_value("CA")
64
- should have_data(:location, :zip_code).as_value("90210")
63
+ should have_data(:location, :city).as_value('Beverly Hills')
64
+ should have_data(:location, :state_code).as_value('CA')
65
+ should have_data(:location, :zip_code).as_value('90210')
65
66
 
66
- should have_data(:timezone, :to_s).as_format(/^P[DS]T$/i)
67
+ should have_data(:timezone, :to_s).as_format(/^P[DS]T$/i)
67
68
 
68
- subject.forecast.size.should == 7
69
- should have_forecast(:starts_at).as_format(:time)
70
- should have_forecast(:ends_at).as_format(:time)
71
- should have_forecast(:condition).as_format(:string)
72
- should have_forecast(:icon).as_format(:number)
73
- should have_forecast(:high).as_format(:temperature)
74
- should have_forecast(:low).as_format(:temperature)
69
+ expect( subject.forecast.size ).to eq 7
70
+ should have_forecast(:starts_at).as_format(:time)
71
+ should have_forecast(:ends_at).as_format(:time)
72
+ should have_forecast(:condition).as_format(:string)
73
+ should have_forecast(:icon).as_format(:number)
74
+ should have_forecast(:high).as_format(:temperature)
75
+ should have_forecast(:low).as_format(:temperature)
76
+ end
75
77
  end
76
78
  end
77
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barometer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-31 00:00:00.000000000 Z
12
+ date: 2013-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
@@ -475,6 +475,7 @@ files:
475
475
  - spec/weather_services/noaa_spec.rb
476
476
  - spec/weather_services/weather_bug/current_response_spec.rb
477
477
  - spec/weather_services/weather_bug/forecast_response_spec.rb
478
+ - spec/weather_services/weather_bug/query_spec.rb
478
479
  - spec/weather_services/weather_bug_spec.rb
479
480
  - spec/weather_services/wunderground_v1/current_response_spec.rb
480
481
  - spec/weather_services/wunderground_v1/forecast_response_spec.rb
@@ -603,6 +604,7 @@ test_files:
603
604
  - spec/weather_services/noaa_spec.rb
604
605
  - spec/weather_services/weather_bug/current_response_spec.rb
605
606
  - spec/weather_services/weather_bug/forecast_response_spec.rb
607
+ - spec/weather_services/weather_bug/query_spec.rb
606
608
  - spec/weather_services/weather_bug_spec.rb
607
609
  - spec/weather_services/wunderground_v1/current_response_spec.rb
608
610
  - spec/weather_services/wunderground_v1/forecast_response_spec.rb