Class: SpreeAdyen::AddressPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/spree_adyen/address_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ AddressPresenter

Returns a new instance of AddressPresenter.



3
4
5
# File 'app/presenters/spree_adyen/address_presenter.rb', line 3

def initialize(address)
  @address = address
end

Instance Method Details

#to_hObject



7
8
9
10
11
12
13
14
15
# File 'app/presenters/spree_adyen/address_presenter.rb', line 7

def to_h
  {
    city: address['citystring'],
    country: Spree::Country.find_by(name: address['countrystring']),
    zipcode: address['postalCodestring'],
    address1: address['streetstring'],
    address2: address['houseNumberOrNamestring']
  }
end