class Dhl::Bcs::V2::Shipper

Constants

PROPERTIES

Public Class Methods

build(company: nil, **attributes) click to toggle source
# File lib/dhl/bcs/v2/shipper.rb, line 8
def self.build(company: nil, **attributes)
  address = Address.build(attributes)
  communication = Communication.build(attributes)
  new(attributes.merge(address: address, communication: communication, company: company))
end
new(**attributes) click to toggle source
# File lib/dhl/bcs/v2/shipper.rb, line 14
def initialize(**attributes)
  attributes.each do |property, value|
    send("#{property}=", value) if PROPERTIES.include?(property)
  end
end

Public Instance Methods

to_soap_hash() click to toggle source
# File lib/dhl/bcs/v2/shipper.rb, line 20
def to_soap_hash
  {
    'Name' => { 'cis:name1' => name }.tap { |h|
      h['cis:name2'] = company if company
      h['cis:name3'] = company_addition if company_addition
    },
    'Address' => address.to_soap_hash,
    'Communication' => communication.to_soap_hash
  }
end