class Ubiquity::VDMS::Uplynk::API::Client

Attributes

http_client[RW]
logger[RW]
owner[RW]
request[RW]
response[RW]
secret[RW]

Public Class Methods

new(args = { }) click to toggle source
# File lib/ubiquity/vdms/uplynk/api/client.rb, line 25
def initialize(args = { })
  @http_client = HTTPClient.new(args)

  @owner = args[:owner] || args[:username]
  @secret = args[:secret] || args[:password]

  @logger = http_client.logger
end

Public Instance Methods

asset_get(args = { }, opts = { }) click to toggle source

Retrieves a specific asset from your library. @see support.uplynk.com/doc_integration_apis_asset.html

Request parameters --------------——–------------------------------------------------------------------------------- | id | string | (optional*) the asset's ID | | external_id | string | (optional*) the asset's external ID | | ids | list | (optional*) a list of assets' IDs to be returned as a list of assets | | external_ids | list | (optional*) a list of assets' external IDs to be returned as a list of assets | --------------——–-------------------------------------------------------------------------------

  • One of id, external_id, ids, external_ids must be specified.

@param [Hash] args @option args [String] id @option args [String] external_id @option args [<Array>String] ids @option args [<Array>String] external_ids

@param [Hash] opts

@return [Hash]

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 81
def asset_get(args = { }, opts = { })
  post('asset/get', args, opts)
end
asset_get_frame(args = { }, opts = { })
Alias for: asset_getframe
asset_getframe(args = { }, opts = { }) click to toggle source

Returns a base64 representation of the specified frame from the highest bitrate variant of the specified asset.

Request parameters ----————------------------------------------------------------------------------------------------------------------------- | id | int | ID of the asset from which to grab a frame | | ts | int/string | Timestamp of the frame to grab. Specify in milliseconds as an integer, or as a string in the 'hh:mm:ss.ms' format | ----————-------------------------------------------------------------------------------------------------------------------

Response parameters

@param [Hash] args @param [Hash] opts @return [Hash]

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 98
def asset_getframe(args = { }, opts = { })

end
Also aliased as: asset_get_frame
asset_list(args = { }, opts = { }) click to toggle source

Lists or searches for assets.

Request parameters --------———------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | search | string | (optional) Text to search for in the asset's description, ID, or external ID. | | limit | integer | (optional) Cap the number of items returned, maximum of 100 items. | | skip | integer | (optional) Skip the first N results. The skip and limit parameters can be used together for paginated results. | | order | string | (optional) Sort the results by the given field. Supported fields include: desc, created, lastmod, duration, state, and external_id. Prefix the sort field with a minus sign for descending order (e.g. order='-desc' to retrieve values in reverse alphabetical order) | --------———------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Response parameters --------——---------------------------------------------------------------------- | assets | list | A list of assets, where each matches the form returned by asset/get. | --------——----------------------------------------------------------------------

@param [Hash] args @param [Hash] opts @return [Hash]

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 121
def asset_list(args = { }, opts = { })
  post('asset/list', args, opts)
end
asset_update(args = { }, opts = { }) click to toggle source

Modifies an asset in your library.

Request parameters ------------------——–--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | id | string | (optional*) the ID of the asset to modify | | external_id | string | (optional*) A new external_id for the asset. Note: if you retrieved the asset by external ID, you cannot also update the external ID at the same time. | | desc | string | (optional) A description for the asset | | test_player_url | any | (optional) Specifying any value for this parameter will cause a new test player URL to be generated. Note that this does not expire any existing test players; it adds a new test player to the list of test players. To expire a test player please use the CMS web interface. | | embed_player_url | any | (optional) Specifying any value for this parameter will cause a new embed player URL to be generated. | | require_drm | int | (optional) Specify a 1 to enable required tokens. Specify a 0 to disable required tokens. | | meta | string | (optional) The metadata to set on the asset. This must be a dictionary in JSON format. If the asset has existing meta, any new meta will be merged. To clear all metadata, set to '{}'. | | poster_img | string | (optional) The image to be used for this asset's poster image, as a base64-encoded string. Limited to images that are smaller than 3MB before base64 encoding. To reset the asset's poster image, set to the empty string ''. | | autoexpire | string | (optional) A timestamp in milliseconds after which the asset will be deleted automatically. Use a value of 0 to indicate that the asset should not auto-expire. | ------------------——–---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • Either id or external_id must be specified.

@param [Hash] args @param [Hash] opts @return [Hash]

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 144
def asset_update(args = { }, opts = { })
  post('asset/update')
end
cloudslicer_job_cancel(args = { }, opts = { }) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobscancel

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 151
def cloudslicer_job_cancel(args = { }, opts = { })
  post('cloudslicer/jobs/cancel', args, opts)
end
cloudslicer_job_create(args = { }, opts = { }) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobscreate

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 156
def cloudslicer_job_create(args = { }, opts = { })
  post('cloudslicer/jobs/create', args, opts)
end
cloudslicer_job_delete(args, opts) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobsdelete

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 161
def cloudslicer_job_delete(args, opts)
  post('cloudslicer/jobs/delete', args, opts)
end
cloudslicer_job_export_create(args = { }, opts = { }) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobscexport

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 166
def cloudslicer_job_export_create(args = { }, opts = { })
  post('cloudslicer/jobs/create_export', args, opts)
end
cloudslicer_job_get(args = { }, opts = { }) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobsget

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 171
def cloudslicer_job_get(args = { }, opts = { })
  post('cloudslicer/jobs/get', args, opts)
end
cloudslicer_job_quickclip_create(args = { }, opts = { }) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobsqc

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 176
def cloudslicer_job_quickclip_create(args = { }, opts = { })
  post('cloudslicer/jobs/quickclip', args, opts)
end
cloudslicer_jobs_list(args = { }, opts = { }) click to toggle source

@see support.uplynk.com/doc_integration_apis_cloudslicer.html#jobslist

# File lib/ubiquity/vdms/uplynk/api/client.rb, line 181
def cloudslicer_jobs_list(args = { }, opts = { })
  post('cloudslicer/jobs/list', args, opts)
end
encode_body(body) click to toggle source
# File lib/ubiquity/vdms/uplynk/api/client.rb, line 49
def encode_body(body)
  msg = message_encode(body)
  sig = signature_generate(msg)
  _body = "msg=#{CGI.escape(msg)}&sig=#{CGI.escape(sig)}"
end
message_encode(msg, _owner = owner) click to toggle source
# File lib/ubiquity/vdms/uplynk/api/client.rb, line 34
def message_encode(msg, _owner = owner)
  msg['_owner'] = _owner
  msg['_timestamp'] = Time.now.to_i
  msg = JSON.generate(msg)

  msg = Zlib::Deflate.deflate(msg, 9)
  msg = Base64.encode64(msg).strip

  msg
end
post(path, body = { }, opts = { }) click to toggle source
# File lib/ubiquity/vdms/uplynk/api/client.rb, line 55
def post(path, body = { }, opts = { })
  _body = encode_body(body)
  http_client.post(path, _body, opts)
end
signature_generate(encoded_msg, _secret = secret) click to toggle source
# File lib/ubiquity/vdms/uplynk/api/client.rb, line 45
def signature_generate(encoded_msg, _secret = secret)
  OpenSSL::HMAC.hexdigest('sha256', _secret, encoded_msg)
end