Class: IBGE::Pais
- Inherits:
-
Object
- Object
- IBGE::Pais
- Defined in:
- lib/ibge/pais.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#nome ⇒ Object
Returns the value of attribute nome.
-
#regiao_intermediaria ⇒ Object
Returns the value of attribute regiao_intermediaria.
-
#sub_regiao ⇒ Object
Returns the value of attribute sub_regiao.
Class Method Summary collapse
-
.obter_paises ⇒ Array<Pais>
Obtém o conjunto de países.
-
.paises_por_identificador(paises) ⇒ Array<Pais>
Obtém o conjunto de países a partir dos respectivos identificadores.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Pais
constructor
A new instance of Pais.
Constructor Details
#initialize(options = {}) ⇒ Pais
Returns a new instance of Pais.
5 6 7 8 9 10 |
# File 'lib/ibge/pais.rb', line 5 def initialize( = {}) @id = ['id'] @nome = ['nome'] @regiao_intermediaria = ['regiao-intermediaria'] @sub_regiao = ['sub-regiao'] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ibge/pais.rb', line 3 def id @id end |
#nome ⇒ Object
Returns the value of attribute nome.
3 4 5 |
# File 'lib/ibge/pais.rb', line 3 def nome @nome end |
#regiao_intermediaria ⇒ Object
Returns the value of attribute regiao_intermediaria.
3 4 5 |
# File 'lib/ibge/pais.rb', line 3 def regiao_intermediaria @regiao_intermediaria end |
#sub_regiao ⇒ Object
Returns the value of attribute sub_regiao.
3 4 5 |
# File 'lib/ibge/pais.rb', line 3 def sub_regiao @sub_regiao end |
Class Method Details
.obter_paises ⇒ Array<Pais>
Obtém o conjunto de países.
20 21 22 23 24 |
# File 'lib/ibge/pais.rb', line 20 def self.obter_paises resposta = RestClient.get("#{BASE_URL}/paises") tratar_retorno(resposta) end |
.paises_por_identificador(paises) ⇒ Array<Pais>
Obtém o conjunto de países a partir dos respectivos identificadores. Pode ser informado o identificador (ID) ou um array de identificadores.
38 39 40 41 42 43 |
# File 'lib/ibge/pais.rb', line 38 def self.paises_por_identificador(paises) paises = IBGE.formatar(paises) resposta = RestClient.get("#{BASE_URL}/paises/#{paises}") tratar_retorno(resposta) end |