class AuthorizeNet::Order

Models an order.

Attributes

description[RW]
duty[RW]
duty_description[RW]
duty_name[RW]
freight[RW]
freight_description[RW]
freight_name[RW]
invoice_num[RW]
line_items[RW]
po_num[RW]
tax[RW]
tax_description[RW]
tax_exempt[RW]
tax_name[RW]

Public Instance Methods

add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil) click to toggle source
# File lib/authorize_net/order.rb, line 10
def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil)
  if id.kind_of?(AuthorizeNet::LineItem)
    line_item = id
  else
    line_item = AuthorizeNet::LineItem.new({:id => id, :name => name, :description => description, :quantity => quantity, :price => price, :taxable => taxable})
  end
  @line_items = @line_items.to_a << line_item
end
to_hash() click to toggle source
# File lib/authorize_net/order.rb, line 19
def to_hash
  hash = {
    :invoice_num => @invoice_num,
    :description => @description,
    :tax => @tax,
    :tax_name => @tax_name,
    :tax_description => @tax_description,
    :freight => @freight,
    :freight_name => @freight_name,
    :freight_description => @freight_description,
    :duty => @duty,
    :duty_name => @duty_name,
    :duty_description => @duty_description,
    :tax_exempt => @tax_exempt,
    :po_num => @po_num,
    :line_items => handle_multivalue_hashing(@line_items)
  }
  hash.delete_if {|k, v| v.nil?}
  hash
end