class Duststorm::WeatherApi::Base

Attributes

lat[R]
lng[R]
options[R]

Public Class Methods

new(lat, lng, options={}) click to toggle source
# File lib/duststorm/weather_apis/base.rb, line 8
def initialize(lat, lng, options={})
  @lat = lat
  @lng = lng
  @options = options
end

Public Instance Methods

conn() click to toggle source
# File lib/duststorm/weather_apis/base.rb, line 24
def conn
  Faraday.new
end
execute() click to toggle source
# File lib/duststorm/weather_apis/base.rb, line 14
def execute
  if response.success?
    mapped_response_body
  end
end
forecast_url() click to toggle source
# File lib/duststorm/weather_apis/base.rb, line 28
def forecast_url
  root_url + forecast_path
end
response() click to toggle source
# File lib/duststorm/weather_apis/base.rb, line 20
def response
  @response ||= conn.get(forecast_url, options)
end

Private Instance Methods

parsed_response_body() click to toggle source
# File lib/duststorm/weather_apis/base.rb, line 34
def parsed_response_body
  MultiJson.load(response.body, :symbolize_keys => true)
end