Class: MessengerPlatform::MessageBase
- Inherits:
-
Object
- Object
- MessengerPlatform::MessageBase
- Defined in:
- lib/messenger_platform/message_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#notification_type ⇒ Object
readonly
Returns the value of attribute notification_type.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(recipient, notification_type = :regular) ⇒ MessageBase
constructor
A new instance of MessageBase.
- #serialize ⇒ Object
Constructor Details
#initialize(recipient, notification_type = :regular) ⇒ MessageBase
Returns a new instance of MessageBase.
5 6 7 8 |
# File 'lib/messenger_platform/message_base.rb', line 5 def initialize(recipient, notification_type = :regular) @recipient = recipient @notification_type = notification_type end |
Instance Attribute Details
#notification_type ⇒ Object (readonly)
Returns the value of attribute notification_type.
3 4 5 |
# File 'lib/messenger_platform/message_base.rb', line 3 def notification_type @notification_type end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
3 4 5 |
# File 'lib/messenger_platform/message_base.rb', line 3 def recipient @recipient end |
Instance Method Details
#deliver ⇒ Object
17 18 19 |
# File 'lib/messenger_platform/message_base.rb', line 17 def deliver MessengerPlatform::MessageSender.deliver(self) end |
#serialize ⇒ Object
10 11 12 13 14 15 |
# File 'lib/messenger_platform/message_base.rb', line 10 def serialize { recipient: recipient.serialize, notification_type: notification_type.to_s.upcase } end |