Class: IBGE::Regiao
- Inherits:
-
Object
- Object
- IBGE::Regiao
- Defined in:
- lib/ibge/regiao.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#nome ⇒ Object
Returns the value of attribute nome.
-
#sigla ⇒ Object
Returns the value of attribute sigla.
Class Method Summary collapse
-
.obter_regioes ⇒ <Array[Regiao]>
Obtém o conjunto de regiões do Brasil.
-
.regioes_por_identificador(regioes) ⇒ Regiao, <Array[Regiao]>
Obtém o conjunto de regiões do Brasil a partir dos respectivos identificadores.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Regiao
constructor
A new instance of Regiao.
Constructor Details
#initialize(options = {}) ⇒ Regiao
Returns a new instance of Regiao.
5 6 7 8 9 |
# File 'lib/ibge/regiao.rb', line 5 def initialize( = {}) @id = ['id'] @nome = ['nome'] @sigla = ['sigla'] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ibge/regiao.rb', line 3 def id @id end |
#nome ⇒ Object
Returns the value of attribute nome.
3 4 5 |
# File 'lib/ibge/regiao.rb', line 3 def nome @nome end |
#sigla ⇒ Object
Returns the value of attribute sigla.
3 4 5 |
# File 'lib/ibge/regiao.rb', line 3 def sigla @sigla end |
Class Method Details
.obter_regioes ⇒ <Array[Regiao]>
Obtém o conjunto de regiões do Brasil.
18 19 20 21 22 |
# File 'lib/ibge/regiao.rb', line 18 def self.obter_regioes resposta = RestClient.get("#{BASE_URL}/regioes") tratar_retorno(resposta) end |
.regioes_por_identificador(regioes) ⇒ Regiao, <Array[Regiao]>
Obtém o conjunto de regiões do Brasil a partir dos respectivos identificadores. Pode ser informada a sigla, identificador (ID) ou um array de siglas/identificadores.
36 37 38 39 40 41 |
# File 'lib/ibge/regiao.rb', line 36 def self.regioes_por_identificador(regioes) regioes = IBGE.formatar(regioes) resposta = RestClient.get("#{BASE_URL}/regioes/#{regioes}") tratar_retorno(resposta) end |