Class: Bitmovin::Job
- Inherits:
-
Object
- Object
- Bitmovin::Job
- Extended by:
- Helpers
- Includes:
- Helpers
- Defined in:
- lib/bitmovin/job.rb
Overview
Represents a bitmovin Job
Constant Summary collapse
- ATTRIBUTES =
%i{ job_id input_id output_id speed encoding_profile_id audio_meta_data manifest_types deinterlace extract_closed_captinos merge_audio_channel_configs duration start_time created_at }
Constants included from Helpers
Helpers::S3_BUCKET_IN_URL_REGEX, Helpers::S3_BUCKET_SUBDOMAIN_REGEX, Helpers::S3_OBJECT_KEY_IN_URL_REGEX, Helpers::S3_OBJECT_KEY_SUBDOMAIN_REGEX
Class Method Summary collapse
- .create(params = {}) ⇒ Object
-
.list(status = :all, page = 1, reload = false) ⇒ Array<Bitmovin::Job>
Get list of available jobs (10 Jobs per page).
Instance Method Summary collapse
-
#create ⇒ Bitmovin::Job
Creates a new bitmovin encoding job with params given within initialization.
-
#details(reload = false) ⇒ Hash
Get bitmovin encoding job details.
-
#initialize(params = {}) ⇒ Job
constructor
A new instance of Job.
-
#manifest(reload = false) ⇒ Hash
Get bitmovin encoding job status.
-
#status(reload = false) ⇒ Hash
Get bitmovin encoding job status.
Methods included from Helpers
deep_camelize_keys, deep_underscore_keys, extract_bucket, extract_object_key, prepare_request_json, prepare_response_json
Constructor Details
#initialize(params = {}) ⇒ Job
Returns a new instance of Job.
52 53 54 |
# File 'lib/bitmovin/job.rb', line 52 def initialize(params={}) @details = params end |
Class Method Details
.create(params = {}) ⇒ Object
71 72 73 |
# File 'lib/bitmovin/job.rb', line 71 def self.create(params={}) new(params).create end |
.list(status = :all, page = 1, reload = false) ⇒ Array<Bitmovin::Job>
Get list of available jobs (10 Jobs per page)
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/bitmovin/job.rb', line 120 def list(status = :all, page = 1, reload = false) var_name = :"@#{status}_list#{ page }" val = instance_variable_get var_name return val if val && !reload get = Net::HTTP::Get.new "/api/jobs/#{ page }/#{ status }", initheaders = headers response = Bitmovin.http.request get json = prepare_response_json(response.body) value_to_set = json[:jobs].map { |p| Bitmovin::Job.new(p) } instance_variable_set var_name, value_to_set end |
Instance Method Details
#create ⇒ Bitmovin::Job
Creates a new bitmovin encoding job with params given within initialization
78 79 80 |
# File 'lib/bitmovin/job.rb', line 78 def create make_create_request end |
#details(reload = false) ⇒ Hash
Get bitmovin encoding job details
86 87 88 89 90 |
# File 'lib/bitmovin/job.rb', line 86 def details(reload = false) return @details unless reload reload_details end |
#manifest(reload = false) ⇒ Hash
Get bitmovin encoding job status
104 105 106 107 108 |
# File 'lib/bitmovin/job.rb', line 104 def manifest(reload = false) return @manifest if !reload && @manifest reload_manifest end |
#status(reload = false) ⇒ Hash
Get bitmovin encoding job status
95 96 97 98 99 |
# File 'lib/bitmovin/job.rb', line 95 def status(reload = false) return @status if !reload && @status reload_status end |