Sha256: dd6a4003717b0780a6b874b664b32f0dc200047180ca0e985f0d0771b425081f

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

module Forecastr
  class DataContainer

    attr_reader :city, :longitude, :latitude, :pressure, :humidity, :clouds,
      :temperature, :min_temperature, :max_temperature, :wind_speed, :wind_angle, :sunrise, :sunset

    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']
      @sunrise = json['sys']['sunrise'].to_s
      @sunset = json['sys']['sunset'].to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forecastr-0.1.5 lib/forecastr/data_container.rb
forecastr-0.1.4 lib/forecastr/data_container.rb