Class: GoMaps::CEP
- Inherits:
-
Object
- Object
- GoMaps::CEP
- Defined in:
- lib/go_maps/cep.rb
Instance Method Summary collapse
- #city ⇒ Object
-
#initialize(cep) ⇒ CEP
constructor
A new instance of CEP.
- #street ⇒ Object
- #uf ⇒ Object
Constructor Details
#initialize(cep) ⇒ CEP
Returns a new instance of CEP.
3 4 5 6 |
# File 'lib/go_maps/cep.rb', line 3 def initialize(cep) @response = Nokogiri::XML(open("http://cep.republicavirtual.com.br/web_cep.php?cep=#{cep}")) raise GoMaps::AddressNotFoundException if element('resultado') == "0" end |
Instance Method Details
#city ⇒ Object
12 13 14 |
# File 'lib/go_maps/cep.rb', line 12 def city element 'cidade' end |
#street ⇒ Object
8 9 10 |
# File 'lib/go_maps/cep.rb', line 8 def street "#{element('tipo_logradouro')} #{element('logradouro')}" end |
#uf ⇒ Object
16 17 18 |
# File 'lib/go_maps/cep.rb', line 16 def uf element 'uf' end |