Class: IbgeLocalidades::Estado

Inherits:
Object
  • Object
show all
Extended by:
IbgeLocalidades
Defined in:
lib/ibge_localidades/estado.rb

Constant Summary collapse

PATH =
"/estados/"

Constants included from IbgeLocalidades

API_VERSION, MAIN_URL

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/ibge_localidades/estado.rb', line 5

def id
  @id
end

#nomeObject (readonly)

Returns the value of attribute nome.



5
6
7
# File 'lib/ibge_localidades/estado.rb', line 5

def nome
  @nome
end

#regiaoObject (readonly)

Returns the value of attribute regiao.



5
6
7
# File 'lib/ibge_localidades/estado.rb', line 5

def regiao
  @regiao
end

#siglaObject (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

#cidadesObject



18
19
20
# File 'lib/ibge_localidades/estado.rb', line 18

def cidades
  ::IbgeLocalidades::Cidade.listar_por_estado(id)
end

#mesorregioesObject



21
22
23
# File 'lib/ibge_localidades/estado.rb', line 21

def mesorregioes
  ::IbgeLocalidades::Mesorregiao.listar_por_estado(id)
end

#microrregioesObject



24
25
26
# File 'lib/ibge_localidades/estado.rb', line 24

def microrregioes
  ::IbgeLocalidades::Microrregiao.listar_por_estado(id)
end