zencoder-flix_cloud-gem 0.0.0 → 0.1.1
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 +4 -0
- data/lib/flix_cloud/exceptions.rb +3 -0
- data/lib/flix_cloud/job.rb +17 -0
- data/lib/flix_cloud.rb +2 -1
- data/test/flix_cloud/job_test.rb +132 -0
- metadata +4 -2
data/VERSION.yml
ADDED
data/lib/flix_cloud/job.rb
CHANGED
|
@@ -46,6 +46,23 @@ class FlixCloud::Job < FlixCloud::Record
|
|
|
46
46
|
response.success?
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
def save!
|
|
50
|
+
raise FlixCloud::SaveError unless save
|
|
51
|
+
true
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.create(attrs={})
|
|
55
|
+
job = new(attrs)
|
|
56
|
+
job.save
|
|
57
|
+
job
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.create!(attrs={})
|
|
61
|
+
job = create(attrs)
|
|
62
|
+
raise FlixCloud::CreateError unless job.id
|
|
63
|
+
job
|
|
64
|
+
end
|
|
65
|
+
|
|
49
66
|
def to_xml
|
|
50
67
|
xml = Builder::XmlMarkup.new
|
|
51
68
|
|
data/lib/flix_cloud.rb
CHANGED
|
@@ -13,4 +13,5 @@ require File.dirname(__FILE__) + '/flix_cloud/output_file'
|
|
|
13
13
|
require File.dirname(__FILE__) + '/flix_cloud/watermark_file'
|
|
14
14
|
require File.dirname(__FILE__) + '/flix_cloud/parameters'
|
|
15
15
|
require File.dirname(__FILE__) + '/flix_cloud/response'
|
|
16
|
-
require File.dirname(__FILE__) + '/flix_cloud/extensions/hash'
|
|
16
|
+
require File.dirname(__FILE__) + '/flix_cloud/extensions/hash'
|
|
17
|
+
require File.dirname(__FILE__) + '/flix_cloud/exceptions'
|
data/test/flix_cloud/job_test.rb
CHANGED
|
@@ -254,4 +254,136 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
254
254
|
assert_equal 'your-watermark-password', @job.file_locations.watermark.parameters.password
|
|
255
255
|
end
|
|
256
256
|
end
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
context "When calling save! on an invalid job" do
|
|
260
|
+
setup do
|
|
261
|
+
@job = FlixCloud::Job.new
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
should "raise a FlixCloud::SaveError" do
|
|
265
|
+
assert_raises FlixCloud::SaveError do
|
|
266
|
+
@job.save!
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
context "When calling save! on a valid job" do
|
|
273
|
+
setup do
|
|
274
|
+
FakeWeb.allow_net_connect = false
|
|
275
|
+
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :string => %{<?xml version="1.0" encoding="UTF-8"?><job><id type="integer">1</id><initialized-job-at type="datetime">2009-04-07T23:15:33+02:00</initialized-job-at></job>},
|
|
276
|
+
:status => ['200', 'OK'])
|
|
277
|
+
@job = FlixCloud::Job.new(:api_key => 'your-api-key',
|
|
278
|
+
:recipe_id => 2,
|
|
279
|
+
:input_url => 'your-input-url',
|
|
280
|
+
:input_user => 'your-input-user',
|
|
281
|
+
:input_password => 'your-input-password',
|
|
282
|
+
:output_url => 'your-output-url',
|
|
283
|
+
:output_user => 'your-output-user',
|
|
284
|
+
:output_password => 'your-output-password',
|
|
285
|
+
:watermark_url => 'your-watermark-url',
|
|
286
|
+
:watermark_user => 'your-watermark-user',
|
|
287
|
+
:watermark_password => 'your-watermark-password')
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
teardown do
|
|
291
|
+
FakeWeb.clean_registry
|
|
292
|
+
FakeWeb.allow_net_connect = true
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
should "return true" do
|
|
296
|
+
assert_equal true, @job.save
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
context "When creating an invalid job" do
|
|
301
|
+
setup do
|
|
302
|
+
@job = FlixCloud::Job.create
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
should "return a FlixCloud::Job" do
|
|
306
|
+
assert @job.is_a?(FlixCloud::Job)
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
should "have errors on the job" do
|
|
310
|
+
assert !@job.errors.empty?
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
context "When creating a valid job" do
|
|
315
|
+
setup do
|
|
316
|
+
FakeWeb.allow_net_connect = false
|
|
317
|
+
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :string => %{<?xml version="1.0" encoding="UTF-8"?><job><id type="integer">1</id><initialized-job-at type="datetime">2009-04-07T23:15:33+02:00</initialized-job-at></job>},
|
|
318
|
+
:status => ['200', 'OK'])
|
|
319
|
+
@job = FlixCloud::Job.create(:api_key => 'your-api-key',
|
|
320
|
+
:recipe_id => 2,
|
|
321
|
+
:input_url => 'your-input-url',
|
|
322
|
+
:input_user => 'your-input-user',
|
|
323
|
+
:input_password => 'your-input-password',
|
|
324
|
+
:output_url => 'your-output-url',
|
|
325
|
+
:output_user => 'your-output-user',
|
|
326
|
+
:output_password => 'your-output-password',
|
|
327
|
+
:watermark_url => 'your-watermark-url',
|
|
328
|
+
:watermark_user => 'your-watermark-user',
|
|
329
|
+
:watermark_password => 'your-watermark-password')
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
teardown do
|
|
333
|
+
FakeWeb.clean_registry
|
|
334
|
+
FakeWeb.allow_net_connect = true
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
should "return a FlixCloud::Job" do
|
|
338
|
+
assert @job.is_a?(FlixCloud::Job)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
should "not have errors on the job" do
|
|
342
|
+
assert @job.errors.empty?
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
should "have an id set" do
|
|
346
|
+
assert_not_nil @job.id
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
context "When using create! to create an invalid job" do
|
|
351
|
+
should "raise a FlixCloud::CreationError exception" do
|
|
352
|
+
assert_raises FlixCloud::CreateError do
|
|
353
|
+
@job = FlixCloud::Job.create!
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
context "When using create! to create a valid job" do
|
|
359
|
+
setup do
|
|
360
|
+
FakeWeb.allow_net_connect = false
|
|
361
|
+
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :string => %{<?xml version="1.0" encoding="UTF-8"?><job><id type="integer">1</id><initialized-job-at type="datetime">2009-04-07T23:15:33+02:00</initialized-job-at></job>},
|
|
362
|
+
:status => ['200', 'OK'])
|
|
363
|
+
@job = FlixCloud::Job.create!(:api_key => 'your-api-key',
|
|
364
|
+
:recipe_id => 2,
|
|
365
|
+
:input_url => 'your-input-url',
|
|
366
|
+
:input_user => 'your-input-user',
|
|
367
|
+
:input_password => 'your-input-password',
|
|
368
|
+
:output_url => 'your-output-url',
|
|
369
|
+
:output_user => 'your-output-user',
|
|
370
|
+
:output_password => 'your-output-password',
|
|
371
|
+
:watermark_url => 'your-watermark-url',
|
|
372
|
+
:watermark_user => 'your-watermark-user',
|
|
373
|
+
:watermark_password => 'your-watermark-password')
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
teardown do
|
|
377
|
+
FakeWeb.clean_registry
|
|
378
|
+
FakeWeb.allow_net_connect = true
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
should "return a job" do
|
|
382
|
+
assert @job.is_a?(FlixCloud::Job)
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
should "return a job with an id" do
|
|
386
|
+
assert_not_nil @job.id
|
|
387
|
+
end
|
|
388
|
+
end
|
|
257
389
|
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.1.1
|
|
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-08 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -55,7 +55,9 @@ files:
|
|
|
55
55
|
- LICENSE
|
|
56
56
|
- README.markdown
|
|
57
57
|
- Rakefile
|
|
58
|
+
- VERSION.yml
|
|
58
59
|
- lib/flix_cloud.rb
|
|
60
|
+
- lib/flix_cloud/exceptions.rb
|
|
59
61
|
- lib/flix_cloud/extensions/hash.rb
|
|
60
62
|
- lib/flix_cloud/file.rb
|
|
61
63
|
- lib/flix_cloud/file_locations.rb
|