class Agris::Api::Inventory::DeliveryTicket

Constants

ATTRIBUTE_NAMES

Public Class Methods

from_xml_hash(hash) click to toggle source
Calls superclass method
# File lib/agris/api/inventory/delivery_ticket.rb, line 42
def self.from_xml_hash(hash)
  super.tap do |delivery_ticket|
    if hash['lineitems']
      delivery_ticket.line_items.concat(
        [hash['lineitems']['lineitem']]
        .flatten
        .map do |lineitem|
          DeliveryTicketLineItem.from_xml_hash(lineitem)
        end
      )
    end
    if hash['remarks']
      delivery_ticket.remarks.concat(
        [hash['remarks']['remark']]
        .flatten
        .map do |remark|
          Agris::Api::Remark.from_xml_hash(remark)
        end
      )
    end
    if hash['trancodes']
      delivery_ticket.tran_codes.concat(
        [hash['trancodes']['trancode']]
        .flatten
        .map do |trancode|
          Agris::Api::TranCode.from_xml_hash(trancode)
        end
      )
    end
  end
end
new(hash = {}) click to toggle source
Calls superclass method
# File lib/agris/api/inventory/delivery_ticket.rb, line 74
def initialize(hash = {})
  super

  @line_items = []
  @remarks = []
  @tran_codes = []
end