Sha256: 91efc9397389f142bb9acb097acc00818299196e1130e6cacb08f62d77e27763

Contents?: true

Size: 852 Bytes

Versions: 2

Compression:

Stored size: 852 Bytes

Contents

require 'date'

module Forecastr
  class Forecast

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

    def initialize(data)
      @city = data.city
      @longitude = data.longitude
      @latitude = data.latitude
      @temperature = Forecastr::Temperature.new(data.temperature)
      @pressure = data.pressure
      @humidity = data.humidity
      @min_temperature = Forecastr::Temperature.new(data.min_temperature)
      @max_temperature = Forecastr::Temperature.new(data.max_temperature)
      @clouds = data.clouds
      @wind = Forecastr::Wind.new(data.wind_speed, data.wind_angle)
      @sunset = DateTime.strptime(data.sunset, '%s')
      @sunrise = DateTime.strptime(data.sunrise, '%s')
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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