class Everlog::Inf::Api::Wunderground
Public Class Methods
new(config)
click to toggle source
Calls superclass method
Everlog::Inf::Api::new
# File lib/everlog/inf/api/wunderground.rb, line 5 def initialize config super(config) @cache = Inf::Cache::File::Wunderground.new end
Public Instance Methods
client()
click to toggle source
# File lib/everlog/inf/api/wunderground.rb, line 10 def client @client ||= ::Wunderground.new(@config.access_token, throws_exceptions: true) end
yesterday(place)
click to toggle source
# File lib/everlog/inf/api/wunderground.rb, line 14 def yesterday place @cache.delete((Date.today - 2).to_s) response = @cache.create((Date.today - 1).to_s, { place: place, client: client}) do |args| args[:client].yesterday_for(args[:place]).to_json end JSON.parse(response)['history'] rescue => e raise InfrastructureWeatherError, "yesterday error / #{e.message}" end