class MgTracker::WeatherService

`WeatherService` connects to the weather service to make various weather data available.

Attributes

api_key[R]
city[RW]
data[R]
state[RW]

Public Class Methods

new(city = 'Kennesaw', state = 'GA') click to toggle source
# File lib/mg_tracker/weather_service.rb, line 10
def initialize(city = 'Kennesaw', state = 'GA')
  @city = city
  @state = state
  @api_key = YAML.load_file(Dir.pwd + '/config/ws_api_key.yml')['WS_API_KEY']
  url = "http://api.wunderground.com/api/#{api_key}/conditions/q/#{state}/#{city}.json"
  @data = ::HTTParty.get(url)
  @current_observation = @data['current_observation']
end

Public Instance Methods

barometer_data() click to toggle source
# File lib/mg_tracker/weather_service.rb, line 25
def barometer_data
  {
    in: barometer_in,
    mb: barometer_mb,
    trend: barometer_trend
  }
end