Class: Messenger::Templates::Receipt
- Inherits:
-
Object
- Object
- Messenger::Templates::Receipt
- Includes:
- Components::Attachment
- Defined in:
- lib/messenger/components/templates/receipt.rb
Constant Summary collapse
- ATTRIBUTES =
%w( template_type recipient_name order_number currency payment_method timestamp order_url elements address summary adjustments ).freeze
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#adjustments ⇒ Object
Returns the value of attribute adjustments.
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#order ⇒ Object
Returns the value of attribute order.
-
#recipient_name ⇒ Object
Returns the value of attribute recipient_name.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#template_type ⇒ Object
Returns the value of attribute template_type.
Attributes included from Components::Attachment
Instance Method Summary collapse
- #flattened_attributes ⇒ Object
-
#initialize(recipient_name:, order:, elements:, address: nil, summary:, adjustments: nil) ⇒ Receipt
constructor
A new instance of Receipt.
Methods included from Components::Attachment
#all_attributes, #allowed_attribute?, #build, #build_elements, #payload
Constructor Details
#initialize(recipient_name:, order:, elements:, address: nil, summary:, adjustments: nil) ⇒ Receipt
Returns a new instance of Receipt.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/messenger/components/templates/receipt.rb', line 24 def initialize(recipient_name:, order:, elements:, address: nil, summary:, adjustments: nil) @type = 'template' @template_type = 'receipt' @recipient_name = recipient_name @order = order @elements = build_elements(elements) @address = address.build if address.present? @summary = summary.build @adjustments = build_elements(adjustments) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def address @address end |
#adjustments ⇒ Object
Returns the value of attribute adjustments.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def adjustments @adjustments end |
#elements ⇒ Object
Returns the value of attribute elements.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def elements @elements end |
#order ⇒ Object
Returns the value of attribute order.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def order @order end |
#recipient_name ⇒ Object
Returns the value of attribute recipient_name.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def recipient_name @recipient_name end |
#summary ⇒ Object
Returns the value of attribute summary.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def summary @summary end |
#template_type ⇒ Object
Returns the value of attribute template_type.
8 9 10 |
# File 'lib/messenger/components/templates/receipt.rb', line 8 def template_type @template_type end |
Instance Method Details
#flattened_attributes ⇒ Object
35 36 37 |
# File 'lib/messenger/components/templates/receipt.rb', line 35 def flattened_attributes @order.build end |