Class: Minfraud::Components::ShoppingCartItem

Inherits:
Base
  • Object
show all
Defined in:
lib/minfraud/components/shopping_cart_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_json

Constructor Details

#initialize(params = {}) ⇒ Minfraud::Components::ShoppingCartItem

Creates Minfraud::Components::ShoppingCartItem instance

Parameters:

  • params (Hash) (defaults to: {})

    hash of parameters



23
24
25
26
27
28
# File 'lib/minfraud/components/shopping_cart_item.rb', line 23

def initialize(params = {})
  @category = params[:category]
  @item_id  = params[:item_id]
  @quantity = params[:quantity]
  @price    = params[:price]
end

Instance Attribute Details

#categoryString

Returns The category of the item.

Returns:

  • (String)

    The category of the item



6
7
8
# File 'lib/minfraud/components/shopping_cart_item.rb', line 6

def category
  @category
end

#item_idString

Returns The internal ID of the item.

Returns:

  • (String)

    The internal ID of the item



10
11
12
# File 'lib/minfraud/components/shopping_cart_item.rb', line 10

def item_id
  @item_id
end

#priceFloat

Returns The per-unit price of this item in the shopping cart. This should use the same currency as the order currency.

Returns:

  • (Float)

    The per-unit price of this item in the shopping cart. This should use the same currency as the order currency



18
19
20
# File 'lib/minfraud/components/shopping_cart_item.rb', line 18

def price
  @price
end

#quantityInteger

Returns The quantity of the item in the shopping cart.

Returns:

  • (Integer)

    The quantity of the item in the shopping cart



14
15
16
# File 'lib/minfraud/components/shopping_cart_item.rb', line 14

def quantity
  @quantity
end