lib/brazil_cep/adapters/viacep.rb in brazil-cep-0.2.0 vs lib/brazil_cep/adapters/viacep.rb in brazil-cep-0.3.0
- old
+ new
@@ -9,17 +9,19 @@
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: :postmon)
+ meta: @payload.update(provider: :viacep)
}
Brazil::Cep::Address.new(**address_params)
end
end