class Dpd::Shipping::Request

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/dpd_shipping/request.rb, line 5
def initialize(attributes = {})
  @version = attributes[:version]
  @auth = attributes[:auth]
end

Public Instance Methods

body() click to toggle source
# File lib/dpd_shipping/request.rb, line 10
def body
  # void
end
build!() click to toggle source
# File lib/dpd_shipping/request.rb, line 14
def build!
  builder = Builder::XmlMarkup.new
  builder.tns self.class::REQUEST_TYPE do |xml|
    xml.tns :Version, @version
    add_auth_to_xml(xml)
    body(xml)
  end

  builder.target!
end

Protected Instance Methods

add_auth_to_xml(xml) click to toggle source
# File lib/dpd_shipping/request.rb, line 27
def add_auth_to_xml(xml)
  xml.tns :PartnerCredentials do |pc|
    pc.tns :PartnerName, @auth[:partner][:name]
    pc.tns :PartnerKey, @auth[:partner][:key]
  end
  xml.tns :UserCredentials do |uc|
    uc.tns :UserID, @auth[:user][:id]
    uc.tns :UserToken, @auth[:user][:token]
  end
end