Class: Yukon::Cart
- Inherits:
-
Object
- Object
- Yukon::Cart
- Defined in:
- lib/yukon/cart.rb
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(product) ⇒ Cart
constructor
A new instance of Cart.
- #total_amount ⇒ Object
Constructor Details
#initialize(product) ⇒ Cart
Returns a new instance of Cart.
4 5 6 |
# File 'lib/yukon/cart.rb', line 4 def initialize(product) @product = product end |
Instance Method Details
#contents ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/yukon/cart.rb', line 12 def contents { items: [ { name: @product.name, amount: @product.price_in_cents, quantity: 1, description: "Digital product purchase" } ] } end |
#total_amount ⇒ Object
8 9 10 |
# File 'lib/yukon/cart.rb', line 8 def total_amount contents[:items][0][:amount] end |