Class: Minfraud::Components::ShoppingCartItem
- Defined in:
- lib/minfraud/components/shopping_cart_item.rb
Overview
ShoppingCartItem corresponds to objects in the shopping_cart object of a minFraud request.
Instance Attribute Summary collapse
-
#category ⇒ String?
The category of the item.
-
#item_id ⇒ String?
The internal ID of the item.
-
#price ⇒ Float?
The per-unit price of this item in the shopping cart.
-
#quantity ⇒ Integer?
The quantity of the item in the shopping cart.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ ShoppingCartItem
constructor
A new instance of ShoppingCartItem.
Methods inherited from Base
Constructor Details
#initialize(params = {}) ⇒ ShoppingCartItem
Returns a new instance of ShoppingCartItem.
41 42 43 44 45 46 47 48 |
# File 'lib/minfraud/components/shopping_cart_item.rb', line 41 def initialize(params = {}) @category = params[:category] @item_id = params[:item_id] @quantity = params[:quantity] @price = params[:price] validate end |
Instance Attribute Details
#category ⇒ String?
The category of the item. This can also be a hashed value; see link.
17 18 19 |
# File 'lib/minfraud/components/shopping_cart_item.rb', line 17 def category @category end |
#item_id ⇒ String?
The internal ID of the item. This can also be a hashed value; see link.
24 25 26 |
# File 'lib/minfraud/components/shopping_cart_item.rb', line 24 def item_id @item_id end |
#price ⇒ Float?
The per-unit price of this item in the shopping cart. This should use the same currency as the order currency. The value must be at least 0 and at most 1e14 - 1.
37 38 39 |
# File 'lib/minfraud/components/shopping_cart_item.rb', line 37 def price @price end |
#quantity ⇒ Integer?
The quantity of the item in the shopping cart. The value must be at least 0, at most 10^13-1, and have no fractional part.
30 31 32 |
# File 'lib/minfraud/components/shopping_cart_item.rb', line 30 def quantity @quantity end |