Class: BrasilAPI::CPTEC

Inherits:
Base
  • Object
show all
Defined in:
lib/brasil_api/cptec.rb

Constant Summary

Constants inherited from Base

Base::BASE_URL

Class Method Summary collapse

Methods inherited from Base

get

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

.allObject



6
7
8
# File 'lib/brasil_api/cptec.rb', line 6

def all
  get("/cptec/v1/cidade")
end

.capital_weatherObject



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