Class: TaxCloud::CartItem
- Inherits:
-
Object
- Object
- TaxCloud::CartItem
- Defined in:
- lib/tax_cloud/cart_item.rb
Overview
A CartItem
defines a single line item for the purchase. Used to calculate the tax amount.
Attributes
-
index
- The unique index number for the line item. Must be unique for the scope of the cart. -
item_id
- The stock keeping unit (SKU) number -
tic
- The taxable information code. SeeTaxCloud::TaxCodes
. -
price
- The price of the item. All prices are USD. Do not include currency symbol. -
quantity
- The total number of items.
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#item_id ⇒ Object
Returns the value of attribute item_id.
-
#price ⇒ Object
Returns the value of attribute price.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#tic ⇒ Object
Returns the value of attribute tic.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ CartItem
constructor
A new instance of CartItem.
-
#to_hash ⇒ Object
Convert the object to a usable hash for SOAP requests.
Constructor Details
#initialize(attrs = {}) ⇒ CartItem
Returns a new instance of CartItem.
15 16 17 18 19 20 |
# File 'lib/tax_cloud/cart_item.rb', line 15 def initialize(attrs = {}) attrs.each do |sym, val| self.send "#{sym}=", val end super end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
13 14 15 |
# File 'lib/tax_cloud/cart_item.rb', line 13 def index @index end |
#item_id ⇒ Object
Returns the value of attribute item_id.
13 14 15 |
# File 'lib/tax_cloud/cart_item.rb', line 13 def item_id @item_id end |
#price ⇒ Object
Returns the value of attribute price.
13 14 15 |
# File 'lib/tax_cloud/cart_item.rb', line 13 def price @price end |
#quantity ⇒ Object
Returns the value of attribute quantity.
13 14 15 |
# File 'lib/tax_cloud/cart_item.rb', line 13 def quantity @quantity end |
#tic ⇒ Object
Returns the value of attribute tic.
13 14 15 |
# File 'lib/tax_cloud/cart_item.rb', line 13 def tic @tic end |
Instance Method Details
#to_hash ⇒ Object
Convert the object to a usable hash for SOAP requests
23 24 25 26 27 28 29 30 31 |
# File 'lib/tax_cloud/cart_item.rb', line 23 def to_hash { 'Index' => index, 'ItemID' => item_id, 'TIC' => tic, 'Price' => price, 'Qty' => quantity } end |