Class: Line::Bot::Message::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/line/bot/message/image.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#recipient_type

Instance Method Summary collapse

Methods inherited from Base

#event_type, #initialize

Constructor Details

This class inherits a constructor from Line::Bot::Message::Base

Instance Attribute Details

#image_urlObject (readonly)

Returns the value of attribute image_url.



5
6
7
# File 'lib/line/bot/message/image.rb', line 5

def image_url
  @image_url
end

#preview_urlObject (readonly)

Returns the value of attribute preview_url.



5
6
7
# File 'lib/line/bot/message/image.rb', line 5

def preview_url
  @preview_url
end

Instance Method Details

#contentObject



7
8
9
10
11
12
13
14
# File 'lib/line/bot/message/image.rb', line 7

def content
  {
    contentType: ContentType::IMAGE,
    toType: recipient_type,
    originalContentUrl: self[:image_url],
    previewImageUrl: self[:preview_url]
  }
end

#valid?Boolean



16
17
18
# File 'lib/line/bot/message/image.rb', line 16

def valid?
  !self[:image_url].nil? && ![:preview_url].nil?
end