Class: Bitmovin::TransferJob

Inherits:
Object
  • Object
show all
Extended by:
Helpers
Includes:
Helpers
Defined in:
lib/bitmovin/transfer_job.rb

Overview

Represents a bitmovin transfer Job

See Also:

Constant Summary collapse

ATTRIBUTES =
%i{
  id
  job_id
  output_id
  status
  progress
  created_at
  output_name
}

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

Instance Method Summary collapse

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 = {}) ⇒ TransferJob

Returns a new instance of TransferJob.

Parameters:

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • job_id (Integer)

    Job-ID

  • output_id (Integer)

    Output-ID



35
36
37
# File 'lib/bitmovin/transfer_job.rb', line 35

def initialize(params={})
  @details = params
end

Class Method Details

.create(params = {}) ⇒ Bitmovin::TransferJob

Returns Bitmovin Transfer Job details.

Parameters:

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • job_id (Integer)

    Job-ID

  • output_id (Integer)

    Output-ID

Returns:



45
46
47
# File 'lib/bitmovin/transfer_job.rb', line 45

def self.create(params={})
  new(params).create
end

.list(reload = false) ⇒ Array<Bitmovin::TransferJob>

Get list of available transfers related to job

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/bitmovin/transfer_job.rb', line 71

def list(reload = false)
  return @list if @list && !relaod

  get = Net::HTTP::Get.new "/api/jobs/#{ @details[:job_id] }/transfers", initheaders = headers

  response = Bitmovin.http.request get

  json = prepare_response_json(response.body)

  @list = json[:jobs].map { |p| Bitmovin::TransferJob.new(p) }

  @list
end

Instance Method Details

#createBitmovin::TransferJob

Creates a new bitmovin transfer job with params given within initialization

Returns:



52
53
54
# File 'lib/bitmovin/transfer_job.rb', line 52

def create
  make_create_request
end

#details(reload = false) ⇒ Hash

Get bitmovin encoding job details

Parameters:

  • reload (defaults to: false)

    Force reload from server

Returns:

  • (Hash)

    Bitmovin Job details



60
61
62
# File 'lib/bitmovin/transfer_job.rb', line 60

def details(reload = false)
  return @details
end