Sha256: 0aed11075778220b52c947b45f8e782d7ebe94d11a0156df638c6d20a67b896e
Contents?: true
Size: 629 Bytes
Versions: 1
Compression:
Stored size: 629 Bytes
Contents
require 'service' module ViaCep class Address attr_reader :cep, :address, :neighborhood, :city, :state, :ibge, :gia def initialize(cep, options = {}) cep = cep.to_s.delete('^0-9') response = Service.fetch cep, options[:timeout] fill_from response end private def fill_from(response) @cep = response['cep'] @address = response['logradouro'] @neighborhood = response['bairro'] @city = response['localidade'] @state = response['uf'] @ibge = response['ibge'] @gia = response['gia'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
viacep-2.0.0 | lib/viacep.rb |