Class: UEncode::Job
- Inherits:
-
Object
- Object
- UEncode::Job
- Includes:
- Enumerable
- Defined in:
- lib/uencode/elements.rb
Constant Summary collapse
- ATTRIBUTES =
[:source, :userdata, :notify]
Class Method Summary collapse
Instance Method Summary collapse
- #<<(item) ⇒ Object
- #add_capture(capture) ⇒ Object
- #configure_video_output {|@video_output| ... } ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(options) ⇒ Job
constructor
A new instance of Job.
- #items ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(options) ⇒ Job
Returns a new instance of Job.
238 239 240 241 242 |
# File 'lib/uencode/elements.rb', line 238 def initialize() @video_output = VideoOutput.new [:video_output] || {} @captures = [] super end |
Class Method Details
.from_hash(hash) ⇒ Object
234 235 236 |
# File 'lib/uencode/elements.rb', line 234 def self.from_hash(hash) new({}) end |
Instance Method Details
#<<(item) ⇒ Object
252 253 254 |
# File 'lib/uencode/elements.rb', line 252 def <<(item) @video_output.items << item end |
#add_capture(capture) ⇒ Object
256 257 258 |
# File 'lib/uencode/elements.rb', line 256 def add_capture(capture) @captures << capture end |
#configure_video_output {|@video_output| ... } ⇒ Object
244 245 246 |
# File 'lib/uencode/elements.rb', line 244 def configure_video_output yield @video_output end |
#each(&block) ⇒ Object
260 261 262 |
# File 'lib/uencode/elements.rb', line 260 def each(&block) @video_output.each &block end |
#items ⇒ Object
248 249 250 |
# File 'lib/uencode/elements.rb', line 248 def items @video_output.items end |
#to_xml ⇒ Object
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/uencode/elements.rb', line 264 def to_xml xml = %Q{ <job> <customerkey>#{UEncode.customer_key}</customerkey> <source>#{source}</source> #{userdata.nil? ? "" : '<userdata>' + userdata + '</userdata>'} #{notify.nil? ? "" : '<notify>' + notify + '</notify>'} <outputs> #{@video_output.to_xml} #{@captures.inject("") { |s, cap| s << cap.to_xml }} </outputs> </job> } Nokogiri::XML(xml).to_xml end |