class Dpd::Shipping::OrderRequest

Constants

REQUEST_TYPE

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method
# File lib/dpd_shipping/order_request.rb, line 7
def initialize(attributes = {})
  super(attributes)
  @shipping_date = attributes[:shipping_date]
  @parcels = attributes[:parcels]
end

Public Instance Methods

body(xml) click to toggle source
# File lib/dpd_shipping/order_request.rb, line 13
def body(xml)
  xml.tns :OrderAction, "addOrder"
  xml.tns :ServiceSettings do |xml|
    xml.tns :ErrorLanguage, "German" # TODO: make configurable
    xml.tns :CountrySettings, "ISO3166"
    xml.tns :ZipCodeSetting, "ZipCodeAsSingleValue"
  end
  xml.tns :OrderLabel do |xml|
    xml.tns :LabelSize, "MultiLabel_A4" # TODO: make configurable
    xml.tns :LabelStartPosition, "UpperLeft"
  end
  xml.tns :ShipDate, @shipping_date.strftime("%d.%m.%Y")
  xml.tns :ppvOrderDataArray do |xml|
    @parcels.each do |parcel|
      parcel.append_to_xml(xml)
    end
  end
end