Class: IbgeLocalidades::Estado
- Inherits:
-
Object
- Object
- IbgeLocalidades::Estado
- Extended by:
- IbgeLocalidades
- Defined in:
- lib/ibge_localidades/estado.rb
Constant Summary collapse
- PATH =
"/estados/"
Constants included from IbgeLocalidades
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#nome ⇒ Object
readonly
Returns the value of attribute nome.
-
#regiao ⇒ Object
readonly
Returns the value of attribute regiao.
-
#sigla ⇒ Object
readonly
Returns the value of attribute sigla.
Instance Method Summary collapse
- #cidades ⇒ Object
-
#initialize(params = {}) ⇒ Estado
constructor
A new instance of Estado.
- #mesorregioes ⇒ Object
- #microrregioes ⇒ Object
Methods included from IbgeLocalidades
as_objects, buscar_por_relacionamento, find_by_id, get, listar
Constructor Details
#initialize(params = {}) ⇒ Estado
Returns a new instance of Estado.
11 12 13 14 15 16 |
# File 'lib/ibge_localidades/estado.rb', line 11 def initialize(params={}) @id = params["id"] @nome = params["nome"] @sigla = params["sigla"] @regiao = ::IbgeLocalidades::Regiao.new(params["regiao"]) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/ibge_localidades/estado.rb', line 5 def id @id end |
#nome ⇒ Object (readonly)
Returns the value of attribute nome.
5 6 7 |
# File 'lib/ibge_localidades/estado.rb', line 5 def nome @nome end |
#regiao ⇒ Object (readonly)
Returns the value of attribute regiao.
5 6 7 |
# File 'lib/ibge_localidades/estado.rb', line 5 def regiao @regiao end |
#sigla ⇒ Object (readonly)
Returns the value of attribute sigla.
5 6 7 |
# File 'lib/ibge_localidades/estado.rb', line 5 def sigla @sigla end |
Instance Method Details
#cidades ⇒ Object
18 19 20 |
# File 'lib/ibge_localidades/estado.rb', line 18 def cidades ::IbgeLocalidades::Cidade.listar_por_estado(id) end |
#mesorregioes ⇒ Object
21 22 23 |
# File 'lib/ibge_localidades/estado.rb', line 21 def mesorregioes ::IbgeLocalidades::Mesorregiao.listar_por_estado(id) end |
#microrregioes ⇒ Object
24 25 26 |
# File 'lib/ibge_localidades/estado.rb', line 24 def microrregioes ::IbgeLocalidades::Microrregiao.listar_por_estado(id) end |