Class: BrasilAPI::CPTEC
Constant Summary
Constants inherited from Base
Class Method Summary collapse
- .airport_weather(code) ⇒ Object
- .all ⇒ Object
- .capital_weather ⇒ Object
- .city_weather(city_code, days = nil) ⇒ Object
- .ocean_forecast(city_code, days = nil) ⇒ Object
- .search_location(city_name) ⇒ Object
Methods inherited from Base
Class Method Details
.airport_weather(code) ⇒ Object
18 19 20 |
# File 'lib/brasil_api/cptec.rb', line 18 def airport_weather(code) get("/cptec/v1/clima/aeroporto/#{code}") end |
.all ⇒ Object
6 7 8 |
# File 'lib/brasil_api/cptec.rb', line 6 def all get("/cptec/v1/cidade") end |
.capital_weather ⇒ Object
14 15 16 |
# File 'lib/brasil_api/cptec.rb', line 14 def capital_weather get("/cptec/v1/clima/capital") end |
.city_weather(city_code, days = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/brasil_api/cptec.rb', line 22 def city_weather(city_code, days = nil) if days get("/cptec/v1/clima/previsao/#{city_code}/#{days}") else get("/cptec/v1/clima/previsao/#{city_code}") end end |
.ocean_forecast(city_code, days = nil) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/brasil_api/cptec.rb', line 30 def ocean_forecast(city_code, days = nil) if days get("/cptec/v1/ondas/#{city_code}/#{days}") else get("/cptec/v1/ondas/#{city_code}") end end |
.search_location(city_name) ⇒ Object
10 11 12 |
# File 'lib/brasil_api/cptec.rb', line 10 def search_location(city_name) get("/cptec/v1/cidade/#{city_name}") end |