Sha256: 9d6e608d8e1d8809f20f875f337691ffc76bb59b4bf6483817e4cf32811ffb32
Contents?: true
Size: 450 Bytes
Versions: 2
Compression:
Stored size: 450 Bytes
Contents
module GoMaps class CEP def initialize(cep) @response = Nokogiri::XML(open("http://www.buscarcep.com.br?formato=xml&cep=#{cep}")) raise GoMaps::AddressNotFoundException if element('resultado') != '1' end def street "#{element('tipo_logradouro')} #{element('logradouro')}" end def city element('cidade') end private def element(name) @response.css(name).inner_text end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
go_maps-0.3.1 | lib/go_maps/cep.rb |
go_maps-0.3.0 | lib/go_maps/cep.rb |