efexen/messenger_platform

View on GitHub
lib/messenger_platform/message_base.rb

Summary

Maintainability
A
0 mins
Test Coverage
class MessengerPlatform::MessageBase

  attr_reader :recipient, :notification_type

  def initialize(recipient, notification_type = :regular)
    @recipient = recipient
    @notification_type = notification_type
  end

  def serialize
    {
      recipient: recipient.serialize,
      notification_type: notification_type.to_s.upcase
    }
  end

  def deliver
    MessengerPlatform::MessageSender.deliver(self)
  end

end