Skip to content

Instantly share code, notes, and snippets.

@burmjohn
Created August 15, 2011 20:08
Show Gist options
  • Select an option

  • Save burmjohn/1147675 to your computer and use it in GitHub Desktop.

Select an option

Save burmjohn/1147675 to your computer and use it in GitHub Desktop.
barometer error
ruby-1.9.2-head :001 > require 'barometer'
=> true
ruby-1.9.2-head :002 > barometer = Barometer.new("11516")
=> #<Barometer::Base:0x000000016ebc10 @query=#<Barometer::Query:0x000000016ebbc0 @q="11516", @format=:short_zipcode, @country_code="US", @conversions={}>, @weather=#<Barometer::Weather:0x000000016eb968 @measurements=[]>, @success=false>
ruby-1.9.2-head :003 > weather = barometer.measure
=> #<Barometer::Weather:0x000000016eb968 @measurements=[#<Barometer::Measurement:0x0000000167f060 @source=:wunderground, @metric=nil, @success=true, @weight=1, @links={"Weather Underground NOAA Weather Station"=>"http://wunderground.com/"}, @start_at=2011-08-15 20:02:51 UTC, @query="11516", @format=:zipcode, @current=#<Barometer::Measurement::Result:0x000000015a0f68 @metric=true, @updated_at=2011-08-15, @humidity=66, @icon="mostlycloudy", @temperature=79 F, @wind=6 mph, @pressure=29 in, @dew_point=67 F, @heat_index= F, @wind_chill= F, @visibility=10 m, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>, @current_at=04:02 pm>, @utc_time_stamp=2011-08-15 20:02:51 UTC, @forecast=[#<Barometer::Measurement::Result:0x0000000159d0e8 @metric=true, @icon="tstorms", @date=#<Date: 2011-08-15 (4911577/2,0,2299161)>, @valid_start_date=2011-08-15, @valid_end_date=2011-08-15, @pop=80, @high=76 F, @low=65 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>, #<Barometer::Measurement::Result:0x0000000157bf38 @metric=true, @icon="tstorms", @date=#<Date: 2011-08-16 (4911579/2,0,2299161)>, @valid_start_date=2011-08-16, @valid_end_date=2011-08-16, @pop=30, @high=76 F, @low=67 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>, #<Barometer::Measurement::Result:0x00000001565fd0 @metric=true, @icon="clear", @date=#<Date: 2011-08-17 (4911581/2,0,2299161)>, @valid_start_date=2011-08-17, @valid_end_date=2011-08-17, @pop=10, @high=79 F, @low=70 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>, #<Barometer::Measurement::Result:0x00000001537a40 @metric=true, @icon="tstorms", @date=#<Date: 2011-08-18 (4911583/2,0,2299161)>, @valid_start_date=2011-08-18, @valid_end_date=2011-08-18, @pop=20, @high=81 F, @low=70 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>, #<Barometer::Measurement::Result:0x00000001533788 @metric=true, @icon="chancetstorms", @date=#<Date: 2011-08-19 (4911585/2,0,2299161)>, @valid_start_date=2011-08-19, @valid_end_date=2011-08-19, @pop=30, @high=79 F, @low=70 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>, #<Barometer::Measurement::Result:0x00000001520e30 @metric=true, @icon="chancetstorms", @date=#<Date: 2011-08-20 (4911587/2,0,2299161)>, @valid_start_date=2011-08-20, @valid_end_date=2011-08-20, @pop=20, @high=79 F, @low=70 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>], @location=Cedarhurst, NY, Cedarhurst, New York, US, @station=New York JFK, New York, New York JFK, US, @timezone=#<Data::Zone:0x0000000151ac10 @zone_full="America/New_York", @tz=#<TZInfo::DataTimezone: America/New_York>>, @measured_at=04:02 pm, @end_at=2011-08-15 20:02:52 UTC>], @start_at=2011-08-15 20:02:51 UTC, @end_at=2011-08-15 20:02:52 UTC>
ruby-1.9.2-head :004 > thetime = Time.parse("13:00 01-01-2009")
=> 2009-01-01 13:00:00 -0500
ruby-1.9.2-head :005 > weather.for(thetime)
=> nil
ruby-1.9.2-head :006 > time = Time.parse("13:00 01-01-2009")
=> 2009-01-01 13:00:00 -0500
ruby-1.9.2-head :007 > weather.for(time)
=> nil
weather.for(Time.now)
=> #<Barometer::Measurement::Result:0x0000000159d0e8 @metric=true, @icon="tstorms", @date=#<Date: 2011-08-15 (4911577/2,0,2299161)>, @valid_start_date=2011-08-15, @valid_end_date=2011-08-15, @pop=80, @high=76 F, @low=65 F, @sun=#<Data::Sun:0x0000000151ae68 @rise=06:05 am, @set=07:53 pm>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment