Class: UndergroundWeather::ApiCall

Inherits:
Object
  • Object
show all
Defined in:
lib/undergroundweather/api_call.rb

Constant Summary collapse

BASE_URL =
'http://api.wunderground.com/api'

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#errorObject (readonly)

Returns the value of attribute error.



7
8
9
# File 'lib/undergroundweather/api_call.rb', line 7

def error
  @error
end

#responseObject (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

#urlObject



26
27
28
# File 'lib/undergroundweather/api_call.rb', line 26

def url
  URI.parse("#{BASE_URL}/#{@api_key}/#{@feature}/q/#{@query}.json")
end