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.
222 223 224 225 226 |
# File 'lib/uencode/elements.rb', line 222 def initialize() @video_output = VideoOutput.new [:video_output] || {} @captures = [] super end |
Class Method Details
.from_hash(hash) ⇒ Object
218 219 220 |
# File 'lib/uencode/elements.rb', line 218 def self.from_hash(hash) new({}) end |
Instance Method Details
#<<(item) ⇒ Object
236 237 238 |
# File 'lib/uencode/elements.rb', line 236 def <<(item) @video_output.items << item end |
#add_capture(capture) ⇒ Object
240 241 242 |
# File 'lib/uencode/elements.rb', line 240 def add_capture(capture) @captures << capture end |
#configure_video_output {|@video_output| ... } ⇒ Object
228 229 230 |
# File 'lib/uencode/elements.rb', line 228 def configure_video_output yield @video_output end |
#each(&block) ⇒ Object
244 245 246 |
# File 'lib/uencode/elements.rb', line 244 def each(&block) @video_output.each &block end |
#items ⇒ Object
232 233 234 |
# File 'lib/uencode/elements.rb', line 232 def items @video_output.items end |
#to_xml ⇒ Object
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/uencode/elements.rb', line 248 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 |