Skip to content

Commit

Permalink
feat: change cep word by zipcode
Browse files Browse the repository at this point in the history
  • Loading branch information
dvinciguerra committed Mar 27, 2024
1 parent cc50fe1 commit 5276213
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/brazil_cep/adapters/postmon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Postmon < Base

def transformation!
address_params = {
cep: @payload[:cep],
zipcode: @payload[:cep],
state: @payload[:estado],
city: @payload[:cidade],
neighborhood: @payload[:bairro],
Expand Down
2 changes: 1 addition & 1 deletion lib/brazil_cep/adapters/republica_virtual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RepublicaVirtual < Base

def transformation!
address_params = {
cep: @cep,
zipcode: @cep,
state: @payload[:uf],
city: @payload[:cidade],
neighborhood: @payload[:bairro],
Expand Down
2 changes: 1 addition & 1 deletion lib/brazil_cep/adapters/viacep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Viacep < Base

def transformation!
address_params = {
cep: @payload[:cep],
zipcode: @payload[:cep],
state: @payload[:uf],
city: @payload[:localidade],
neighborhood: @payload[:bairro],
Expand Down
4 changes: 2 additions & 2 deletions lib/brazil_cep/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module Brazil
module Cep
# Address class
class Address
attr_reader :cep, :state, :city, :neighborhood, :street, :complement, :meta
attr_reader :zipcode, :state, :city, :neighborhood, :street, :complement, :meta

def initialize(**arguments)
@cep = arguments[:cep]
@zipcode = arguments[:zipcode]
@state = arguments[:state]
@city = arguments[:city]
@neighborhood = arguments[:neighborhood]
Expand Down
6 changes: 4 additions & 2 deletions spec/brazil_cep/address_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

require "spec_helper"

RSpec.describe Brazil::Cep::Address do
subject(:address) { described_class.new(**address_params) }

let(:address_params) do
{
cep: "01311-100",
zipcode: "01311-100",
street: "Avenida Paulista",
state: "SP",
city: "São Paulo",
Expand All @@ -27,7 +29,7 @@
}
end

it { expect(address.cep).to eq("01311-100") }
it { expect(address.zipcode).to eq("01311-100") }
it { expect(address.street).to eq("Avenida Paulista") }
it { expect(address.state).to eq("SP") }
it { expect(address.city).to eq("São Paulo") }
Expand Down

0 comments on commit 5276213

Please sign in to comment.