Sha256: dbb11f7c7497b4df750f784ff4ff288cd4c1245481bc9d3563b87e44f345be32

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'rubygems'
require 'rest_client'
require 'json'
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.2' #: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.
  class <<self
    def submit_job(apikey, src, *recipes)
      jorb = {:api_key=>apikey, :input => src, :output=>[recipes].flatten}
      yield jorb if block_given?
      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.2 lib/zencoder.rb