zencoder-flix_cloud-gem 0.2.0 → 0.3.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.
- data/VERSION.yml +1 -1
- data/lib/flix_cloud.rb +4 -11
- data/lib/flix_cloud/file.rb +1 -1
- data/lib/flix_cloud/file_locations.rb +3 -3
- data/lib/flix_cloud/notification.rb +20 -0
- data/test/flix_cloud/job_test.rb +1 -1
- data/test/flix_cloud/notification_test.rb +122 -0
- metadata +5 -5
- data/lib/flix_cloud/input_file.rb +0 -2
- data/lib/flix_cloud/output_file.rb +0 -2
- data/lib/flix_cloud/watermark_file.rb +0 -2
data/VERSION.yml
CHANGED
data/lib/flix_cloud.rb
CHANGED
@@ -4,14 +4,7 @@ require 'crack/xml'
|
|
4
4
|
|
5
5
|
module FlixCloud; end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
require File.dirname(__FILE__) +
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + '/flix_cloud/input_file'
|
12
|
-
require File.dirname(__FILE__) + '/flix_cloud/output_file'
|
13
|
-
require File.dirname(__FILE__) + '/flix_cloud/watermark_file'
|
14
|
-
require File.dirname(__FILE__) + '/flix_cloud/parameters'
|
15
|
-
require File.dirname(__FILE__) + '/flix_cloud/response'
|
16
|
-
require File.dirname(__FILE__) + '/flix_cloud/extensions/hash'
|
17
|
-
require File.dirname(__FILE__) + '/flix_cloud/exceptions'
|
7
|
+
%w(record job file_locations file parameters response extensions/hash
|
8
|
+
exceptions notification).each do |file|
|
9
|
+
require File.dirname(__FILE__) + "/flix_cloud/#{file}"
|
10
|
+
end
|
data/lib/flix_cloud/file.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
class FlixCloud::FileLocations < FlixCloud::Record
|
2
2
|
|
3
|
-
record_column :input, '
|
4
|
-
record_column :output, '
|
5
|
-
record_column :watermark, '
|
3
|
+
record_column :input, 'File'
|
4
|
+
record_column :output, 'File'
|
5
|
+
record_column :watermark, 'File'
|
6
6
|
|
7
7
|
def valid?
|
8
8
|
self.errors = []
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class FlixCloud::Notification < FlixCloud::Record
|
2
|
+
attr_accessor :xml, :id, :finished_job_at, :initialized_job_at,
|
3
|
+
:recipe_name, :recipe_id, :state, :error_message
|
4
|
+
|
5
|
+
record_column :input_media_file, 'File'
|
6
|
+
record_column :output_media_file, 'File'
|
7
|
+
record_column :watermark_file, 'File'
|
8
|
+
|
9
|
+
def initialize(attrs={})
|
10
|
+
if attrs.is_a?(String)
|
11
|
+
self.xml = attrs
|
12
|
+
attrs = Crack::XML.parse(attrs)
|
13
|
+
end
|
14
|
+
|
15
|
+
attrs = attrs['job'] if attrs['job']
|
16
|
+
|
17
|
+
super(attrs)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/test/flix_cloud/job_test.rb
CHANGED
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FlixCloud::NotificationTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "When initializing with a string containing xml" do
|
6
|
+
setup do
|
7
|
+
@notification = FlixCloud::Notification.new(
|
8
|
+
%{<?xml version="1.0" encoding="UTF-8"?>
|
9
|
+
<job>
|
10
|
+
<finished-job-at type="datetime">2009-04-10T20:13:02Z</finished-job-at>
|
11
|
+
<id type="integer">1</id>
|
12
|
+
<initialized-job-at type="datetime">2009-04-10T20:05:28Z</initialized-job-at>
|
13
|
+
<recipe-name>testerrrr</recipe-name>
|
14
|
+
<recipe-id type="integer">172</recipe-id>
|
15
|
+
<state>successful_job</state>
|
16
|
+
<error-message>error message</error-message>
|
17
|
+
<input-media-file>
|
18
|
+
<url>s3://flixcloud-test/small.mov</url>
|
19
|
+
<width>1280</width>
|
20
|
+
<height>720</height>
|
21
|
+
<size>1732204</size>
|
22
|
+
<duration>900</duration>
|
23
|
+
</input-media-file>
|
24
|
+
<output-media-file>
|
25
|
+
<url>s3://flixcloud-test/fsdfasdf.mov</url>
|
26
|
+
<width>320</width>
|
27
|
+
<height>176</height>
|
28
|
+
<size>44126</size>
|
29
|
+
<duration>700</duration>
|
30
|
+
</output-media-file>
|
31
|
+
<watermark-file>
|
32
|
+
<url>http://dl.getdropbox.com/u/378873/zencoder_test.mov</url>
|
33
|
+
<size>1234</size>
|
34
|
+
</watermark-file>
|
35
|
+
</job>})
|
36
|
+
end
|
37
|
+
|
38
|
+
should "assign to all the attributes" do
|
39
|
+
assert_not_nil @notification.xml
|
40
|
+
assert_not_nil @notification.id
|
41
|
+
assert_not_nil @notification.finished_job_at
|
42
|
+
assert_not_nil @notification.initialized_job_at
|
43
|
+
assert_not_nil @notification.recipe_name
|
44
|
+
assert_not_nil @notification.recipe_id
|
45
|
+
assert_not_nil @notification.state
|
46
|
+
assert_not_nil @notification.error_message
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
context "When initializing with a hash" do
|
52
|
+
setup do
|
53
|
+
@notification = FlixCloud::Notification.new({"job" => {"initialized_job_at" => "something",
|
54
|
+
"input_media_file" => {"size" => "1732204",
|
55
|
+
"url" => "s3://flixcloud-test/small.mov",
|
56
|
+
"height" => "720",
|
57
|
+
"duration" => "900",
|
58
|
+
"width" => "1280"},
|
59
|
+
"watermark_file" => {"size" => "1234",
|
60
|
+
"url" => "http://dl.getdropbox.com/u/378873/zencoder_test.mov"},
|
61
|
+
"output_media_file" => {"size" => "44126",
|
62
|
+
"url" => "s3://flixcloud-test/fsdfasdf.mov",
|
63
|
+
"height" => "176",
|
64
|
+
"duration" => "700",
|
65
|
+
"width" => "320"},
|
66
|
+
"id" => 1,
|
67
|
+
"recipe_id" => 172,
|
68
|
+
"error_message" => 'error message',
|
69
|
+
"finished_job_at" => 'something else',
|
70
|
+
"recipe_name"=>"testerrrr",
|
71
|
+
"state"=>"successful_job"}})
|
72
|
+
end
|
73
|
+
|
74
|
+
should "assign to all the attributes except the xml attribute" do
|
75
|
+
assert_nil @notification.xml
|
76
|
+
assert_not_nil @notification.id
|
77
|
+
assert_not_nil @notification.finished_job_at
|
78
|
+
assert_not_nil @notification.initialized_job_at
|
79
|
+
assert_not_nil @notification.recipe_name
|
80
|
+
assert_not_nil @notification.recipe_id
|
81
|
+
assert_not_nil @notification.state
|
82
|
+
assert_not_nil @notification.error_message
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
context "When initializing with a hash and the parameters are not nested beneath 'job'" do
|
88
|
+
setup do
|
89
|
+
@notification = FlixCloud::Notification.new({"initialized_job_at" => "something",
|
90
|
+
"input_media_file" => {"size" => "1732204",
|
91
|
+
"url" => "s3://flixcloud-test/small.mov",
|
92
|
+
"height" => "720",
|
93
|
+
"duration" => "900",
|
94
|
+
"width" => "1280"},
|
95
|
+
"watermark_file" => {"size" => "1234",
|
96
|
+
"url" => "http://dl.getdropbox.com/u/378873/zencoder_test.mov"},
|
97
|
+
"output_media_file" => {"size" => "44126",
|
98
|
+
"url" => "s3://flixcloud-test/fsdfasdf.mov",
|
99
|
+
"height" => "176",
|
100
|
+
"duration" => "700",
|
101
|
+
"width" => "320"},
|
102
|
+
"id" => 1,
|
103
|
+
"recipe_id" => 172,
|
104
|
+
"error_message" => 'error message',
|
105
|
+
"finished_job_at" => 'something else',
|
106
|
+
"recipe_name"=>"testerrrr",
|
107
|
+
"state"=>"successful_job"})
|
108
|
+
end
|
109
|
+
|
110
|
+
should "assign to all the attributes except the xml attribute" do
|
111
|
+
assert_nil @notification.xml
|
112
|
+
assert_not_nil @notification.id
|
113
|
+
assert_not_nil @notification.finished_job_at
|
114
|
+
assert_not_nil @notification.initialized_job_at
|
115
|
+
assert_not_nil @notification.recipe_name
|
116
|
+
assert_not_nil @notification.recipe_id
|
117
|
+
assert_not_nil @notification.state
|
118
|
+
assert_not_nil @notification.error_message
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zencoder-flix_cloud-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sutton
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -61,17 +61,16 @@ files:
|
|
61
61
|
- lib/flix_cloud/extensions/hash.rb
|
62
62
|
- lib/flix_cloud/file.rb
|
63
63
|
- lib/flix_cloud/file_locations.rb
|
64
|
-
- lib/flix_cloud/input_file.rb
|
65
64
|
- lib/flix_cloud/job.rb
|
66
|
-
- lib/flix_cloud/
|
65
|
+
- lib/flix_cloud/notification.rb
|
67
66
|
- lib/flix_cloud/parameters.rb
|
68
67
|
- lib/flix_cloud/record.rb
|
69
68
|
- lib/flix_cloud/response.rb
|
70
|
-
- lib/flix_cloud/watermark_file.rb
|
71
69
|
- test/flix_cloud/file_locations_test.rb
|
72
70
|
- test/flix_cloud/file_test.rb
|
73
71
|
- test/flix_cloud/input_file_test.rb
|
74
72
|
- test/flix_cloud/job_test.rb
|
73
|
+
- test/flix_cloud/notification_test.rb
|
75
74
|
- test/flix_cloud/output_files_test.rb
|
76
75
|
- test/flix_cloud/parameters_test.rb
|
77
76
|
- test/flix_cloud/record_test.rb
|
@@ -109,6 +108,7 @@ test_files:
|
|
109
108
|
- test/flix_cloud/file_test.rb
|
110
109
|
- test/flix_cloud/input_file_test.rb
|
111
110
|
- test/flix_cloud/job_test.rb
|
111
|
+
- test/flix_cloud/notification_test.rb
|
112
112
|
- test/flix_cloud/output_files_test.rb
|
113
113
|
- test/flix_cloud/parameters_test.rb
|
114
114
|
- test/flix_cloud/record_test.rb
|