Sha256: 18c5c2177548c39e9ad3d82a98e93ee5f5222767d24c49add7f9b1061d532a88

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

module Zencoder
  class Job < Base

    def self.create(params={}, options={})
      params = apply_api_key(params, options[:format])
      HTTP.post("#{options[:base_url] || base_url}/jobs",
                           encode(params, options[:format]),
                           options)
    end

    def self.list(options={})
      params = {:api_key  => options.delete(:api_key) || api_key,
                :page     => options.delete(:page) || 1,
                :per_page => options.delete(:per_page) || 50,
                :state    => options.delete(:state) }

      HTTP.get("#{options[:base_url] || base_url}/jobs", merge_params(options, params))
    end

    def self.details(job_id, options={})
      params = {:api_key => options.delete(:api_key) || api_key}
      HTTP.get("#{options[:base_url] || base_url}/jobs/#{job_id}", merge_params(options, params))
    end

    def self.resubmit(job_id, options={})
      params = {:api_key => options.delete(:api_key) || api_key}
      HTTP.get("#{options[:base_url] || base_url}/jobs/#{job_id}/resubmit", merge_params(options, params))
    end

    def self.cancel(job_id, options={})
      params = {:api_key => options.delete(:api_key) || api_key}
      HTTP.get("#{options[:base_url] || base_url}/jobs/#{job_id}/cancel", merge_params(options, params))
    end

    def self.delete(job_id, options={})
      params = {:api_key => options.delete(:api_key) || api_key}
      HTTP.delete("#{options[:base_url] || base_url}/jobs/#{job_id}", merge_params(options, params))
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zencoder-2.3.3 lib/zencoder/job.rb
zencoder-2.3.2 lib/zencoder/job.rb
zencoder-2.3.1 lib/zencoder/job.rb