Class: Barometer::WeatherService::Yahoo

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/weather_services/yahoo.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Yahoo) initialize(query, config = {})

A new instance of Yahoo



16
17
18
19
20
# File 'lib/barometer/weather_services/yahoo.rb', line 16

def initialize(query, config={})
  @query = query
  @metric = config.fetch(:metric, true)
  @response = Response.new(metric)
end

Class Method Details

+ (Object) accepted_formats



8
9
10
# File 'lib/barometer/weather_services/yahoo.rb', line 8

def self.accepted_formats
  [:zipcode, :weather_id, :woe_id]
end

+ (Object) call(query, config = {})



12
13
14
# File 'lib/barometer/weather_services/yahoo.rb', line 12

def self.call(query, config={})
  WeatherService::Yahoo.new(query, config).measure!
end

Instance Method Details

- (Object) measure!



22
23
24
25
26
27
28
29
# File 'lib/barometer/weather_services/yahoo.rb', line 22

def measure!
  convert_query!

  @requester = Barometer::Requester::Yahoo.new(metric)
  fetch_and_parse_weather

  response
end