Module: SolidusShipstation::ExportHelper

Defined in:
app/helpers/solidus_shipstation/export_helper.rb

Constant Summary collapse

DATE_FORMAT =
'%m/%d/%Y %H:%M'

Class Method Summary collapse

Class Method Details

.address(xml, order, type) ⇒ Object

rubocop:disable all



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/solidus_shipstation/export_helper.rb', line 10

def self.address(xml, order, type)
  name = "#{type.to_s.titleize}To"
  address = order.send("#{type}_address")

  xml.__send__(name) {
    xml.Name         address.respond_to?(:name) ? address.name : address.full_name
    xml.Company      address.company

    if type == :ship
      xml.Address1   address.address1
      xml.Address2   address.address2
      xml.City       address.city
      xml.State      address.state ? address.state.abbr : address.state_name
      xml.PostalCode address.zipcode
      xml.Country    address.country.iso
    end

    xml.Phone        address.phone
  }
end