Class: MessageQuickly::Messaging::Delivery
- Inherits:
-
Object
- Object
- MessageQuickly::Messaging::Delivery
- Defined in:
- lib/message_quickly/messaging/delivery.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#notification_type ⇒ Object
must be of values: REGULAR, SILENT_PUSH, NO_PUSH.
-
#recipient ⇒ Object
Returns the value of attribute recipient.
Instance Method Summary collapse
- #build_message {|self.message| ... } ⇒ Object
-
#initialize(options = {}) {|_self| ... } ⇒ Delivery
constructor
A new instance of Delivery.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Delivery
Returns a new instance of Delivery.
8 9 10 11 12 |
# File 'lib/message_quickly/messaging/delivery.rb', line 8 def initialize( = {}) self. ||= MessageQuickly::Messaging::Message.new .each { |key, value| instance_variable_set("@#{key}", value) } yield self if block_given? end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/message_quickly/messaging/delivery.rb', line 5 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/message_quickly/messaging/delivery.rb', line 5 def @message end |
#notification_type ⇒ Object
must be of values: REGULAR, SILENT_PUSH, NO_PUSH
6 7 8 |
# File 'lib/message_quickly/messaging/delivery.rb', line 6 def notification_type @notification_type end |
#recipient ⇒ Object
Returns the value of attribute recipient.
5 6 7 |
# File 'lib/message_quickly/messaging/delivery.rb', line 5 def recipient @recipient end |
Instance Method Details
#build_message {|self.message| ... } ⇒ Object
14 15 16 |
# File 'lib/message_quickly/messaging/delivery.rb', line 14 def yield self. end |
#to_hash ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/message_quickly/messaging/delivery.rb', line 18 def to_hash hash = {} hash.merge!(recipient: recipient.to_hash) if recipient hash.merge!(message: .to_hash) if hash.merge!(notification_type: notification_type) if notification_type hash.merge!(filedata: Faraday::UploadIO.new(..file, ..file_type)) if . && ..file? hash end |