Class: Animoto::Manifests::Base Abstract

Inherits:
Object
  • Object
show all
Includes:
Support::ContentType
Defined in:
lib/animoto/manifests/base.rb

Overview

This class is abstract.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::ContentType

included

Constructor Details

#initialize(options = {}) ⇒ Base

Creates a new manifest

Parameters:

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

Options Hash (options):

  • :http_callback_url (String)

    a URL to receive a callback when this job is done

  • :http_callback_format (String)

    the format of the callback

  • :partner_metadata (String)

    an array of hashes with a predefined format containing

    the hashes for [‘partner_user_id’, ‘commercial_use’, ‘partner_intent’, ‘application_data’] where application_data is an array of hashes [‘title’, ‘id’, ‘kind’, ‘type’]



41
42
43
44
45
# File 'lib/animoto/manifests/base.rb', line 41

def initialize options = {}
  @http_callback_url  = options[:http_callback_url]
  @http_callback_format = options[:http_callback_format]
  @partner_metadata  = options[:partner_metadata]
end

Instance Attribute Details

#http_callback_formatString

The format of the callback; either ‘xml’ or ‘json’.

Returns:

  • (String)


29
30
31
# File 'lib/animoto/manifests/base.rb', line 29

def http_callback_format
  @http_callback_format
end

#http_callback_urlString

A URL to receive a callback after directing is finished.

Returns:

  • (String)


25
26
27
# File 'lib/animoto/manifests/base.rb', line 25

def http_callback_url
  @http_callback_url
end

#partner_metadataObject

Returns the value of attribute partner_metadata.



31
32
33
# File 'lib/animoto/manifests/base.rb', line 31

def 
  @partner_metadata
end

Class Method Details

.associated_job_classClass

Returns the Resources::Jobs::Base descendant class associated with this manifest class (that is, the type of job returned when a manifest of this type is posted).

Examples:

Manifests::Directing.associated_job_class # => Resources::Jobs::Directing

Returns:

  • (Class)

    the associated job class



19
20
21
# File 'lib/animoto/manifests/base.rb', line 19

def self.associated_job_class
  Resources::Jobs.const_get(self.name.split('::').last)
end

.infer_content_typeString

Returns:

  • (String)


9
10
11
# File 'lib/animoto/manifests/base.rb', line 9

def self.infer_content_type
  super + '_manifest'
end

Instance Method Details

#associated_job_classClass

Returns the Resources::Jobs::Base descendant class associated with this manifest (that is, the type of job that will be returned when this manifest is posted).

Returns:

  • (Class)

    the associated job class



59
60
61
# File 'lib/animoto/manifests/base.rb', line 59

def associated_job_class
  self.class.associated_job_class
end

#to_hashHash{String=>Object}

Returns a representation of this manifest as a Hash, used to populate request bodies when directing, rendering, etc.

Returns:

  • (Hash{String=>Object})

    the manifest as a Hash



51
52
53
# File 'lib/animoto/manifests/base.rb', line 51

def to_hash
  {}
end