class Fb::Messenger::Template::Receipt
Attributes
currency[RW]
order_number[RW]
order_url[RW]
payment_method[RW]
receipt_items[RW]
recipient_name[RW]
timestamp[RW]
total_cost[RW]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/fb/messenger/templates/receipt.rb, line 9 def initialize(opts = {}) @recipient_name = opts[:recipient_name] @order_number = opts[:order_number] @currency = opts[:currency] # payment_method field cannot be nil @payment_method = opts[:payment_method] || 'N/A' @order_url = opts[:order_url] @timestamp = opts[:timestamp] @total_cost = opts[:total_cost] @receipt_items = opts[:receipt_items] || [] end
Public Instance Methods
template()
click to toggle source
# File lib/fb/messenger/templates/receipt.rb, line 21 def template { attachment: { type: 'template', payload: { template_type: 'receipt', recipient_name: recipient_name, order_number: order_number, currency: currency, payment_method: payment_method, # required field order_url: order_url, timestamp: timestamp, elements: receipt_items.map(&:template), summary: { total_cost: total_cost } } } } end