Class: Zencoder::Job

Inherits:
Base
  • Object
show all
Defined in:
lib/zencoder/job.rb

Class Method Summary collapse

Methods inherited from Base

api_key, base_url, decode, #decode, encode, #encode

Class Method Details

.cancel(job_id, options = {}) ⇒ Object


30
31
32
33
# File 'lib/zencoder/job.rb', line 30

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

.create(params = {}, options = {}) ⇒ Object


4
5
6
7
8
9
# File 'lib/zencoder/job.rb', line 4

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

.delete(job_id, options = {}) ⇒ Object


35
36
37
38
# File 'lib/zencoder/job.rb', line 35

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

.details(job_id, options = {}) ⇒ Object


20
21
22
23
# File 'lib/zencoder/job.rb', line 20

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

.list(options = {}) ⇒ Object


11
12
13
14
15
16
17
18
# File 'lib/zencoder/job.rb', line 11

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

.resubmit(job_id, options = {}) ⇒ Object


25
26
27
28
# File 'lib/zencoder/job.rb', line 25

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