animoto 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/animoto.rb +1 -1
- data/lib/animoto/manifests/directing.rb +6 -0
- data/lib/animoto/manifests/directing_and_rendering.rb +2 -2
- data/lib/animoto/support/standard_envelope.rb +2 -2
- data/spec/animoto/manifests/directing_and_rendering_spec.rb +31 -2
- data/spec/animoto/manifests/directing_spec.rb +31 -0
- metadata +5 -5
data/lib/animoto.rb
CHANGED
@@ -19,6 +19,10 @@ module Animoto
|
|
19
19
|
# @return [String]
|
20
20
|
attr_accessor :pacing
|
21
21
|
|
22
|
+
# The maximum duration in seconds. Optional.
|
23
|
+
# #return [String]
|
24
|
+
attr_accessor :max_duration
|
25
|
+
|
22
26
|
# The array of visual objects in this manifest.
|
23
27
|
# @return [Array<Assets::Base,Assets::TitleCard>]
|
24
28
|
attr_reader :visuals
|
@@ -50,6 +54,7 @@ module Animoto
|
|
50
54
|
super
|
51
55
|
@title = options[:title]
|
52
56
|
@pacing = options[:pacing] || 'auto'
|
57
|
+
@max_duration = options[:max_duration]
|
53
58
|
@style = options[:style] || Animoto::Styles::ANIMOTO_ORIGINAL
|
54
59
|
@postroll = Animoto::Postroll.new(options[:postroll] || Animoto::Postroll::POWERED_BY_ANIMOTO)
|
55
60
|
@visuals = []
|
@@ -143,6 +148,7 @@ module Animoto
|
|
143
148
|
manifest = job['directing_manifest']
|
144
149
|
manifest['style'] = style
|
145
150
|
manifest['pacing'] = pacing if pacing
|
151
|
+
manifest['fitting'] = {'type' => 'best_fit', 'max_duration' => @max_duration} if @max_duration
|
146
152
|
manifest['postroll'] = postroll.to_hash if postroll
|
147
153
|
manifest['title'] = title if title
|
148
154
|
manifest['visuals'] = []
|
@@ -26,7 +26,7 @@ module Animoto
|
|
26
26
|
# @return [Manifests::DirectingAndRendering] the manifest
|
27
27
|
def initialize options = {}
|
28
28
|
super
|
29
|
-
@directing_manifest = Manifests::Directing.new(options.only(:title, :pacing))
|
29
|
+
@directing_manifest = Manifests::Directing.new(options.only(:title, :pacing, :max_duration))
|
30
30
|
@rendering_manifest = Manifests::Rendering.new(options.only(:resolution, :framerate, :format))
|
31
31
|
end
|
32
32
|
|
@@ -62,4 +62,4 @@ module Animoto
|
|
62
62
|
|
63
63
|
end
|
64
64
|
end
|
65
|
-
end
|
65
|
+
end
|
@@ -2,7 +2,7 @@ module Animoto
|
|
2
2
|
module Support
|
3
3
|
module StandardEnvelope
|
4
4
|
|
5
|
-
# When included into a class, also extends ClassMethods,
|
5
|
+
# When included into a class, also extends ClassMethods, includes InstanceMethods, and
|
6
6
|
# includes Support::ContentType
|
7
7
|
#
|
8
8
|
# @param [Module] base the module this is being included into
|
@@ -115,4 +115,4 @@ module Animoto
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
118
|
-
end
|
118
|
+
end
|
@@ -98,7 +98,36 @@ describe Animoto::Manifests::DirectingAndRendering do
|
|
98
98
|
@hash.should have_key('song')
|
99
99
|
@hash['song'].should be_a(Hash)
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
|
+
it "should not have a 'fitting' hash in the manifest" do
|
103
|
+
@hash.should_not have_key('fitting')
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "with a 'max_duration' option" do
|
107
|
+
before do
|
108
|
+
opts = {:title => 'Funderful Wonderment', :pacing => 'double', :resolution => "720p",
|
109
|
+
:framerate => 24, :format => 'flv', :max_duration => '30'}
|
110
|
+
@mfest = Animoto::Manifests::DirectingAndRendering.new(opts)
|
111
|
+
@title_card = @mfest.add_title_card 'woohoo', 'this is awesome'
|
112
|
+
@song_obj = @mfest.add_song 'http://website.com/song.mp3'
|
113
|
+
@hash = @mfest.to_hash['directing_and_rendering_job']['directing_manifest']
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should have a 'fitting' hash in the manifest" do
|
117
|
+
@hash.should have_key('fitting')
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should specify a max duration in the manifest" do
|
121
|
+
@hash['fitting'].should have_key('max_duration')
|
122
|
+
@hash['fitting']['max_duration'].should == '30'
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should specify a type in the manifest" do
|
126
|
+
@hash['fitting'].should have_key('type')
|
127
|
+
@hash['fitting']['type'].should == 'best_fit'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
102
131
|
describe "visuals array" do
|
103
132
|
before do
|
104
133
|
@visuals = @hash['visuals']
|
@@ -180,4 +209,4 @@ describe Animoto::Manifests::DirectingAndRendering do
|
|
180
209
|
end
|
181
210
|
end
|
182
211
|
end
|
183
|
-
end
|
212
|
+
end
|
@@ -19,6 +19,10 @@ describe Animoto::Manifests::Directing do
|
|
19
19
|
manifest(:pacing => 'fast').pacing.should == 'fast'
|
20
20
|
end
|
21
21
|
|
22
|
+
it "should be able to specify the max_duration with a :max_duration parameter" do
|
23
|
+
manifest(:max_duration => '30').max_duration.should == '30'
|
24
|
+
end
|
25
|
+
|
22
26
|
it "should default to 'original' style" do
|
23
27
|
manifest.style.should == Animoto::Styles::ANIMOTO_ORIGINAL
|
24
28
|
end
|
@@ -151,6 +155,33 @@ describe Animoto::Manifests::Directing do
|
|
151
155
|
manifest.to_hash['directing_job']['directing_manifest']['pacing'].should == manifest.pacing
|
152
156
|
end
|
153
157
|
|
158
|
+
it "should not have a 'fitting' key in the manifest" do
|
159
|
+
manifest.to_hash['directing_job']['directing_manifest'].should_not have_key('fitting')
|
160
|
+
end
|
161
|
+
|
162
|
+
describe "with a max_duration option" do
|
163
|
+
before do
|
164
|
+
opts = {:title => 'Funderful Wonderment', :pacing => 'double', :max_duration => '30'}
|
165
|
+
@mfest = Animoto::Manifests::Directing.new(opts)
|
166
|
+
@title_card = @mfest.add_title_card 'woohoo', 'this is awesome'
|
167
|
+
@song_obj = @mfest.add_song 'http://website.com/song.mp3'
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should have a 'fitting' key in the manifest" do
|
171
|
+
@mfest.to_hash['directing_job']['directing_manifest'].should have_key('fitting')
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should have a 'max_duration' key in the manifest" do
|
175
|
+
@mfest.to_hash['directing_job']['directing_manifest']['fitting'].should have_key('max_duration')
|
176
|
+
@mfest.to_hash['directing_job']['directing_manifest']['fitting']['max_duration'].should == @mfest.max_duration
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should have a 'type' key in the manifest" do
|
180
|
+
@mfest.to_hash['directing_job']['directing_manifest']['fitting'].should have_key('type')
|
181
|
+
@mfest.to_hash['directing_job']['directing_manifest']['fitting']['type'].should == 'best_fit'
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
154
185
|
it "should have a 'visuals' key in the manifest" do
|
155
186
|
manifest.to_hash['directing_job']['directing_manifest'].should have_key('visuals')
|
156
187
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: animoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 2
|
10
|
+
version: 1.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Animoto
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-04-09 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
requirements: []
|
140
140
|
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 1.8.
|
142
|
+
rubygems_version: 1.8.17
|
143
143
|
signing_key:
|
144
144
|
specification_version: 3
|
145
145
|
summary: Client for working with the Animoto RESTful HTTP API
|