moovatom 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +342 -177
- data/Rakefile +9 -0
- data/lib/moovatom/version.rb +1 -1
- data/lib/moovatom.rb +198 -116
- data/moovatom.gemspec +2 -2
- data/spec/cancel_spec.rb +106 -0
- data/spec/details_spec.rb +103 -0
- data/spec/encode_spec.rb +103 -0
- data/spec/fixtures/cancel.json +4 -0
- data/spec/fixtures/cancel.xml +1 -1
- data/spec/fixtures/detail.json +69 -0
- data/spec/fixtures/detail.xml +1 -1
- data/spec/fixtures/encode.json +4 -0
- data/spec/fixtures/encode.xml +1 -1
- data/spec/fixtures/player_error.json +4 -0
- data/spec/fixtures/player_error.xml +5 -0
- data/spec/fixtures/player_success.json +5 -0
- data/spec/fixtures/player_success.xml +6 -0
- data/spec/fixtures/status_error.json +7 -0
- data/spec/fixtures/status_error.xml +1 -1
- data/spec/fixtures/status_success.json +7 -0
- data/spec/fixtures/status_success.xml +1 -1
- data/spec/init_spec.rb +79 -0
- data/spec/player_spec.rb +156 -0
- data/spec/status_spec.rb +107 -0
- metadata +41 -13
- data/spec/request_spec.rb +0 -73
data/spec/request_spec.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe MoovAtom::MoovEngine do
|
4
|
-
before do
|
5
|
-
@args = {
|
6
|
-
username: 'jsmith',
|
7
|
-
userkey: '123',
|
8
|
-
guid: '456',
|
9
|
-
title: 'Test Video Title',
|
10
|
-
blurb: 'A Short description about the video.',
|
11
|
-
sourcefile: 'http://example.com/path/to/file/test.mp4',
|
12
|
-
callbackurl: 'http://example.com/job_complete'
|
13
|
-
}
|
14
|
-
|
15
|
-
@moov_engine = MoovAtom::MoovEngine.new @args
|
16
|
-
end
|
17
|
-
|
18
|
-
after do
|
19
|
-
FakeWeb.clean_registry
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "Details request..." do
|
23
|
-
it "gets the details of an existing video" do
|
24
|
-
xml = File.join(File.dirname(__FILE__), 'fixtures', 'detail.xml')
|
25
|
-
FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
|
26
|
-
xml_res = @moov_engine.details
|
27
|
-
xml_res.body.must_include "<uuid>456</uuid>"
|
28
|
-
xml_res.body.must_include "<versions>"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "Status request success..." do
|
33
|
-
it "handles a successful status request" do
|
34
|
-
xml = File.join(File.dirname(__FILE__), 'fixtures', 'status_success.xml')
|
35
|
-
FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
|
36
|
-
xml_res = @moov_engine.status
|
37
|
-
xml_res.body.must_include "<uuid>456</uuid>"
|
38
|
-
xml_res.body.must_include "<processing>True</processing>"
|
39
|
-
xml_res.body.must_include "<error></error>"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "Status request error..." do
|
44
|
-
it "handles an unsuccessful status request" do
|
45
|
-
xml = File.join(File.dirname(__FILE__), 'fixtures', 'status_error.xml')
|
46
|
-
FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
|
47
|
-
xml_res = @moov_engine.status
|
48
|
-
xml_res.body.must_include "<uuid>456</uuid>"
|
49
|
-
xml_res.body.must_include "<processing>False</processing>"
|
50
|
-
xml_res.body.must_include "<error>This was not a recognized format.</error>"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "Encode request..." do
|
55
|
-
it "starts encoding a new video" do
|
56
|
-
xml = File.join(File.dirname(__FILE__), 'fixtures', 'encode.xml')
|
57
|
-
FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
|
58
|
-
xml_res = @moov_engine.encode
|
59
|
-
xml_res.must_equal "456"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "Cancel request..." do
|
64
|
-
it "cancels the encoding of an existing video" do
|
65
|
-
xml = File.join(File.dirname(__FILE__), 'fixtures', 'cancel.xml')
|
66
|
-
FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
|
67
|
-
xml_res = @moov_engine.cancel
|
68
|
-
xml_res.body.must_include "<uuid>456</uuid>"
|
69
|
-
xml_res.body.must_include "<message>This job was successfully cancelled.</message>"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|