Sha256: 7a31b1d1a77e95cc28ff2c17fb025685689d39d9d43c19ccb5b555357435ce59
Contents?: true
Size: 907 Bytes
Versions: 1
Compression:
Stored size: 907 Bytes
Contents
# frozen_string_literal: true module Brazil module Cep module Adapters # Cep Aberto provider adapter class # This class is responsible for fetching the address information from the Cep Aberto provider class CepAberto < Base provider base_url: "https://www.cepaberto.com/ceps/{{cep}}.json" private def transformation! raise Brazil::Cep::ZipcodeNotFound, @response if @payload[:erro] == true address_params = { zipcode: @payload[:cep], state: @payload[:estado][:sigla], city: @payload[:cidade][:nome], neighborhood: @payload[:bairro], street: @payload[:logradouro], complement: @payload[:complemento], meta: @payload.update(provider: :cep_aberto) } Brazil::Cep::Address.new(**address_params) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brazil-cep-0.5.0 | lib/brazil_cep/adapters/cep_aberto.rb |