Class: MessageQuickly::Messaging::ReceiptTemplateAttachment
- Inherits:
-
TemplateAttachment
- Object
- Base
- Attachment
- TemplateAttachment
- MessageQuickly::Messaging::ReceiptTemplateAttachment
- Defined in:
- lib/message_quickly/messaging/receipt_template_attachment.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#adjustments ⇒ Object
Returns the value of attribute adjustments.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#order_number ⇒ Object
Returns the value of attribute order_number.
-
#order_url ⇒ Object
Returns the value of attribute order_url.
-
#payment_method ⇒ Object
Returns the value of attribute payment_method.
-
#recipient_name ⇒ Object
Returns the value of attribute recipient_name.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Attributes inherited from TemplateAttachment
Attributes inherited from Attachment
Instance Method Summary collapse
- #build_address {|address| ... } ⇒ Object
- #build_adjustment ⇒ Object
- #build_element ⇒ Object
- #build_summary {|summary| ... } ⇒ Object
-
#initialize(params = {}) ⇒ ReceiptTemplateAttachment
constructor
A new instance of ReceiptTemplateAttachment.
- #to_hash ⇒ Object
Methods inherited from Attachment
Constructor Details
#initialize(params = {}) ⇒ ReceiptTemplateAttachment
Returns a new instance of ReceiptTemplateAttachment.
7 8 9 10 11 12 13 14 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 7 def initialize(params = {}) self.elements ||= [] self.address ||= Receipt::Address.new self.summary ||= Receipt::Summary.new self.adjustments ||= [] params['template_type'] ||= 'receipt' super(params) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def address @address end |
#adjustments ⇒ Object
Returns the value of attribute adjustments.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def adjustments @adjustments end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def currency @currency end |
#elements ⇒ Object
Returns the value of attribute elements.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def elements @elements end |
#order_number ⇒ Object
Returns the value of attribute order_number.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def order_number @order_number end |
#order_url ⇒ Object
Returns the value of attribute order_url.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def order_url @order_url end |
#payment_method ⇒ Object
Returns the value of attribute payment_method.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def payment_method @payment_method end |
#recipient_name ⇒ Object
Returns the value of attribute recipient_name.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def recipient_name @recipient_name end |
#summary ⇒ Object
Returns the value of attribute summary.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def summary @summary end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 5 def @timestamp end |
Instance Method Details
#build_address {|address| ... } ⇒ Object
20 21 22 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 20 def build_address yield address end |
#build_adjustment ⇒ Object
28 29 30 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 28 def build_adjustment adjustments << Receipt::Adjustment.new.tap { |adjustment| yield adjustment } end |
#build_element ⇒ Object
16 17 18 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 16 def build_element elements << Receipt::Element.new.tap { |element| yield element } end |
#build_summary {|summary| ... } ⇒ Object
24 25 26 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 24 def build_summary yield summary end |
#to_hash ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/message_quickly/messaging/receipt_template_attachment.rb', line 32 def to_hash { type: type, payload: { template_type: template_type, recipient_name: recipient_name, order_number: order_number, currency: currency, payment_method: payment_method, order_url: order_url, timestamp: , elements: elements.collect { |element| element.to_hash }, address: address.to_hash, summary: summary.to_hash, adjustments: adjustments.collect { |adjustment| adjustment.to_hash } } } end |