Class: Whatsapp::Webhook::Message::Order::ProductItem
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::Message::Order::ProductItem
- Defined in:
- lib/ruby/whatsapp/webhook/message/order/product_item.rb
Overview
A single line item within an inbound order message.
Instance Attribute Summary collapse
- #currency ⇒ String?
- #item_price ⇒ Float?
-
#product_retailer_id ⇒ String?
The catalog SKU.
- #quantity ⇒ Integer?
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(product_retailer_id:, quantity:, item_price:, currency:) ⇒ ProductItem
constructor
A new instance of ProductItem.
Constructor Details
#initialize(product_retailer_id:, quantity:, item_price:, currency:) ⇒ ProductItem
Returns a new instance of ProductItem.
25 26 27 28 29 30 |
# File 'lib/ruby/whatsapp/webhook/message/order/product_item.rb', line 25 def initialize(product_retailer_id:, quantity:, item_price:, currency:) @product_retailer_id = product_retailer_id @quantity = quantity @item_price = item_price @currency = currency end |
Instance Attribute Details
#currency ⇒ String?
23 24 25 |
# File 'lib/ruby/whatsapp/webhook/message/order/product_item.rb', line 23 def currency @currency end |
#item_price ⇒ Float?
19 20 21 |
# File 'lib/ruby/whatsapp/webhook/message/order/product_item.rb', line 19 def item_price @item_price end |
#product_retailer_id ⇒ String?
Returns The catalog SKU.
11 12 13 |
# File 'lib/ruby/whatsapp/webhook/message/order/product_item.rb', line 11 def product_retailer_id @product_retailer_id end |
#quantity ⇒ Integer?
15 16 17 |
# File 'lib/ruby/whatsapp/webhook/message/order/product_item.rb', line 15 def quantity @quantity end |
Class Method Details
.deserialize(data) ⇒ ProductItem
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ruby/whatsapp/webhook/message/order/product_item.rb', line 35 def deserialize(data) data ||= {} new( product_retailer_id: data["product_retailer_id"], quantity: data["quantity"], item_price: data["item_price"], currency: data["currency"] ) end |