Class: WeatherGov::ForecastPeriod
- Inherits:
-
Object
- Object
- WeatherGov::ForecastPeriod
- Defined in:
- lib/weather_gov/forecast_period.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #daytime? ⇒ Boolean
- #detailed_forecast ⇒ Object
- #end_time ⇒ Object
- #icon ⇒ Object
-
#initialize(data:) ⇒ ForecastPeriod
constructor
A new instance of ForecastPeriod.
- #name ⇒ Object
- #number ⇒ Object
- #short_forecast ⇒ Object
- #start_time ⇒ Object
- #temperature ⇒ Object
- #temperature_trend ⇒ Object
- #temperature_unit ⇒ Object
- #wind_direction ⇒ Object
- #wind_speed ⇒ Object
Constructor Details
#initialize(data:) ⇒ ForecastPeriod
Returns a new instance of ForecastPeriod.
7 8 9 |
# File 'lib/weather_gov/forecast_period.rb', line 7 def initialize(data:) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/weather_gov/forecast_period.rb', line 5 def data @data end |
Instance Method Details
#daytime? ⇒ Boolean
27 28 29 |
# File 'lib/weather_gov/forecast_period.rb', line 27 def daytime? data.fetch("isDaytime") end |
#detailed_forecast ⇒ Object
59 60 61 |
# File 'lib/weather_gov/forecast_period.rb', line 59 def detailed_forecast data.fetch("detailedForecast") end |
#end_time ⇒ Object
23 24 25 |
# File 'lib/weather_gov/forecast_period.rb', line 23 def end_time @end_time ||= Time.parse(data.fetch("endTime")) end |
#icon ⇒ Object
51 52 53 |
# File 'lib/weather_gov/forecast_period.rb', line 51 def icon data.fetch("icon") end |
#name ⇒ Object
15 16 17 |
# File 'lib/weather_gov/forecast_period.rb', line 15 def name data.fetch("name") end |
#number ⇒ Object
11 12 13 |
# File 'lib/weather_gov/forecast_period.rb', line 11 def number data.fetch("number") end |
#short_forecast ⇒ Object
55 56 57 |
# File 'lib/weather_gov/forecast_period.rb', line 55 def short_forecast data.fetch("shortForecast") end |
#start_time ⇒ Object
19 20 21 |
# File 'lib/weather_gov/forecast_period.rb', line 19 def start_time @start_time ||= Time.parse(data.fetch("startTime")) end |
#temperature ⇒ Object
31 32 33 |
# File 'lib/weather_gov/forecast_period.rb', line 31 def temperature data.fetch("temperature") end |
#temperature_trend ⇒ Object
39 40 41 |
# File 'lib/weather_gov/forecast_period.rb', line 39 def temperature_trend data.fetch("temperatureTrend") end |
#temperature_unit ⇒ Object
35 36 37 |
# File 'lib/weather_gov/forecast_period.rb', line 35 def temperature_unit data.fetch("temperatureUnit") end |
#wind_direction ⇒ Object
47 48 49 |
# File 'lib/weather_gov/forecast_period.rb', line 47 def wind_direction data.fetch("windDirection") end |
#wind_speed ⇒ Object
43 44 45 |
# File 'lib/weather_gov/forecast_period.rb', line 43 def wind_speed data.fetch("windSpeed") end |