Class: Animoto::Manifests::Directing
- Defined in:
- lib/animoto/manifests/directing.rb
Instance Attribute Summary collapse
-
#max_duration ⇒ Object
The maximum duration in seconds.
-
#pacing ⇒ String
The pacing, representing how quickly the visuals elements will be cycled.
-
#postroll ⇒ Animoto::Postroll
The ‘postroll’ for this video.
-
#song ⇒ Assets::Song
readonly
The song for this video.
-
#style ⇒ String
The ‘style’ for this video.
-
#title ⇒ String
The title of the video project.
-
#visuals ⇒ Array<Assets::Base,Assets::TitleCard>
readonly
The array of visual objects in this manifest.
Attributes inherited from Base
#http_callback_format, #http_callback_url, #partner_metadata
Instance Method Summary collapse
-
#<<(asset) ⇒ self
Adds a visual/song to this manifest.
-
#add_footage(*args) ⇒ Assets::Footage
Adds Footage to this manifest.
-
#add_image(*args) ⇒ Assets::Image
Adds an Image to this manifest.
-
#add_song(*args) ⇒ Assets::Song
Adds a Song to this manifest.
-
#add_title_card(*args) ⇒ Assets::TitleCard
Adds a TitleCard to this manifest.
-
#add_visual(asset) ⇒ void
Adds a visual/song to this manifest.
-
#initialize(options = {}) ⇒ Manifests::Directing
constructor
Creates a new directing manifest.
-
#to_hash(options = {}) ⇒ Hash{String=>Object}
Returns a representation of this manifest as a Hash.
Methods inherited from Base
#associated_job_class, associated_job_class, infer_content_type
Methods included from Support::ContentType
Constructor Details
#initialize(options = {}) ⇒ Manifests::Directing
Creates a new directing manifest.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/animoto/manifests/directing.rb', line 53 def initialize = {} super @title = [:title] @pacing = [:pacing] || 'auto' @max_duration = [:max_duration] @style = [:style] || Animoto::Styles::ANIMOTO_ORIGINAL @postroll = Animoto::Postroll.new([:postroll] || Animoto::Postroll::POWERED_BY_ANIMOTO) @visuals = [] @song = nil end |
Instance Attribute Details
#max_duration ⇒ Object
The maximum duration in seconds. Optional. #return [String]
24 25 26 |
# File 'lib/animoto/manifests/directing.rb', line 24 def max_duration @max_duration end |
#pacing ⇒ String
The pacing, representing how quickly the visuals elements will be cycled. Valid values are ‘very_slow’, ‘slow’, ‘moderate’, ‘fast’, ‘very_fast’ and ‘auto’. Faster songs will naturally cycle through images faster than slower songs. The ‘moderate’ pacing is about 4 beats per image. With ‘auto’, Animoto’s cinematic artificial intelligence will decide what pacing will be best. The default pacing is ‘auto’.
20 21 22 |
# File 'lib/animoto/manifests/directing.rb', line 20 def pacing @pacing end |
#postroll ⇒ Animoto::Postroll
The ‘postroll’ for this video. Postrolls are the short video ‘outro’ segements that play when the main video is finished.
42 43 44 |
# File 'lib/animoto/manifests/directing.rb', line 42 def postroll @postroll end |
#song ⇒ Assets::Song (readonly)
The song for this video.
32 33 34 |
# File 'lib/animoto/manifests/directing.rb', line 32 def song @song end |
#style ⇒ String
The ‘style’ for this video. Available styles are listed in Styles. Your partner account might have different styles available from those listed.
37 38 39 |
# File 'lib/animoto/manifests/directing.rb', line 37 def style @style end |
#title ⇒ String
The title of the video project.
11 12 13 |
# File 'lib/animoto/manifests/directing.rb', line 11 def title @title end |
#visuals ⇒ Array<Assets::Base,Assets::TitleCard> (readonly)
The array of visual objects in this manifest.
28 29 30 |
# File 'lib/animoto/manifests/directing.rb', line 28 def visuals @visuals end |
Instance Method Details
#<<(asset) ⇒ self
Adds a visual/song to this manifest.
127 128 129 130 |
# File 'lib/animoto/manifests/directing.rb', line 127 def << asset add_visual asset self end |
#add_footage(*args) ⇒ Assets::Footage
Adds Footage to this manifest.
91 92 93 94 95 |
# File 'lib/animoto/manifests/directing.rb', line 91 def add_footage *args footage = Assets::Footage.new(*args) @visuals << footage footage end |
#add_image(*args) ⇒ Assets::Image
Adds an Image to this manifest.
80 81 82 83 84 |
# File 'lib/animoto/manifests/directing.rb', line 80 def add_image *args image = Assets::Image.new(*args) @visuals << image image end |
#add_song(*args) ⇒ Assets::Song
Adds a Song to this manifest. Right now, a manifest can only have one song. Adding a second replaces the first.
103 104 105 |
# File 'lib/animoto/manifests/directing.rb', line 103 def add_song *args @song = Assets::Song.new(*args) end |
#add_title_card(*args) ⇒ Assets::TitleCard
Adds a TitleCard to this manifest.
69 70 71 72 73 |
# File 'lib/animoto/manifests/directing.rb', line 69 def add_title_card *args card = Assets::TitleCard.new(*args) @visuals << card card end |
#add_visual(asset) ⇒ void
This method returns an undefined value.
Adds a visual/song to this manifest.
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/animoto/manifests/directing.rb', line 112 def add_visual asset case asset when Animoto::Assets::Song @song = asset when Animoto::Assets::Base, Animoto::Assets::TitleCard @visuals << asset else raise ArgumentError end end |
#to_hash(options = {}) ⇒ Hash{String=>Object}
Returns a representation of this manifest as a Hash.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/animoto/manifests/directing.rb', line 144 def to_hash = {} hash = { 'directing_job' => { 'directing_manifest' => {} } } job = hash['directing_job'] add_callback_information job job manifest = job['directing_manifest'] manifest['style'] = style manifest['pacing'] = pacing if pacing manifest['fitting'] = {'type' => 'best_fit', 'max_duration' => @max_duration} if @max_duration manifest['postroll'] = postroll.to_hash if postroll manifest['title'] = title if title manifest['visuals'] = [] visuals.each do |visual| manifest['visuals'] << visual.to_hash end manifest['song'] = song.to_hash if song hash end |