Class: Tumblr::Data::Video

Inherits:
Post
  • Object
show all
Defined in:
lib/tumblr.rb

Instance Attribute Summary

Attributes inherited from Post

#bookmarklet, #date, #postid, #url

Instance Method Summary collapse

Constructor Details

#initialize(elt, tz) ⇒ Video

Returns a new instance of Video.



248
249
250
251
252
253
# File 'lib/tumblr.rb', line 248

def initialize(elt, tz)
  super
  @caption = elt.elements["video-caption"].text
  @source = elt.elements["video-source"].text
  @player = elt.elements["video-player"].text
end

Instance Method Details

#to_xmlObject



255
256
257
258
259
260
261
262
263
264
265
# File 'lib/tumblr.rb', line 255

def to_xml
  elt = super
  elt.attributes["type"] = "video"
  caption = elt.add_element "video-caption"
  caption.text = @caption
  player = elt.add_element "video-player"
  player.text = @player
  source = elt.add_element "video-source"
  source.text = @source
  return elt
end