Class: EwayRapid::Message::Convert::ShippingDetailsToAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/message/convert/shipping_details_to_address.rb

Instance Method Summary collapse

Instance Method Details

#do_convert(detail) ⇒ InternalModels::ShippingAddress



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/eway_rapid/message/convert/shipping_details_to_address.rb', line 8

def do_convert(detail)
  address = InternalModels::ShippingAddress.new

  if detail
    # @type [InternalModels::ShippingAddress]
    add = detail.shipping_address

    if add
      address.city = add.city
      address.country = add.country
      address.state = add.state
      address.street1 = add.street1
      address.street2 = add.street2
      address.postal_code = add.postal_code
    end

    address.first_name = detail.first_name
    address.last_name = detail.last_name
    address.phone = detail.phone
    address.fax = detail.fax
    address.shipping_method = detail.shipping_method || ''
  end
  address
end