Class: EncodingDotCom::Thumbnail

Inherits:
Object
  • Object
show all
Defined in:
lib/encoding_dot_com/thumbnail.rb

Instance Method Summary collapse

Constructor Details

#initialize(time, destination_url, options = {}) ⇒ Thumbnail

Returns a new instance of Thumbnail.



3
4
5
6
7
# File 'lib/encoding_dot_com/thumbnail.rb', line 3

def initialize(time, destination_url, options = {})
  @time = time
  @destination = Media.media_url_string(URI.parse(destination_url.to_s))
  @options = options
end

Instance Method Details

#to_xml(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/encoding_dot_com/thumbnail.rb', line 9

def to_xml(options = {})
  xml = options[:builder] ||= ::Builder::XmlMarkup.new(:indent => options[:indent] ||= 2)

  xml.format do
    xml.output('thumbnail')
    xml.time(@time)
    xml.width(@options[:width]) if @options[:width]
    xml.height(@options[:height]) if @options[:height]
    xml.destination(@destination) unless @destination.nil?
  end
end