zencoder-flix_cloud-gem 0.4.0 → 0.5.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/record.rb +3 -3
- data/lib/flix_cloud/response.rb +1 -1
- data/test/flix_cloud/job_test.rb +40 -19
- data/test/flix_cloud/response_test.rb +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/flix_cloud/record.rb
CHANGED
|
@@ -34,9 +34,9 @@ protected
|
|
|
34
34
|
begin
|
|
35
35
|
FlixCloud::Response.new(RestClient::Resource.new("https://flixcloud.com/#{path}",
|
|
36
36
|
:verify_ssl => OpenSSL::SSL::VERIFY_PEER).post(body, :content_type => 'application/xml', :accept => 'application/xml'))
|
|
37
|
-
rescue RestClient::
|
|
38
|
-
raise FlixCloud::
|
|
39
|
-
rescue RestClient::
|
|
37
|
+
rescue RestClient::ServerBrokeConnection
|
|
38
|
+
raise FlixCloud::ServerBrokeConnection
|
|
39
|
+
rescue RestClient::RequestTimeout
|
|
40
40
|
raise FlixCloud::RequestFailed
|
|
41
41
|
end
|
|
42
42
|
end
|
data/lib/flix_cloud/response.rb
CHANGED
data/test/flix_cloud/job_test.rb
CHANGED
|
@@ -191,26 +191,44 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
191
191
|
|
|
192
192
|
context "when saving with malformed xml (should really never happen, but what if?)" do
|
|
193
193
|
setup do
|
|
194
|
-
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :
|
|
194
|
+
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :string => %{<?xml version="1.0" encoding="UTF-8"?><errors><error>Malformed XML</error></errors>},
|
|
195
|
+
:status => ['400', 'Bad Request'])
|
|
195
196
|
end
|
|
196
197
|
|
|
197
|
-
should "
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
should "not be successful" do
|
|
199
|
+
assert !@job.save
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
should "have a 400 response code" do
|
|
203
|
+
@job.save
|
|
204
|
+
assert_equal 400, @job.response.code
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
should "store the errors on the job" do
|
|
208
|
+
@job.save
|
|
209
|
+
assert_equal ['Malformed XML'], @job.errors
|
|
201
210
|
end
|
|
202
211
|
end
|
|
203
212
|
|
|
204
213
|
|
|
205
|
-
context "when saving
|
|
214
|
+
context "when saving with an invalid schema (should really never happen, but what if?)" do
|
|
206
215
|
setup do
|
|
207
|
-
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :
|
|
216
|
+
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :string => %{<?xml version="1.0" encoding="UTF-8"?><errors><error>Schema is invalid</error></errors>},
|
|
217
|
+
:status => ['400', 'Bad Request'])
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
should "not be successful" do
|
|
221
|
+
assert !@job.save
|
|
208
222
|
end
|
|
209
223
|
|
|
210
|
-
should "
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
224
|
+
should "have a 400 response code" do
|
|
225
|
+
@job.save
|
|
226
|
+
assert_equal 400, @job.response.code
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
should "store the errors on the job" do
|
|
230
|
+
@job.save
|
|
231
|
+
assert_equal ['Schema is invalid'], @job.errors
|
|
214
232
|
end
|
|
215
233
|
end
|
|
216
234
|
|
|
@@ -220,10 +238,13 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
220
238
|
FakeWeb.register_uri(:post, 'https://flixcloud.com/jobs', :status => ['401', 'Unauthorized'])
|
|
221
239
|
end
|
|
222
240
|
|
|
223
|
-
should "
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
241
|
+
should "not be successful" do
|
|
242
|
+
assert !@job.save
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
should "have a 401 response code" do
|
|
246
|
+
@job.save
|
|
247
|
+
assert_equal 401, @job.response.code
|
|
227
248
|
end
|
|
228
249
|
end
|
|
229
250
|
|
|
@@ -247,7 +268,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
247
268
|
context "when saving was successful" do
|
|
248
269
|
setup do
|
|
249
270
|
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>},
|
|
250
|
-
:status => ['
|
|
271
|
+
:status => ['201', 'Created'])
|
|
251
272
|
end
|
|
252
273
|
|
|
253
274
|
should "return true" do
|
|
@@ -318,7 +339,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
318
339
|
setup do
|
|
319
340
|
FakeWeb.allow_net_connect = false
|
|
320
341
|
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>},
|
|
321
|
-
:status => ['
|
|
342
|
+
:status => ['201', 'Created'])
|
|
322
343
|
@job = FlixCloud::Job.new(:api_key => 'your-api-key',
|
|
323
344
|
:recipe_id => 2,
|
|
324
345
|
:input_url => 'your-input-url',
|
|
@@ -360,7 +381,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
360
381
|
setup do
|
|
361
382
|
FakeWeb.allow_net_connect = false
|
|
362
383
|
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>},
|
|
363
|
-
:status => ['
|
|
384
|
+
:status => ['201', 'Created'])
|
|
364
385
|
@job = FlixCloud::Job.create(:api_key => 'your-api-key',
|
|
365
386
|
:recipe_id => 2,
|
|
366
387
|
:input_url => 'your-input-url',
|
|
@@ -404,7 +425,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
|
|
|
404
425
|
setup do
|
|
405
426
|
FakeWeb.allow_net_connect = false
|
|
406
427
|
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>},
|
|
407
|
-
:status => ['
|
|
428
|
+
:status => ['201', 'Created'])
|
|
408
429
|
@job = FlixCloud::Job.create!(:api_key => 'your-api-key',
|
|
409
430
|
:recipe_id => 2,
|
|
410
431
|
:input_url => 'your-input-url',
|
|
@@ -4,7 +4,7 @@ class FlixCloud::ResponseTest < Test::Unit::TestCase
|
|
|
4
4
|
|
|
5
5
|
context "A response initialized with a rest client response" do
|
|
6
6
|
setup do
|
|
7
|
-
@rest_client_response = stub_rest_client_response(
|
|
7
|
+
@rest_client_response = stub_rest_client_response(201, '<?xml version="1.0" encoding="UTF-8"?><something>wonderful</something>')
|
|
8
8
|
@response = FlixCloud::Response.new(@rest_client_response)
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ class FlixCloud::ResponseTest < Test::Unit::TestCase
|
|
|
27
27
|
|
|
28
28
|
context "A response initialized with a rest client response with a blank message body" do
|
|
29
29
|
setup do
|
|
30
|
-
@response = FlixCloud::Response.new(stub_rest_client_response(
|
|
30
|
+
@response = FlixCloud::Response.new(stub_rest_client_response(201, ''))
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
should "be successful" do
|
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.5.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-16 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|