./lib/animoto/manifests/directing_and_rendering.rb in animoto-1.0.0 vs ./lib/animoto/manifests/directing_and_rendering.rb in animoto-1.1.0

- old
+ new

@@ -11,46 +11,37 @@ # The embedded rendering manifest # @return [Manifests::Rendering] attr_reader :rendering_manifest - # A URL to receive a callback after directing is finished. - # @return [String] - attr_accessor :http_callback_url - - # The format of the callback; either 'xml' or 'json'. - # @return [String] - attr_accessor :http_callback_format - # Creates a new directing-and-rendering manifest. # # @param [Hash{Symbol=>Object}] options # @option options [String] :title the title of this project # @option options [String] :pacing ('default') the pacing for this project # @option options [String] :resolution the vertical resolution of the rendered video # @option options [Integer] :framerate the framerate of the rendered video # @option options [String] :format the format of the rendered video # @option options [String] :http_callback_url a URL to receive a callback when this job is done # @option options [String] :http_callback_format the format of the callback - def initialize options = {} + # @return [Manifests::DirectingAndRendering] the manifest + def initialize options = {} + super @directing_manifest = Manifests::Directing.new(options.only(:title, :pacing)) @rendering_manifest = Manifests::Rendering.new(options.only(:resolution, :framerate, :format)) - - @http_callback_url = options[:http_callback_url] - @http_callback_format = options[:http_callback_format] end # Delegates method calls to the underlying directing or rendering manifests if # they respond to the call. # # @raise [NoMethodError] if the underlying manifests don't respond def method_missing *args name = args.first if directing_manifest.respond_to?(name) - directing_manifest.__send__ *args + directing_manifest.__send__(*args) elsif rendering_manifest.respond_to?(name) - rendering_manifest.__send__ *args + rendering_manifest.__send__(*args) else super end end @@ -61,14 +52,10 @@ # @see Animoto::Manifests::Directing#to_hash # @see Animoto::Manifests::Rendering#to_hash def to_hash options = {} hash = { 'directing_and_rendering_job' => {} } job = hash['directing_and_rendering_job'] - if http_callback_url - raise ArgumentError, "You must specify a http_callback_format (either 'xml' or 'json')" if http_callback_format.nil? - job['http_callback'] = http_callback_url - job['http_callback_format'] = http_callback_format - end + add_callback_information job job['directing_manifest'] = self.directing_manifest.to_hash['directing_job']['directing_manifest'] job['rendering_manifest'] = self.rendering_manifest.to_hash['rendering_job']['rendering_manifest'] hash end \ No newline at end of file