Sha256: 9d77c7cbb43393f05c91e199f094a06affa04ffe96ba7a70a0634a86a21612ec
Contents?: true
Size: 504 Bytes
Versions: 1
Compression:
Stored size: 504 Bytes
Contents
module GoMaps class CEP 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 def street "#{element('tipo_logradouro')} #{element('logradouro')}" end def city element 'cidade' end def uf element 'uf' end private def element(name) @response.xpath("//#{name}").inner_text end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
go_maps-0.4.2 | lib/go_maps/cep.rb |