Class: OpenWeatherAPI::Resources::Current
- Inherits:
-
Base
- Object
- Base
- OpenWeatherAPI::Resources::Current
show all
- Defined in:
- lib/open-weather-api/resources/current.rb
Instance Attribute Summary
Attributes inherited from Base
#api_obj
Instance Method Summary
collapse
Methods inherited from Base
#execute, #initialize
Instance Method Details
#base_url ⇒ Object
5
6
7
8
9
10
|
# File 'lib/open-weather-api/resources/current.rb', line 5
def base_url
return super + 'group/' if city_id.multiple?
return super + 'weather/' if [city, city_id, geolocation, zipcode].any? { |h| h.can? }
return super + 'box/city/' if bbox.can?
return super + 'find/' if circle.can?
end
|
#bbox ⇒ Object
35
36
37
|
# File 'lib/open-weather-api/resources/current.rb', line 35
def bbox
Handlers::BoundingBox.new @api_obj, @parameters
end
|
#build_params(parameters = {}) ⇒ Object
12
13
14
|
# File 'lib/open-weather-api/resources/current.rb', line 12
def build_params(parameters = {})
super [city, city_id, geolocation, zipcode, bbox, circle].each{ |h| break h.handle if h.can? }
end
|
#circle ⇒ Object
39
40
41
|
# File 'lib/open-weather-api/resources/current.rb', line 39
def circle
Handlers::Circle.new @api_obj, @parameters
end
|
#city ⇒ Object
17
18
19
|
# File 'lib/open-weather-api/resources/current.rb', line 17
def city
Handlers::City.new @api_obj, @parameters
end
|
#city_id ⇒ Object
21
22
23
|
# File 'lib/open-weather-api/resources/current.rb', line 21
def city_id
Handlers::CityID.new @api_obj, @parameters
end
|
#geolocation ⇒ Object
25
26
27
|
# File 'lib/open-weather-api/resources/current.rb', line 25
def geolocation
Handlers::Geolocation.new @api_obj, @parameters
end
|
#zipcode ⇒ Object
29
30
31
|
# File 'lib/open-weather-api/resources/current.rb', line 29
def zipcode
Handlers::Zipcode.new @api_obj, @parameters
end
|