Class: Uiza::Live

Inherits:
Object
  • Object
show all
Extended by:
APIOperation::Create, APIOperation::Retrieve, APIOperation::Update
Defined in:
lib/uiza/live.rb

Constant Summary collapse

OBJECT_API_PATH =
"live/entity".freeze
{
  create: "https://docs.uiza.io/#create-a-live-event",
  retrieve: "https://docs.uiza.io/#retrieve-a-live-event",
  update: "https://docs.uiza.io/#update-a-live-event",
  start_feed: "https://docs.uiza.io/#start-a-live-feed",
  list_recorded: "https://docs.uiza.io/#list-all-recorded-files",
  stop_feed: "https://docs.uiza.io/#stop-a-live-feed",
  get_view: "https://docs.uiza.io/#get-view-of-live-feed",
  delete: "https://docs.uiza.io/#delete-a-record-file",
  convert_to_vod: "https://docs.uiza.io/#convert-into-vod"
}.freeze

Class Method Summary collapse

Methods included from APIOperation::Create

create

Methods included from APIOperation::Retrieve

retrieve

Methods included from APIOperation::Update

update

Class Method Details

.convert_to_vod(id) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/uiza/live.rb', line 75

def convert_to_vod id
  url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/dvr/convert-to-vod"
  method = :post
  headers = {"Authorization" => Uiza.authorization}
  params = {id: id}

  uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:convert_to_vod]
  uiza_client.execute_request
end

.delete(id) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/uiza/live.rb', line 65

def delete id
  url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/dvr"
  method = :delete
  headers = {"Authorization" => Uiza.authorization}
  params = {id: id}

  uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:delete]
  uiza_client.execute_request
end

.get_view(id) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/uiza/live.rb', line 33

def get_view id
  url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/tracking/current-view"
  method = :get
  headers = {"Authorization" => Uiza.authorization}
  params = {id: id}
  description_link = OBJECT_API_DESCRIPTION_LINK[:get_view]

  uiza_client = UizaClient.new url, method, headers, params, description_link
  uiza_client.execute_request
end

.list_recorded(params = {}) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/uiza/live.rb', line 56

def list_recorded params = {}
  url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/dvr"
  method = :get
  headers = {"Authorization" => Uiza.authorization}

  uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:list_recorded]
  uiza_client.execute_request
end

.start_feed(id) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/uiza/live.rb', line 21

def start_feed id
  url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/feed"
  method = :post
  headers = {"Authorization" => Uiza.authorization}
  params = {id: id}

  uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:start_feed]
  response = uiza_client.execute_request

  retrieve response.entityId
end

.stop_feed(id) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/uiza/live.rb', line 44

def stop_feed id
  url = "https://#{Uiza.workspace_api_domain}/api/public/v3/#{OBJECT_API_PATH}/feed"
  method = :put
  headers = {"Authorization" => Uiza.authorization}
  params = {id: id}

  uiza_client = UizaClient.new url, method, headers, params, OBJECT_API_DESCRIPTION_LINK[:stop_feed]
  response = uiza_client.execute_request

  retrieve response.entityId
end