class Youtube::WeatherForecast
WeatherForecast
Model.
Attributes
date[RW]
The time when forecast was taken @return [DateTime]
summary[R]
the value of temperature in Fahrenheit @return [String]
temperature_c[RW]
the value of temperature in Centigrade @return [Integer]
temperature_f[R]
the value of temperature in Fahrenheit @return [Integer]
Public Class Methods
from_hash(hash)
click to toggle source
Creates an instance of the object from a hash.
# File lib/youtube/models/weather_forecast.rb, line 47 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. date = APIHelper.rfc3339(hash['date']) if hash['date'] temperature_c = hash['temperatureC'] temperature_f = hash['temperatureF'] summary = hash['summary'] # Create object from extracted values. WeatherForecast.new(date, temperature_c, temperature_f, summary) end
names()
click to toggle source
A mapping from model property names to API property names.
# File lib/youtube/models/weather_forecast.rb, line 27 def self.names @_hash = {} if @_hash.nil? @_hash['date'] = 'date' @_hash['temperature_c'] = 'temperatureC' @_hash['temperature_f'] = 'temperatureF' @_hash['summary'] = 'summary' @_hash end
new(date = nil, temperature_c = nil, temperature_f = nil, summary = nil)
click to toggle source
# File lib/youtube/models/weather_forecast.rb, line 36 def initialize(date = nil, temperature_c = nil, temperature_f = nil, summary = nil) @date = date @temperature_c = temperature_c @temperature_f = temperature_f @summary = summary end