Class: Weather::Units

Inherits:
Object
  • Object
show all
Defined in:
lib/weather-api/units.rb

Constant Summary collapse

FAHRENHEIT =
'f'
CELSIUS =
'c'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Units

Returns a new instance of Units.



22
23
24
25
26
27
# File 'lib/weather-api/units.rb', line 22

def initialize(payload)
  @temperature = payload[:temperature].strip
  @distance = payload[:distance].strip
  @pressure = payload[:pressure].strip
  @speed = payload[:speed].strip
end

Instance Attribute Details

#distanceObject (readonly)

the unit in which distance is measured e.g. mi for miles, and km for kilometers



12
13
14
# File 'lib/weather-api/units.rb', line 12

def distance
  @distance
end

#pressureObject (readonly)

the unit in which pressure is measured e.g in for inches, and cm for centimeters



16
17
18
# File 'lib/weather-api/units.rb', line 16

def pressure
  @pressure
end

#speedObject (readonly)

the unit in which speed is measured e.g. mph for miles per hour, and kph for kilometers per hour



20
21
22
# File 'lib/weather-api/units.rb', line 20

def speed
  @speed
end

#temperatureObject (readonly)

the unit in which temperature is measured e.g. F for Fahrenheit, and C for Celsius



8
9
10
# File 'lib/weather-api/units.rb', line 8

def temperature
  @temperature
end