Class: IbgeLocalidades::Regiao

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

Constant Summary collapse

PATH =
"/regioes/"

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 = {}) ⇒ Regiao

Returns a new instance of Regiao.



9
10
11
12
13
# File 'lib/ibge_localidades/regiao.rb', line 9

def initialize(params={})
  @id       = params["id"]
  @nome     = params["nome"]
  @sigla    = params["sigla"]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nomeObject (readonly)

Returns the value of attribute nome.



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

def nome
  @nome
end

#siglaObject (readonly)

Returns the value of attribute sigla.



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

def sigla
  @sigla
end

Instance Method Details

#cidadesObject



15
16
17
# File 'lib/ibge_localidades/regiao.rb', line 15

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

#estadosObject



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

def estados
  ::IbgeLocalidades::Estado.listar_por_regiao(id)
end

#mesorregioesObject



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

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

#microrregioesObject



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

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