Sha256: 9449ac4401bd65ac9dd711ad644034883f7bfb0b5c28c6f9847998052218e64b
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require 'rubygems' require 'json' require 'rest_client' require 'recipes' # A simple interface for dealing with the zencoder api. Currently just submits jobs. More features to come some day. # # Example: # # Zencoder.submit_job('somebigapikeynumberthing','s3://bucket/path/to/file.mov', ZencoderAPI::Recipes.iphone({:override=>value})) class Zencoder include ZencoderAPI # Currently https://app.zencoder.com/api This means you have to have ssl built into your ruby! API_URL = 'https://app.zencoder.com/api' VERSION = '1.0.7' #:nodoc: # Submits a job to zencoder. # The recipe should be an instance or array of instances of ZencoderAPI::Recipe # Exceptions are not handled, but rather propagated upwards. # # If a block is provided, it is yielded the job configuration as a hash. # Recipes is an array of Recipe objects. # opts can be used to override toplevel Zencoder api options class <<self def submit_job(apikey, src, recipes, opts={}) jorb = {:api_key=>apikey, :input => src, :output=>[recipes].flatten.map(&:to_hash)} jorb.merge!(opts) yield jorb if block_given? JSON.parse(RestClient.post(API_URL+'/jobs', jorb.to_json, {:content_type=>:json, :accept=>:json})) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zencoder-1.0.7 | lib/zencoder.rb |