Class: ElasticTranscoder::Jobs

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_transcoder/jobs.rb

Instance Method Summary collapse

Constructor Details

#initializeJobs

Returns a new instance of Jobs.



5
6
7
# File 'lib/elastic_transcoder/jobs.rb', line 5

def initialize
  @utilities = ElasticTranscoder::Utilities.new
end

Instance Method Details

#create_job(input_key, output_key, pipeline_id, preset_id, thumbnail_pattern) ⇒ Object

preset Generic 480p 16:9 => 1351620000000-000020



32
33
34
35
36
37
38
# File 'lib/elastic_transcoder/jobs.rb', line 32

def create_job input_key, output_key, pipeline_id, preset_id, thumbnail_pattern
  action = "jobs"
  creation_params = '{"Input":{"Key":"'+input_key+'","FrameRate":"auto","Resolution":"auto","AspectRatio":"auto","Interlaced":"auto","Container":"auto"}, "Output":{"Key":"'+output_key+'","ThumbnailPattern":"'+thumbnail_pattern+'","Rotate":"0","PresetId":"'+preset_id+'"} ,"PipelineId":"'+pipeline_id+'"}'
  headers = @utilities.initialize_headers action, {:method=>"POST", :payload=>creation_params}
  url = @utilities.build_url action
  response = @utilities.execute_post url, headers, creation_params
end

#delete_job(job_id) ⇒ Object



40
41
42
43
44
45
# File 'lib/elastic_transcoder/jobs.rb', line 40

def delete_job job_id
  action = "jobs/#{job_id}"
  headers = @utilities.initialize_headers action, {:method=>"DELETE", :payload=>""}
  url = @utilities.build_url action
  response = @utilities.execute_delete url, headers
end

#job(job_id) ⇒ Object



24
25
26
27
28
29
# File 'lib/elastic_transcoder/jobs.rb', line 24

def job job_id
  action = "jobs/#{job_id}"
  headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
  url = @utilities.build_url action
  response = @utilities.execute_get url, headers
end

#jobs_by_pipeline(pipeline_id) ⇒ Object



9
10
11
12
13
14
# File 'lib/elastic_transcoder/jobs.rb', line 9

def jobs_by_pipeline pipeline_id
  action = "jobsByPipeline/#{pipeline_id}"
  headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
  url = @utilities.build_url action
  response = @utilities.execute_get url, headers
end

#jobs_by_status(status) ⇒ Object

Valid statuses [Submitted|Progressing|Complete|Canceled|Error“]



17
18
19
20
21
22
# File 'lib/elastic_transcoder/jobs.rb', line 17

def jobs_by_status status
  action = "jobsByStatus/#{status}"
  headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
  url = @utilities.build_url action
  response = @utilities.execute_get url, headers
end