animoto 1.5.3 → 1.5.4
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/assets/image.rb +9 -1
- data/spec/animoto/assets/image_spec.rb +18 -2
- metadata +4 -4
data/lib/animoto.rb
CHANGED
data/lib/animoto/assets/image.rb
CHANGED
@@ -27,6 +27,11 @@ module Animoto
|
|
27
27
|
@cover
|
28
28
|
end
|
29
29
|
|
30
|
+
# Whether or not this image has a caption. If a caption is added, it will appear with the
|
31
|
+
# image in the video.
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :caption
|
34
|
+
|
30
35
|
# Creates a new Image object.
|
31
36
|
#
|
32
37
|
# @param [String] source the source URL of this image
|
@@ -34,12 +39,14 @@ module Animoto
|
|
34
39
|
# @option options [Integer] :rotation the number of clockwise 90-degree rotations to apply to this image
|
35
40
|
# @option options [Boolean] :spotlit whether or not to spotlight this image
|
36
41
|
# @option options [Boolean] :cover whether or not to generate the cover of this video from this image
|
42
|
+
# @option options [String] :caption the text that should be displayed with the image
|
37
43
|
# @return [Assets::Image] the Image object
|
38
44
|
def initialize source, options = {}
|
39
45
|
super
|
40
46
|
@rotation = options[:rotation]
|
41
47
|
@spotlit = options[:spotlit]
|
42
48
|
@cover = options[:cover]
|
49
|
+
@caption = options[:caption]
|
43
50
|
end
|
44
51
|
|
45
52
|
# Returns a representation of this Image as a Hash.
|
@@ -51,8 +58,9 @@ module Animoto
|
|
51
58
|
hash['rotation'] = rotation if rotation
|
52
59
|
hash['spotlit'] = spotlit? unless @spotlit.nil?
|
53
60
|
hash['cover'] = cover? unless @cover.nil?
|
61
|
+
hash['caption'] = caption unless @caption.nil?
|
54
62
|
hash
|
55
63
|
end
|
56
64
|
end
|
57
65
|
end
|
58
|
-
end
|
66
|
+
end
|
@@ -5,7 +5,7 @@ describe Animoto::Assets::Image do
|
|
5
5
|
describe "initialization" do
|
6
6
|
before do
|
7
7
|
@image = Animoto::Assets::Image.new 'http://website.com/image.png',
|
8
|
-
:rotation => 2, :spotlit => true, :cover => true
|
8
|
+
:rotation => 2, :spotlit => true, :cover => true, :caption => 'This is my caption'
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should set the source to the given url" do
|
@@ -23,6 +23,10 @@ describe Animoto::Assets::Image do
|
|
23
23
|
it "should set the cover to the given value" do
|
24
24
|
@image.should be_a_cover
|
25
25
|
end
|
26
|
+
|
27
|
+
it "should set the caption to the given text" do
|
28
|
+
@image.caption.should == 'This is my caption'
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
describe "#to_hash" do
|
@@ -67,5 +71,17 @@ describe Animoto::Assets::Image do
|
|
67
71
|
@image.to_hash['cover'].should == @image.cover?
|
68
72
|
end
|
69
73
|
end
|
74
|
+
|
75
|
+
describe "if caption is given" do
|
76
|
+
before do
|
77
|
+
@image.caption = "This is my caption"
|
78
|
+
end
|
79
|
+
|
80
|
+
it "it should have a 'caption' key with the caption value" do
|
81
|
+
@image.to_hash.should have_key('caption')
|
82
|
+
@image.to_hash['caption'].should == @image.caption
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
70
86
|
end
|
71
|
-
end
|
87
|
+
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: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 4
|
10
|
+
version: 1.5.4
|
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:
|
18
|
+
date: 2013-01-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|