class Decorators::OpenWeatherResponse

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/decorators/open_weather_response.rb, line 3
def initialize(data)
  @data = data
end

Public Instance Methods

amount_in_kelvins() click to toggle source
# File lib/decorators/open_weather_response.rb, line 7
def amount_in_kelvins
  parsed_data['temp'].round(1)
end
parsed_data() click to toggle source
# File lib/decorators/open_weather_response.rb, line 11
def parsed_data
  JSON.parse(data.body)['main']
end
parsed_weather_description() click to toggle source
# File lib/decorators/open_weather_response.rb, line 15
def parsed_weather_description
  JSON.parse(data.body)['weather'].first['description'].split.map(&:capitalize).join(' ')
end