Sha256: d50070b4921ec113ff3666f2df92b0319e79c9c8c086db4b9ab18877f1c15b40

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

module Forecastr
  class Forecast

    attr_reader :city, :longitude, :latitude, :temperature,
                :pressure, :humidity, :min_temperature,
                :max_temperature, :clouds, :wind

    def initialize(json)
      @city = json['name']
      @longitude = json['coord']['lon']
      @latitude = json['coord']['lat']
      @temperature = Forecastr::Temperature.new(json['main']['temp'])
      @pressure = json['main']['pressure']
      @humidity = json['main']['humidity']
      @min_temperature = Forecastr::Temperature.new(json['main']['temp_min'])
      @max_temperature = Forecastr::Temperature.new(json['main']['temp_max'])
      @clouds = json['clouds']['all']
      @wind = Forecastr::Wind.new(json)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
forecastr-0.1.2 lib/forecastr/forecast.rb
forecastr-0.1.1 lib/forecastr/forecast.rb
forecastr-0.1.0 lib/forecastr/forecast.rb