Sha256: de17209e34c78230377d2307705d4e55f37b1902cea770e6880f61127bda60cd

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

module Animoto
  class RenderingManifest < Animoto::Manifest
    
    attr_accessor :storyboard, :resolution, :framerate, :format,
      :http_callback_url, :http_callback_format
      
    def initialize storyboard, options = {}
      @storyboard = storyboard
      @resolution = options[:resolution]
      @framerate  = options[:framerate]
      @format     = options[:format]
      @http_callback_url = options[:http_callback_url]
      @http_callback_format = options[:http_callback_format]
    end
    
    # Returns a representation of this manifest as a Hash.
    #
    # @return [Hash] this manifest as a Hash
    # @raise [ArgumentError] if a callback URL was specified but not the format
    def to_hash
      hash  = { 'rendering_job' => { 'rendering_manifest' => { 'rendering_profile' => {} } } }
      job   = hash['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
      manifest = job['rendering_manifest']
      manifest['storyboard_url'] = storyboard.url
      profile = manifest['rendering_profile']
      profile['vertical_resolution'] = resolution
      profile['framerate'] = framerate
      profile['format'] = format
      hash
    end    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
animoto-0.0.0.alpha1 ./lib/animoto/rendering_manifest.rb
animoto-0.0.0.alpha0 ./lib/animoto/rendering_manifest.rb