Class: IbgeLocalidades::Mesorregiao

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

Constant Summary collapse

PATH =
"/mesorregioes/"

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

Returns a new instance of Mesorregiao.



11
12
13
14
15
# File 'lib/ibge_localidades/mesorregiao.rb', line 11

def initialize(params={})
  @id       = params["id"]
  @nome     = params["nome"]
  @estado   = ::IbgeLocalidades::Estado.new(params["UF"])
end

Instance Attribute Details

#estadoObject (readonly)

Returns the value of attribute estado.



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

def estado
  @estado
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nomeObject (readonly)

Returns the value of attribute nome.



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

def nome
  @nome
end

Instance Method Details

#cidadesObject



17
18
19
# File 'lib/ibge_localidades/mesorregiao.rb', line 17

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

#microrregioesObject



20
21
22
# File 'lib/ibge_localidades/mesorregiao.rb', line 20

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