Class: SimpleWx::Messages::VideoMessage

Inherits:
SimpleWx::Message show all
Defined in:
lib/simple_wx/messages/video_message.rb

Instance Attribute Summary

Attributes inherited from SimpleWx::Message

#json, #openid, #xml

Attributes inherited from Base

#error, #raise_flag

Instance Method Summary collapse

Methods inherited from Base

method_missing

Constructor Details

#initialize(options) ⇒ VideoMessage

Returns a new instance of VideoMessage.



4
5
6
7
# File 'lib/simple_wx/messages/video_message.rb', line 4

def initialize options
  super
  @video = options[:video]
end

Instance Method Details

#send_jsonObject



9
10
11
12
13
14
# File 'lib/simple_wx/messages/video_message.rb', line 9

def send_json
  @json[:msgtype] = "video"
  @json[:video] = @video
  SimpleWx.logger.info("SimpleWxLog:#{self.class.name} -- #{@openid} -- #{json}")
  super
end

#to_xmlObject



16
17
18
19
20
21
22
23
24
# File 'lib/simple_wx/messages/video_message.rb', line 16

def to_xml
  @xml["MsgType"] = "video"
  @xml["Video"] = {
    "MediaId"     => @video[:media_id],
    "Title"       => @video[:title],
    "Description" => @video[:description],
  }
  super
end