Class: UndergroundWeather::ApiCall
- Inherits:
-
Object
- Object
- UndergroundWeather::ApiCall
- Defined in:
- lib/undergroundweather/api_call.rb
Constant Summary collapse
- BASE_URL =
'http://api.wunderground.com/api'
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #get! ⇒ Object
-
#initialize(api_key, feature, query) ⇒ ApiCall
constructor
A new instance of ApiCall.
- #url ⇒ Object
Constructor Details
#initialize(api_key, feature, query) ⇒ ApiCall
Returns a new instance of ApiCall.
11 12 13 14 15 16 |
# File 'lib/undergroundweather/api_call.rb', line 11 def initialize(api_key, feature, query) @api_key = api_key @feature = feature @query = query @error = false end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/undergroundweather/api_call.rb', line 7 def error @error end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/undergroundweather/api_call.rb', line 7 def response @response end |
Instance Method Details
#get! ⇒ Object
18 19 20 |
# File 'lib/undergroundweather/api_call.rb', line 18 def get! get end |
#url ⇒ Object
26 27 28 |
# File 'lib/undergroundweather/api_call.rb', line 26 def url URI.parse("#{BASE_URL}/#{@api_key}/#{@feature}/q/#{@query}.json") end |