Class: TaxCloud::CartItem

Inherits:
Record
  • Object
show all
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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Record

#initialize

Constructor Details

This class inherits a constructor from TaxCloud::Record

Instance Attribute Details

#indexObject

The unique index number for the line item. Must be unique for the scope of the cart.



5
6
7
# File 'lib/tax_cloud/cart_item.rb', line 5

def index
  @index
end

#item_idObject

The stock keeping unit (SKU) number.



7
8
9
# File 'lib/tax_cloud/cart_item.rb', line 7

def item_id
  @item_id
end

#priceObject

The price of the item. All prices are USD. Do not include currency symbol.



11
12
13
# File 'lib/tax_cloud/cart_item.rb', line 11

def price
  @price
end

#quantityObject

The total number of items.



13
14
15
# File 'lib/tax_cloud/cart_item.rb', line 13

def quantity
  @quantity
end

#ticObject

The taxable information code. See TaxCloud::TaxCodes.



9
10
11
# File 'lib/tax_cloud/cart_item.rb', line 9

def tic
  @tic
end

Instance Method Details

#to_hashObject

Convert the object to a usable hash for SOAP requests.



16
17
18
19
20
21
22
23
24
# File 'lib/tax_cloud/cart_item.rb', line 16

def to_hash
  {
    'Index' => index,
    'ItemID' => item_id,
    'TIC' => tic,
    'Price' => price,
    'Qty' => quantity
  }
end