Class: Barometer::WeatherService::WeatherBug::CurrentApi

Inherits:
Utils::Api
  • Object
show all
Defined in:
lib/barometer/weather_services/weather_bug/current_api.rb

Instance Attribute Summary

Attributes inherited from Utils::Api

#query

Instance Method Summary collapse

Methods inherited from Utils::Api

#current_query, #get

Constructor Details

#initialize(query, api_code) ⇒ CurrentApi

Returns a new instance of CurrentApi.



7
8
9
10
# File 'lib/barometer/weather_services/weather_bug/current_api.rb', line 7

def initialize(query, api_code)
  @query = WeatherBug::Query.new(query)
  @api_code = api_code
end

Instance Method Details

#paramsObject



16
17
18
# File 'lib/barometer/weather_services/weather_bug/current_api.rb', line 16

def params
  {ACode: @api_code, OutputType: '1'}.merge(@query.to_param)
end

#unwrap_nodesObject



20
21
22
# File 'lib/barometer/weather_services/weather_bug/current_api.rb', line 20

def unwrap_nodes
  ['weather', 'ob']
end

#urlObject



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

def url
  "http://#{@api_code}.api.wxbug.net/getLiveWeatherRSS.aspx"
end