Class: UEncode::Job
Constant Summary
collapse
- ATTRIBUTES =
[:userdata, :callback, :customerkey]
Instance Method Summary
collapse
included, #set_attributes
Constructor Details
#initialize(options) ⇒ Job
Returns a new instance of Job.
431
432
433
434
435
436
|
# File 'lib/uencode/elements.rb', line 431
def initialize(options)
@video_outputs = []
@captures = []
source_video = options[:source_video]
super
end
|
Instance Method Details
#add_capture(capture) ⇒ Object
442
443
444
|
# File 'lib/uencode/elements.rb', line 442
def add_capture(capture)
@captures << capture
end
|
#add_video(video) ⇒ Object
438
439
440
|
# File 'lib/uencode/elements.rb', line 438
def add_video(video)
@video_outputs << video
end
|
#source_video ⇒ Object
427
428
429
|
# File 'lib/uencode/elements.rb', line 427
def source_video
@source_video
end
|
#source_video=(_source) ⇒ Object
422
423
424
425
|
# File 'lib/uencode/elements.rb', line 422
def source_video=(_source)
_source = Source.new(_source) unless _source.instance_of?(Source) || _source.nil?
instance_variable_set :@source_video, _source
end
|
#to_xml ⇒ Object
446
447
448
449
450
451
452
453
454
455
456
457
458
459
|
# File 'lib/uencode/elements.rb', line 446
def to_xml
xml = %Q{
<job>
#{source_video.nil? ? "" : source_video.to_xml}
#{userdata.nil? ? "" : '<userdata>' + userdata + '</userdata>'}
#{callback.nil? ? "" : '<callback>' + callback + '</callback>'}
<outputs>
#{@video_outputs.inject("") { |s, vid| s << vid.to_xml}}
#{@captures.inject("") { |s, cap| s << cap.to_xml }}
</outputs>
</job>
}
xml.gsub(/\n?/, "").gsub(/>\s+</, "><")
end
|