Class: Animoto::Manifests::DirectingAndRendering

Inherits:
Base
  • Object
show all
Defined in:
lib/animoto/manifests/directing_and_rendering.rb

Overview

A directing-and-rendering manifest is little more than just a single envelope with a directing manifest and a rendering manifest embedded within.

Instance Attribute Summary collapse

Attributes inherited from Base

#http_callback_format, #http_callback_url, #partner_metadata

Instance Method Summary collapse

Methods inherited from Base

#associated_job_class, associated_job_class, infer_content_type

Methods included from Support::ContentType

included

Constructor Details

#initialize(options = {}) ⇒ Manifests::DirectingAndRendering

Creates a new directing-and-rendering manifest.

Parameters:

  • options (Hash{Symbol=>Object}) (defaults to: {})

Options Hash (options):

  • :title (String)

    the title of this project

  • :pacing (String) — default: 'default'

    the pacing for this project

  • :resolution (String)

    the vertical resolution of the rendered video

  • :framerate (Integer)

    the framerate of the rendered video

  • :format (String)

    the format of the rendered video

  • :http_callback_url (String)

    a URL to receive a callback when this job is done

  • :http_callback_format (String)

    the format of the callback



27
28
29
30
31
# File 'lib/animoto/manifests/directing_and_rendering.rb', line 27

def initialize options = {}
  super
  @directing_manifest = Manifests::Directing.new(options.only(:title, :pacing, :max_duration, :style, :postroll))
  @rendering_manifest = Manifests::Rendering.new(options.only(:resolution, :framerate, :format))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object

Delegates method calls to the underlying directing or rendering manifests if they respond to the call.

Raises:

  • (NoMethodError)

    if the underlying manifests don’t respond



37
38
39
40
41
42
43
44
45
46
# File 'lib/animoto/manifests/directing_and_rendering.rb', line 37

def method_missing *args
  name = args.first
  if directing_manifest.respond_to?(name)
    directing_manifest.__send__(*args)
  elsif rendering_manifest.respond_to?(name)
    rendering_manifest.__send__(*args)
  else
    super
  end
end

Instance Attribute Details

#directing_manifestManifests::Directing (readonly)

The embedded directing manifest



10
11
12
# File 'lib/animoto/manifests/directing_and_rendering.rb', line 10

def directing_manifest
  @directing_manifest
end

#rendering_manifestManifests::Rendering (readonly)

The embedded rendering manifest



14
15
16
# File 'lib/animoto/manifests/directing_and_rendering.rb', line 14

def rendering_manifest
  @rendering_manifest
end

Instance Method Details

#to_hash(options = {}) ⇒ Hash{String=>Object}

Returns a representation of this manifest as a Hash.

Returns:

  • (Hash{String=>Object})

    the manifest as a Hash

Raises:

  • (ArgumentError)

    if a callback URL is specified but not the format

See Also:



54
55
56
57
58
59
60
61
62
63
# File 'lib/animoto/manifests/directing_and_rendering.rb', line 54

def to_hash options = {}
  hash  = { 'directing_and_rendering_job' => {} }
  job   = hash['directing_and_rendering_job']
  add_callback_information job
   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