class IngramMicro::StandardResponse

Constants

TRANSMISSION_FILENAME

Attributes

comments[RW]
filename[RW]
response_timestamp[RW]
status_code[RW]
status_description[RW]
transaction_name[RW]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method IngramMicro::Transmission::new
# File lib/ingram_micro/transmissions/standard_response.rb, line 7
def initialize(options={})
  super(options)
  @transaction_name = options[:transaction_name]
  @status_code = options[:status_code]
  @status_description = options[:status_description]
  @comments = options[:comments]
  @response_timestamp = options[:response_timestamp]
  @filename = options[:filename]
end

Public Instance Methods

add_message_header(builder) click to toggle source
# File lib/ingram_micro/transmissions/standard_response.rb, line 31
def add_message_header(builder)
  message_header = IngramMicro::MessageHeaderPW.new({
    partner_name: IngramMicro.configuration.partner_name,
    transaction_name: transaction_name})
  builder.send('message-header') do
    message_header.build(builder)
  end
  message_header.valid?
end
add_message_status(builder) click to toggle source
# File lib/ingram_micro/transmissions/standard_response.rb, line 41
def add_message_status(builder)
  message_status = IngramMicro::MessageStatus.new({
    status_code: @status_code,
    status_description: @status_description,
    comments: @comments,
    response_timestamp: @response_timestamp,
    filename: @filename
  })
  builder.send('message-status') do
    message_status.build(builder)
  end
end
to_xml(opts={}) click to toggle source
# File lib/ingram_micro/transmissions/standard_response.rb, line 17
def to_xml(opts={})
  xml_builder.to_xml
end
xml_builder() click to toggle source
# File lib/ingram_micro/transmissions/standard_response.rb, line 21
def xml_builder
  @builder ||= Nokogiri::XML::Builder.new do |builder|
    builder.message do
      add_message_header(builder)
      add_message_status(builder)
      add_transaction_info(builder)
    end
  end
end