Class: MessageQuickly::Messaging::ImageAttachment
- Inherits:
-
Attachment
- Object
- Base
- Attachment
- MessageQuickly::Messaging::ImageAttachment
- Defined in:
- lib/message_quickly/messaging/image_attachment.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#file_type ⇒ Object
Returns the value of attribute file_type.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Attachment
Instance Method Summary collapse
- #file? ⇒ Boolean
-
#initialize(params = {}) ⇒ ImageAttachment
constructor
A new instance of ImageAttachment.
- #to_hash ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ ImageAttachment
Returns a new instance of ImageAttachment.
7 8 9 10 |
# File 'lib/message_quickly/messaging/image_attachment.rb', line 7 def initialize(params = {}) params['type'] ||= 'image' super(params) end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
5 6 7 |
# File 'lib/message_quickly/messaging/image_attachment.rb', line 5 def file @file end |
#file_type ⇒ Object
Returns the value of attribute file_type.
5 6 7 |
# File 'lib/message_quickly/messaging/image_attachment.rb', line 5 def file_type @file_type end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/message_quickly/messaging/image_attachment.rb', line 5 def url @url end |
Instance Method Details
#file? ⇒ Boolean
12 13 14 |
# File 'lib/message_quickly/messaging/image_attachment.rb', line 12 def file? file.present? && file_type.present? end |
#to_hash ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/message_quickly/messaging/image_attachment.rb', line 16 def to_hash if file? { type: type, payload: { url: '' } } # cannot send empty hash else { type: type, payload: { url: url } } end end |