class Weather::Atmosphere

Attributes

barometer[R]

barometer state, defined as one of the contants in Weather::Atmosphere::Barometer

humidity[R]

air humidity

pressure[R]

air pressure level

visibility[R]

visibility of the surroundings

Public Class Methods

new(payload) click to toggle source
# File lib/weather-api/atmosphere.rb, line 25
def initialize(payload)
  @humidity   = payload[:humidity].to_i
  @visibility = payload[:visibility].to_i
  @pressure   = payload[:pressure].to_f

  # map barometric pressure to appropriate constant
  @barometer = nil

  case payload[:rising].to_i
    when 0 then @barometer = Barometer::STEADY
    when 1 then @barometer = Barometer::RISING
    when 2 then @barometer = Barometer::FALLING
  end
end