Class: MessageQuickly::Messaging::GenericTemplateAttachment
- Inherits:
-
TemplateAttachment
- Object
- Base
- Attachment
- TemplateAttachment
- MessageQuickly::Messaging::GenericTemplateAttachment
- Defined in:
- lib/message_quickly/messaging/generic_template_attachment.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from TemplateAttachment
Attributes inherited from Attachment
Instance Method Summary collapse
- #build_element ⇒ Object
-
#initialize(params = {}) ⇒ GenericTemplateAttachment
constructor
A new instance of GenericTemplateAttachment.
- #to_hash ⇒ Object
Methods inherited from Attachment
Constructor Details
#initialize(params = {}) ⇒ GenericTemplateAttachment
Returns a new instance of GenericTemplateAttachment.
7 8 9 10 11 |
# File 'lib/message_quickly/messaging/generic_template_attachment.rb', line 7 def initialize(params = {}) self.elements ||= [] params['template_type'] ||= 'generic' super(params) end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
5 6 7 |
# File 'lib/message_quickly/messaging/generic_template_attachment.rb', line 5 def elements @elements end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/message_quickly/messaging/generic_template_attachment.rb', line 5 def text @text end |
Instance Method Details
#build_element ⇒ Object
13 14 15 |
# File 'lib/message_quickly/messaging/generic_template_attachment.rb', line 13 def build_element elements << Element.new.tap { |element| yield element } end |
#to_hash ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/message_quickly/messaging/generic_template_attachment.rb', line 17 def to_hash { type: type, payload: { template_type: template_type, elements: elements.collect { |element| element.to_hash } } } end |