Class: InstacartApi::Cart::LineItem
- Inherits:
-
Object
- Object
- InstacartApi::Cart::LineItem
- Defined in:
- lib/instacart_api/models/cart.rb
Overview
A single line in the cart.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#quantity_type ⇒ Object
readonly
Returns the value of attribute quantity_type.
Instance Method Summary collapse
-
#initialize(data) ⇒ LineItem
constructor
A new instance of LineItem.
Constructor Details
#initialize(data) ⇒ LineItem
Returns a new instance of LineItem.
11 12 13 14 15 16 17 18 |
# File 'lib/instacart_api/models/cart.rb', line 11 def initialize(data) @id = data["id"] basket_product = data["basketProduct"] || {} @item_id = basket_product["id"] @product_id = basket_product["productId"] @quantity = data["quantity"] @quantity_type = data["quantityType"] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/instacart_api/models/cart.rb', line 9 def id @id end |
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
9 10 11 |
# File 'lib/instacart_api/models/cart.rb', line 9 def item_id @item_id end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
9 10 11 |
# File 'lib/instacart_api/models/cart.rb', line 9 def product_id @product_id end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
9 10 11 |
# File 'lib/instacart_api/models/cart.rb', line 9 def quantity @quantity end |
#quantity_type ⇒ Object (readonly)
Returns the value of attribute quantity_type.
9 10 11 |
# File 'lib/instacart_api/models/cart.rb', line 9 def quantity_type @quantity_type end |