class MessageQuickly::Messaging::Delivery

Attributes

id[RW]
message[RW]
notification_type[RW]
recipient[RW]

Public Class Methods

new(options = {}) { |self| ... } click to toggle source
# File lib/message_quickly/messaging/delivery.rb, line 8
def initialize(options = {})
  self.message ||= MessageQuickly::Messaging::Message.new
  options.each { |key, value| instance_variable_set("@#{key}", value) }
  yield self if block_given?
end

Public Instance Methods

build_message() { |message| ... } click to toggle source
# File lib/message_quickly/messaging/delivery.rb, line 14
def build_message
  yield self.message
end
to_hash() click to toggle source
# File lib/message_quickly/messaging/delivery.rb, line 18
def to_hash
  hash = {}
  hash.merge!(recipient: recipient.to_hash) if recipient
  hash.merge!(message: message.to_hash) if message
  hash.merge!(notification_type: notification_type) if notification_type
  hash.merge!(filedata: Faraday::UploadIO.new(message.attachment.file, message.attachment.file_type)) if message.attachment && message.attachment.file?
  hash
end