Sha256: 230c81d6db2e180b69e0e132afb73cc93ef8a79cf64fcbb6f7e66e208009188b
Contents?: true
Size: 872 Bytes
Versions: 3
Compression:
Stored size: 872 Bytes
Contents
# frozen_string_literal: true module Brazil module Cep module Adapters # Viacep provider adapter class # This class is responsible for fetching the address information from the Viacep provider class Viacep < Base provider base_url: "https://viacep.com.br/ws/{{cep}}/json/" private def transformation! raise Brazil::Cep::ZipcodeNotFound, @response if @payload[:erro] == true address_params = { zipcode: @payload[:cep], state: @payload[:uf], city: @payload[:localidade], neighborhood: @payload[:bairro], street: @payload[:logradouro], complement: @payload[:complemento], meta: @payload.update(provider: :viacep) } Brazil::Cep::Address.new(**address_params) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
brazil-cep-0.5.0 | lib/brazil_cep/adapters/viacep.rb |
brazil-cep-0.4.0 | lib/brazil_cep/adapters/viacep.rb |
brazil-cep-0.3.0 | lib/brazil_cep/adapters/viacep.rb |