Class: Forecastr::DataContainer
- Inherits:
-
Object
- Object
- Forecastr::DataContainer
- Defined in:
- lib/forecastr/data_container.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#clouds ⇒ Object
readonly
Returns the value of attribute clouds.
-
#humidity ⇒ Object
readonly
Returns the value of attribute humidity.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#max_temperature ⇒ Object
readonly
Returns the value of attribute max_temperature.
-
#min_temperature ⇒ Object
readonly
Returns the value of attribute min_temperature.
-
#pressure ⇒ Object
readonly
Returns the value of attribute pressure.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
-
#wind_angle ⇒ Object
readonly
Returns the value of attribute wind_angle.
-
#wind_speed ⇒ Object
readonly
Returns the value of attribute wind_speed.
Instance Method Summary collapse
-
#initialize(json) ⇒ DataContainer
constructor
A new instance of DataContainer.
Constructor Details
#initialize(json) ⇒ DataContainer
Returns a new instance of DataContainer.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/forecastr/data_container.rb', line 7 def initialize(json) @city = json['name'] @longitude = json['coord']['lon'] @latitude = json['coord']['lat'] @temperature = json['main']['temp'] @pressure = json['main']['pressure'] @humidity = json['main']['humidity'] @min_temperature = json['main']['temp_min'] @max_temperature = json['main']['temp_max'] @clouds = json['clouds']['all'] @wind_speed = json['wind']['speed'] @wind_angle = json['wind']['deg'] end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def city @city end |
#clouds ⇒ Object (readonly)
Returns the value of attribute clouds.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def clouds @clouds end |
#humidity ⇒ Object (readonly)
Returns the value of attribute humidity.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def humidity @humidity end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def longitude @longitude end |
#max_temperature ⇒ Object (readonly)
Returns the value of attribute max_temperature.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def max_temperature @max_temperature end |
#min_temperature ⇒ Object (readonly)
Returns the value of attribute min_temperature.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def min_temperature @min_temperature end |
#pressure ⇒ Object (readonly)
Returns the value of attribute pressure.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def pressure @pressure end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def temperature @temperature end |
#wind_angle ⇒ Object (readonly)
Returns the value of attribute wind_angle.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def wind_angle @wind_angle end |
#wind_speed ⇒ Object (readonly)
Returns the value of attribute wind_speed.
4 5 6 |
# File 'lib/forecastr/data_container.rb', line 4 def wind_speed @wind_speed end |