Class: AuthorizeNet::Order
- Inherits:
-
Object
- Object
- AuthorizeNet::Order
- Includes:
- Model
- Defined in:
- lib/authorize_net/order.rb
Overview
Models an order.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#duty ⇒ Object
Returns the value of attribute duty.
-
#duty_description ⇒ Object
Returns the value of attribute duty_description.
-
#duty_name ⇒ Object
Returns the value of attribute duty_name.
-
#freight ⇒ Object
Returns the value of attribute freight.
-
#freight_description ⇒ Object
Returns the value of attribute freight_description.
-
#freight_name ⇒ Object
Returns the value of attribute freight_name.
-
#invoice_num ⇒ Object
Returns the value of attribute invoice_num.
-
#line_items ⇒ Object
Returns the value of attribute line_items.
-
#po_num ⇒ Object
Returns the value of attribute po_num.
-
#tax ⇒ Object
Returns the value of attribute tax.
-
#tax_description ⇒ Object
Returns the value of attribute tax_description.
-
#tax_exempt ⇒ Object
Returns the value of attribute tax_exempt.
-
#tax_name ⇒ Object
Returns the value of attribute tax_name.
Instance Method Summary collapse
- #add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil) ⇒ Object
- #to_hash ⇒ Object
Methods included from Model
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def description @description end |
#duty ⇒ Object
Returns the value of attribute duty.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def duty @duty end |
#duty_description ⇒ Object
Returns the value of attribute duty_description.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def duty_description @duty_description end |
#duty_name ⇒ Object
Returns the value of attribute duty_name.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def duty_name @duty_name end |
#freight ⇒ Object
Returns the value of attribute freight.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def freight @freight end |
#freight_description ⇒ Object
Returns the value of attribute freight_description.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def freight_description @freight_description end |
#freight_name ⇒ Object
Returns the value of attribute freight_name.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def freight_name @freight_name end |
#invoice_num ⇒ Object
Returns the value of attribute invoice_num.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def invoice_num @invoice_num end |
#line_items ⇒ Object
Returns the value of attribute line_items.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def line_items @line_items end |
#po_num ⇒ Object
Returns the value of attribute po_num.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def po_num @po_num end |
#tax ⇒ Object
Returns the value of attribute tax.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def tax @tax end |
#tax_description ⇒ Object
Returns the value of attribute tax_description.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def tax_description @tax_description end |
#tax_exempt ⇒ Object
Returns the value of attribute tax_exempt.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def tax_exempt @tax_exempt end |
#tax_name ⇒ Object
Returns the value of attribute tax_name.
8 9 10 |
# File 'lib/authorize_net/order.rb', line 8 def tax_name @tax_name end |
Instance Method Details
#add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil) ⇒ Object
10 11 12 13 14 15 16 17 |
# 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 ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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 |