zencoder 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -11,3 +11,11 @@
11
11
  === 1.0.2 / 2010-04-29
12
12
 
13
13
  * Fixed manifest
14
+
15
+ === 1.0.3 / 2010-04-29
16
+
17
+ * First actual working version. probably should have held off on pushing the others to gemcutter. c'est la vie.
18
+
19
+ === 1.0.4 / 2010-05-03
20
+
21
+ * Jobid hash now returned from the rest request to the api. Useful for receiving callbacks & such
data/lib/zencoder.rb CHANGED
@@ -13,7 +13,7 @@ class Zencoder
13
13
  # Currently https://app.zencoder.com/api This means you have to have ssl built into your ruby!
14
14
  API_URL = 'https://app.zencoder.com/api'
15
15
 
16
- VERSION = '1.0.3' #:nodoc:
16
+ VERSION = '1.0.4' #:nodoc:
17
17
  # Submits a job to zencoder.
18
18
  # The recipe should be an instance or array of instances of ZencoderAPI::Recipe
19
19
  # Exceptions are not handled, but rather propagated upwards.
@@ -23,8 +23,7 @@ class Zencoder
23
23
  def submit_job(apikey, src, *recipes)
24
24
  jorb = {:api_key=>apikey, :input => src, :output=>[recipes].flatten}
25
25
  yield jorb if block_given?
26
- RestClient.post(API_URL+'/jobs', jorb.to_json, {:content_type=>:json, :accept=>:json})
27
-
26
+ JSON.parse(RestClient.post(API_URL+'/jobs', jorb.to_json, {:content_type=>:json, :accept=>:json}))
28
27
  end
29
28
  end
30
29
 
@@ -9,17 +9,25 @@ class TestZencoder < Test::Unit::TestCase
9
9
 
10
10
  context "the zn lib" do
11
11
  setup do
12
- @src='s3://gkt_sophia_development/spark.avi'
12
+ @src='s3://test_development/spark.avi'
13
13
  @api = 'https://app.zencoder.com'
14
14
  @apikey = ENV['ZC_APIKEY']
15
- @base_url = 's3://gkt_sophia_development/zencoder_asset'
15
+ @base_url = 's3://test_development/zencoder_asset'
16
16
  @recipe = ZencoderAPI::Recipes.iphone('base_url' =>@base_url)
17
17
  @recipe2 = ZencoderAPI::Recipes.web('base_url' =>@base_url)
18
18
  assert_not_nil @apikey, "export ZC_APIKEY before you run the tests"
19
19
  end
20
20
  context "posting a new job" do
21
- setup do
21
+
22
+ should "return jobid" do
23
+ resp =<<-EOS
24
+ {"id":36119,"outputs":[{"url":"s3://test_development/zencoder_asset/cf398a309f648f99c41a2c0573f40baf.mp4","label":"iphone","id":36174},{"url":"s3://test_development/zencoder_asset/253fae410b1262ef3a76296cbfdb8b44.mp4","label":"web","id":36175}]}
25
+ EOS
26
+ RestClient.expects(:post).returns(resp)
27
+ h = Zencoder.submit_job(@apikey, @src, [@recipe, @recipe2])
28
+ assert_equal Hash, h.class
22
29
  end
30
+
23
31
  should "be able to submit a job" do
24
32
  RestClient.expects(:post).with(kind_of(String), kind_of(String), kind_of(Hash)){|x,y,z|
25
33
  assert_equal x, 'https://app.zencoder.com/api/jobs'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - McClain Looney
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-30 00:00:00 -05:00
17
+ date: 2010-05-03 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency