Class: IbgeLocalidades::Microrregiao

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

Constant Summary collapse

PATH =
"/microrregioes/"

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

Returns a new instance of Microrregiao.



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

def initialize(params={})
  @id            = params["id"]
  @nome          = params["nome"]
  @mesorregiao   = ::IbgeLocalidades::Mesorregiao.new(params["mesorregiao"])
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#mesorregiaoObject (readonly)

Returns the value of attribute mesorregiao.



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

def mesorregiao
  @mesorregiao
end

#nomeObject (readonly)

Returns the value of attribute nome.



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

def nome
  @nome
end

Instance Method Details

#cidadesObject



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

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