Class: Barometer::WeatherService::Base

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

Instance Method Summary collapse

Constructor Details

#initialize(source, version = nil) ⇒ Base

Returns a new instance of Base.



4
5
6
7
# File 'lib/barometer/weather_services/base.rb', line 4

def initialize(source, version=nil)
  @source = source
  @service = WeatherService.source(@source, version)
end

Instance Method Details

#measure(query, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/barometer/weather_services/base.rb', line 9

def measure(query, options={})
  @response = Barometer::Response.new

  record_time do
    measure_and_record_status(query, options)
  end

  @response.weight = options.fetch(:weight, nil)
  @response.source = @source
  @response
end