animoto 0.1.1.beta1 → 1.0.0

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.
Files changed (49) hide show
  1. data/README.md +8 -4
  2. data/lib/animoto.rb +1 -1
  3. data/lib/animoto/assets/base.rb +1 -1
  4. data/lib/animoto/assets/footage.rb +1 -1
  5. data/lib/animoto/assets/image.rb +1 -1
  6. data/lib/animoto/assets/song.rb +1 -1
  7. data/lib/animoto/assets/title_card.rb +1 -1
  8. data/lib/animoto/client.rb +21 -27
  9. data/lib/animoto/http_engines/base.rb +15 -7
  10. data/lib/animoto/http_engines/curl_adapter.rb +3 -4
  11. data/lib/animoto/http_engines/net_http_adapter.rb +3 -5
  12. data/lib/animoto/http_engines/patron_adapter.rb +2 -4
  13. data/lib/animoto/http_engines/rest_client_adapter.rb +1 -3
  14. data/lib/animoto/http_engines/typhoeus_adapter.rb +1 -3
  15. data/lib/animoto/manifests/base.rb +1 -1
  16. data/lib/animoto/manifests/directing.rb +1 -1
  17. data/lib/animoto/manifests/directing_and_rendering.rb +55 -28
  18. data/lib/animoto/manifests/rendering.rb +7 -6
  19. data/lib/animoto/resources/base.rb +8 -8
  20. data/lib/animoto/resources/jobs/base.rb +2 -2
  21. data/lib/animoto/resources/jobs/directing.rb +7 -2
  22. data/lib/animoto/resources/jobs/directing_and_rendering.rb +34 -8
  23. data/lib/animoto/resources/jobs/rendering.rb +17 -3
  24. data/lib/animoto/resources/storyboard.rb +20 -4
  25. data/lib/animoto/resources/video.rb +33 -11
  26. data/lib/animoto/response_parsers/base.rb +13 -8
  27. data/lib/animoto/response_parsers/json_adapter.rb +2 -4
  28. data/lib/animoto/response_parsers/yajl_adapter.rb +2 -4
  29. data/lib/animoto/support/content_type.rb +1 -0
  30. data/lib/animoto/support/coverable.rb +1 -1
  31. data/lib/animoto/support/dynamic_class_loader.rb +82 -141
  32. data/lib/animoto/support/errors.rb +4 -0
  33. data/lib/animoto/support/hash.rb +25 -0
  34. data/lib/animoto/support/standard_envelope.rb +70 -19
  35. data/lib/animoto/support/string.rb +31 -0
  36. data/lib/animoto/support/visual.rb +1 -1
  37. data/spec/animoto/client_spec.rb +1 -25
  38. data/spec/animoto/http_engines/base_spec.rb +1 -1
  39. data/spec/animoto/resources/base_spec.rb +8 -7
  40. data/spec/spec_helper.rb +1 -0
  41. metadata +12 -21
  42. data/lib/animoto/callbacks/base.rb +0 -45
  43. data/lib/animoto/callbacks/directing.rb +0 -7
  44. data/lib/animoto/callbacks/directing_and_rendering.rb +0 -7
  45. data/lib/animoto/callbacks/rendering.rb +0 -7
  46. data/spec/animoto/callbacks/base_spec.rb +0 -76
  47. data/spec/animoto/callbacks/directing_and_rendering_spec.rb +0 -5
  48. data/spec/animoto/callbacks/directing_spec.rb +0 -5
  49. data/spec/animoto/callbacks/rendering_spec.rb +0 -5
@@ -19,7 +19,7 @@ module Animoto
19
19
 
20
20
  # Returns a representation of this Visual as a Hash
21
21
  #
22
- # @return [Hash<String,Object>] this Visual as a Hash
22
+ # @return [Hash{String=>Object}] this Visual as a Hash
23
23
  def to_hash
24
24
  hash = super rescue {}
25
25
  hash['spotlit'] = spotlit? unless @spotlit.nil?
@@ -152,29 +152,5 @@ describe Animoto::Client do
152
152
  client.reload!(@job)
153
153
  @job.state.should == 'retrieving_assets'
154
154
  end
155
- end
156
-
157
- describe "processing a callback" do
158
- before do
159
- @body = %Q({"response":{"payload":{"base_callback":{"state":"failed","links":{"self":"https://api.animoto.com/things/123"}}},"status":{"errors":[{"code":"COLLAPSING_HRUNG_DISASTER","message":"A hrung has chosen to collapse disastrously."},{"code":"TOTAL_EXISTENCE_FAILURE","message":"The server is suffering from Total Existence Failure."}]}}})
160
- @callback = client.process_callback(Animoto::Callbacks::Base, @body)
161
- end
162
-
163
- it "should return a callback instance" do
164
- @callback.should be_an_instance_of(Animoto::Callbacks::Base)
165
- end
166
-
167
- it "should set the state" do
168
- @callback.state.should == "failed"
169
- end
170
-
171
- it "should set the url" do
172
- @callback.url.should == "https://api.animoto.com/things/123"
173
- end
174
-
175
- it "should set the errors" do
176
- @callback.errors.should be_an_instance_of(Array)
177
- @callback.errors.should_not be_empty
178
- end
179
- end
155
+ end
180
156
  end
@@ -20,7 +20,7 @@ describe Animoto::HTTPEngines::Base do
20
20
  end
21
21
 
22
22
  it "should raise an implementation error" do
23
- lambda { @engine.request(:get, "http://www.example.com/thing") }.should raise_error(NotImplementedError)
23
+ lambda { @engine.request(:get, "http://www.example.com/thing") }.should raise_error(Animoto::AbstractMethodError)
24
24
  end
25
25
  end
26
26
 
@@ -30,10 +30,11 @@ describe Animoto::Resources::Base do
30
30
  'self' => @url
31
31
  },
32
32
  'metadata' => {
33
- 'duration' => 300,
34
- 'format' => 'h264',
35
- 'framerate' => 30,
36
- 'vertical_resolution' => "720p"
33
+ 'rendering_parameters' => {
34
+ 'format' => 'h264',
35
+ 'framerate' => 30,
36
+ 'vertical_resolution' => "720p"
37
+ }
37
38
  }
38
39
  }
39
40
  }
@@ -46,10 +47,10 @@ describe Animoto::Resources::Base do
46
47
  end
47
48
 
48
49
  it "should update the original instance with the initialization parameters of the new one" do
49
- @video.duration.should be_nil
50
+ @video.framerate.should be_nil
50
51
  video = Animoto::Resources::Video.load(@body)
51
- video.duration.should == 300
52
- @video.duration.should == 300
52
+ video.framerate.should == 30
53
+ @video.framerate.should == 30
53
54
  end
54
55
  end
55
56
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'spec'
2
3
  require 'webmock/rspec'
3
4
  require 'mocha'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: animoto
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1848230079
5
- prerelease: true
4
+ hash: 23
5
+ prerelease: false
6
6
  segments:
7
- - 0
8
- - 1
9
7
  - 1
10
- - beta1
11
- version: 0.1.1.beta1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Animoto
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-10-26 00:00:00 -04:00
18
+ date: 2010-12-13 00:00:00 -05:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -51,10 +50,6 @@ files:
51
50
  - ./lib/animoto/assets/image.rb
52
51
  - ./lib/animoto/assets/song.rb
53
52
  - ./lib/animoto/assets/title_card.rb
54
- - ./lib/animoto/callbacks/base.rb
55
- - ./lib/animoto/callbacks/directing.rb
56
- - ./lib/animoto/callbacks/directing_and_rendering.rb
57
- - ./lib/animoto/callbacks/rendering.rb
58
53
  - ./lib/animoto/client.rb
59
54
  - ./lib/animoto/http_engines/base.rb
60
55
  - ./lib/animoto/http_engines/curl_adapter.rb
@@ -80,7 +75,9 @@ files:
80
75
  - ./lib/animoto/support/coverable.rb
81
76
  - ./lib/animoto/support/dynamic_class_loader.rb
82
77
  - ./lib/animoto/support/errors.rb
78
+ - ./lib/animoto/support/hash.rb
83
79
  - ./lib/animoto/support/standard_envelope.rb
80
+ - ./lib/animoto/support/string.rb
84
81
  - ./lib/animoto/support/visual.rb
85
82
  - ./lib/animoto.rb
86
83
  - ./spec/animoto/assets/base_spec.rb
@@ -88,10 +85,6 @@ files:
88
85
  - ./spec/animoto/assets/image_spec.rb
89
86
  - ./spec/animoto/assets/song_spec.rb
90
87
  - ./spec/animoto/assets/title_card_spec.rb
91
- - ./spec/animoto/callbacks/base_spec.rb
92
- - ./spec/animoto/callbacks/directing_and_rendering_spec.rb
93
- - ./spec/animoto/callbacks/directing_spec.rb
94
- - ./spec/animoto/callbacks/rendering_spec.rb
95
88
  - ./spec/animoto/client_spec.rb
96
89
  - ./spec/animoto/http_engines/base_spec.rb
97
90
  - ./spec/animoto/manifests/directing_and_rendering_spec.rb
@@ -132,14 +125,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
125
  required_rubygems_version: !ruby/object:Gem::Requirement
133
126
  none: false
134
127
  requirements:
135
- - - ">"
128
+ - - ">="
136
129
  - !ruby/object:Gem::Version
137
- hash: 25
130
+ hash: 3
138
131
  segments:
139
- - 1
140
- - 3
141
- - 1
142
- version: 1.3.1
132
+ - 0
133
+ version: "0"
143
134
  requirements: []
144
135
 
145
136
  rubyforge_project:
@@ -1,45 +0,0 @@
1
- module Animoto
2
- module Callbacks
3
-
4
- # @abstract
5
- class Base
6
- include Support::StandardEnvelope
7
-
8
- # @return [String]
9
- # @see Animoto::Support::StandardEnvelope::ClassMethods#payload_key
10
- def self.payload_key
11
- super + '_callback'
12
- end
13
-
14
- # @return [Hash<Symbol,Object>]
15
- # @see Animoto::Support::StandardEnvelope::ClassMethods#unpack_standard_envelope
16
- def self.unpack_standard_envelope body = {}
17
- super.merge({ :state => body['response']['payload'][payload_key]['state'] })
18
- end
19
-
20
- # The state of the job when it completed.
21
- # @return [String]
22
- attr_reader :state
23
-
24
- # Errors for the job.
25
- # @return [Array<Animoto::Error>]
26
- attr_reader :errors
27
-
28
- # The url for this job.
29
- # @return [String]
30
- attr_reader :url
31
-
32
- # Creates a new Callback.
33
- #
34
- # @param [String] body the request body of the HTTP callback
35
- # @return [Callbacks::Base] the Callback
36
- def initialize body
37
- params = unpack_standard_envelope(body)
38
- @state = params[:state]
39
- @errors = params[:errors].collect { |e| Animoto::Error.new(e['message']) }
40
- @url = params[:url]
41
- end
42
-
43
- end
44
- end
45
- end
@@ -1,7 +0,0 @@
1
- module Animoto
2
- module Callbacks
3
- class Directing < Animoto::Callbacks::Base
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Animoto
2
- module Callbacks
3
- class DirectingAndRendering < Animoto::Callbacks::Base
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Animoto
2
- module Callbacks
3
- class Rendering < Animoto::Callbacks::Base
4
-
5
- end
6
- end
7
- end
@@ -1,76 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Animoto::Callbacks::Base do
4
-
5
- describe "loading from a response body" do
6
- describe "without errors" do
7
- before do
8
- @body = {
9
- 'response' => {
10
- 'payload' => {
11
- 'base_callback' => {
12
- 'state' => 'completed',
13
- 'links' => {
14
- 'self' => 'https://api.animoto.com/things/123'
15
- }
16
- }
17
- }
18
- }
19
- }
20
- @callback = Animoto::Callbacks::Base.new @body
21
- end
22
-
23
- it "should set the state" do
24
- @callback.state.should == 'completed'
25
- end
26
-
27
- it "should set the url" do
28
- @callback.url.should == 'https://api.animoto.com/things/123'
29
- end
30
-
31
- it "should set the errors to an empty array" do
32
- @callback.errors.should be_an_instance_of(Array)
33
- @callback.errors.should be_empty
34
- end
35
- end
36
-
37
- describe "with errors" do
38
- before do
39
- @body = {
40
- 'response' => {
41
- 'payload' => {
42
- 'base_callback' => {
43
- 'state' => 'failed',
44
- 'links' => {
45
- 'self' => 'https://api.animoto.com/things/123'
46
- }
47
- }
48
- },
49
- 'status' => {
50
- 'errors' => [
51
- {
52
- 'code' => 'COLLAPSING_HRUNG_DISASTER',
53
- 'message' => 'A hrung has chosen to collapse disastrously.'
54
- },
55
- {
56
- 'code' => 'TOTAL_EXISTENCE_FAILURE',
57
- 'message' => 'The server is suffering from Total Existence Failure.'
58
- }
59
- ]
60
- }
61
- }
62
- }
63
- @callback = Animoto::Callbacks::Base.new @body
64
- end
65
-
66
- it "should collect the errors into the errors array" do
67
- @callback.errors.size.should == 2
68
- end
69
-
70
- it "should cast the errors as Animoto::Error objects" do
71
- @callback.errors.all? { |e| Animoto::Error === e }.should be_true
72
- end
73
- end
74
- end
75
-
76
- end
@@ -1,5 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Animoto::Callbacks::DirectingAndRendering do
4
-
5
- end
@@ -1,5 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Animoto::Callbacks::Directing do
4
-
5
- end
@@ -1,5 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
-
3
- describe Animoto::Callbacks::Rendering do
4
-
5
- end