Class: Forecastr::DataContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/forecastr/data_container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cityObject (readonly)

Returns the value of attribute city.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def city
  @city
end

#cloudsObject (readonly)

Returns the value of attribute clouds.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def clouds
  @clouds
end

#humidityObject (readonly)

Returns the value of attribute humidity.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def humidity
  @humidity
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def longitude
  @longitude
end

#max_temperatureObject (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_temperatureObject (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

#pressureObject (readonly)

Returns the value of attribute pressure.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def pressure
  @pressure
end

#temperatureObject (readonly)

Returns the value of attribute temperature.



4
5
6
# File 'lib/forecastr/data_container.rb', line 4

def temperature
  @temperature
end

#wind_angleObject (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_speedObject (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