Class: MessageQuickly::Messaging::Message
- Inherits:
-
Object
- Object
- MessageQuickly::Messaging::Message
- Defined in:
- lib/message_quickly/messaging/message.rb
Instance Attribute Summary collapse
-
#attachment ⇒ Object
Returns the value of attribute attachment.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #build_attachment(attachment_type) {|attachment| ... } ⇒ Object
-
#initialize(options = {}) {|_self| ... } ⇒ Message
constructor
A new instance of Message.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Message
Returns a new instance of Message.
7 8 9 10 |
# File 'lib/message_quickly/messaging/message.rb', line 7 def initialize( = {}) .each { |key, value| instance_variable_set("@#{key}", value) } yield self if block_given? end |
Instance Attribute Details
#attachment ⇒ Object
Returns the value of attribute attachment.
5 6 7 |
# File 'lib/message_quickly/messaging/message.rb', line 5 def @attachment end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/message_quickly/messaging/message.rb', line 5 def text @text end |
Instance Method Details
#build_attachment(attachment_type) {|attachment| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/message_quickly/messaging/message.rb', line 12 def () case when :image self. = MessageQuickly::Messaging::ImageAttachment.new when :generic_template self. = MessageQuickly::Messaging::GenericTemplateAttachment.new when :button_template self. = MessageQuickly::Messaging::ButtonTemplateAttachment.new when :receipt_template self. = MessageQuickly::Messaging::ReceiptTemplateAttachment.new end yield if block_given? end |
#to_hash ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/message_quickly/messaging/message.rb', line 26 def to_hash if { attachment: .to_hash } else { text: text } end end |