Class: WeatherGov::ForecastPeriod

Inherits:
Object
  • Object
show all
Defined in:
lib/weather_gov/forecast_period.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (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

Returns:

  • (Boolean)


27
28
29
# File 'lib/weather_gov/forecast_period.rb', line 27

def daytime?
  data.fetch("isDaytime")
end

#detailed_forecastObject



59
60
61
# File 'lib/weather_gov/forecast_period.rb', line 59

def detailed_forecast
  data.fetch("detailedForecast")
end

#end_timeObject



23
24
25
# File 'lib/weather_gov/forecast_period.rb', line 23

def end_time
  @end_time ||= Time.parse(data.fetch("endTime"))
end

#iconObject



51
52
53
# File 'lib/weather_gov/forecast_period.rb', line 51

def icon
  data.fetch("icon")
end

#nameObject



15
16
17
# File 'lib/weather_gov/forecast_period.rb', line 15

def name
  data.fetch("name")
end

#numberObject



11
12
13
# File 'lib/weather_gov/forecast_period.rb', line 11

def number
  data.fetch("number")
end

#short_forecastObject



55
56
57
# File 'lib/weather_gov/forecast_period.rb', line 55

def short_forecast
  data.fetch("shortForecast")
end

#start_timeObject



19
20
21
# File 'lib/weather_gov/forecast_period.rb', line 19

def start_time
  @start_time ||= Time.parse(data.fetch("startTime"))
end

#temperatureObject



31
32
33
# File 'lib/weather_gov/forecast_period.rb', line 31

def temperature
  data.fetch("temperature")
end

#temperature_trendObject



39
40
41
# File 'lib/weather_gov/forecast_period.rb', line 39

def temperature_trend
  data.fetch("temperatureTrend")
end

#temperature_unitObject



35
36
37
# File 'lib/weather_gov/forecast_period.rb', line 35

def temperature_unit
  data.fetch("temperatureUnit")
end

#wind_directionObject



47
48
49
# File 'lib/weather_gov/forecast_period.rb', line 47

def wind_direction
  data.fetch("windDirection")
end

#wind_speedObject



43
44
45
# File 'lib/weather_gov/forecast_period.rb', line 43

def wind_speed
  data.fetch("windSpeed")
end