class MessageQuickly::Messaging::Message
Attributes
attachment[RW]
quick_replies[RW]
text[RW]
Public Class Methods
new(options = {}) { |self| ... }
click to toggle source
# File lib/message_quickly/messaging/message.rb, line 7 def initialize(options = {}) options.each { |key, value| instance_variable_set("@#{key}", value) } yield self if block_given? end
Public Instance Methods
build_attachment(attachment_type) { |attachment| ... }
click to toggle source
# File lib/message_quickly/messaging/message.rb, line 12 def build_attachment(attachment_type) case attachment_type when :image self.attachment = MessageQuickly::Messaging::ImageAttachment.new when :audio self.attachment = MessageQuickly::Messaging::AudioAttachment.new when :video self.attachment = MessageQuickly::Messaging::VideoAttachment.new when :generic_template self.attachment = MessageQuickly::Messaging::GenericTemplateAttachment.new when :button_template self.attachment = MessageQuickly::Messaging::ButtonTemplateAttachment.new when :receipt_template self.attachment = MessageQuickly::Messaging::ReceiptTemplateAttachment.new end yield attachment if block_given? end
build_quick_reply() { |new_quick_reply| ... }
click to toggle source
# File lib/message_quickly/messaging/message.rb, line 30 def build_quick_reply @quick_replies ||= [] new_quick_reply = MessageQuickly::Messaging::QuickReply.new quick_replies << new_quick_reply yield new_quick_reply end
to_hash()
click to toggle source
# File lib/message_quickly/messaging/message.rb, line 37 def to_hash if attachment hash_buffer = { attachment: attachment.to_hash } else hash_buffer = { text: text } end hash_buffer.merge!({ quick_replies: quick_replies.collect { |quick_reply| quick_reply.to_hash } }) if quick_replies.present? hash_buffer end