Class: Conversant::V3::Services::LMS::Partner::Analytics

Inherits:
Object
  • Object
show all
Defined in:
lib/conversant/v3/services/lms/partner/analytics.rb

Overview

LMS analytics service for partner-level reporting

Provides partner-level analytics and reporting for Live Media Streaming services including live duration, recording duration, transcoding metrics, and job statistics across multiple customer accounts.

Since:

  • 1.0.12

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Analytics

Initialize partner LMS analytics service

Parameters:

Since:

  • 1.0.12



22
23
24
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 22

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#parentConversant::V3::Services::LMS (readonly)

Returns the parent LMS service instance.

Returns:

Since:

  • 1.0.12



17
18
19
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 17

def parent
  @parent
end

Instance Method Details

#duration_of_live(params) ⇒ Hash

Get duration of live streaming for business usage reporting

Parameters:

  • params (Hash)

    query parameters

Options Hash (params):

  • :month (String)

    month in YYYYMM format

  • :customerType (String)

    customer type filter

  • :_ (Integer)

    timestamp in milliseconds (cache busting)

Returns:

  • (Hash)

    live streaming duration data, or nil on error

Since:

  • 1.0.8



35
36
37
38
39
40
41
42
43
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 35

def duration_of_live(params)
  params[:selectType] = 'ltd'
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{query_string}")
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#duration_of_live_recording(params) ⇒ Hash

Get duration of live recording for business usage reporting

Parameters:

  • params (Hash)

    query parameters

Options Hash (params):

  • :month (String)

    month in YYYYMM format

  • :customerType (String)

    customer type filter

  • :_ (Integer)

    timestamp in milliseconds (cache busting)

Returns:

  • (Hash)

    recording duration data, or nil on error

Since:

  • 1.0.8



54
55
56
57
58
59
60
61
62
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 54

def duration_of_live_recording(params)
  params[:selectType] = 'rtd'
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{query_string}")
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#duration_v2_transcoding(params = {}) ⇒ Hash

Get transcoding duration metrics (v2 endpoint)

Parameters:

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

    query parameters

Options Hash (params):

  • :startTime (String)

    start time

  • :endTime (String)

    end time

Returns:

  • (Hash)

    transcoding duration data, or nil on error

Since:

  • 1.0.8



166
167
168
169
170
171
172
173
174
175
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 166

def duration_v2_transcoding(params = {})
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  uri = '/v2/reporting/lms/transcoding/duration'
  uri += "?#{query_string}" unless query_string.empty?
  response = @parent.send(:call, 'GET', uri)
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#durations(scope, params = {}) ⇒ Hash

Get duration metrics by scope (live/recording/transcoding)

Parameters:

  • scope (String)

    scope type (e.g., 'live', 'recording', 'transcoding')

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

    query parameters

Returns:

  • (Hash)

    duration data for specified scope, or nil on error

Since:

  • 1.0.8



90
91
92
93
94
95
96
97
98
99
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 90

def durations(scope, params = {})
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  uri = "/v2/reporting/lms/#{scope}/duration"
  uri += "?#{query_string}" unless query_string.empty?
  response = @parent.send(:call, 'GET', uri)
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#jobs(params = {}) ⇒ Hash

Get transcoding job count metrics

Parameters:

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

    query parameters

Options Hash (params):

  • :startTime (String)

    start time

  • :endTime (String)

    end time

Returns:

  • (Hash)

    job count data, or nil on error

Since:

  • 1.0.8



147
148
149
150
151
152
153
154
155
156
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 147

def jobs(params = {})
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  uri = '/reporting/lms/transcoding/number'
  uri += "?#{query_string}" unless query_string.empty?
  response = @parent.send(:call, 'GET', uri)
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#no_of_live_jobs(params) ⇒ Hash

Get number of live streaming jobs for business usage reporting

Parameters:

  • params (Hash)

    query parameters

Options Hash (params):

  • :month (String)

    month in YYYYMM format

  • :customerType (String)

    customer type filter

  • :_ (Integer)

    timestamp in milliseconds (cache busting)

Returns:

  • (Hash)

    live job count data, or nil on error

Since:

  • 1.0.8



73
74
75
76
77
78
79
80
81
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 73

def no_of_live_jobs(params)
  params[:selectType] = 'ltn'
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{query_string}")
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#recordings(params = {}) ⇒ Hash

Get recording duration metrics

Parameters:

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

    query parameters

Options Hash (params):

  • :startTime (String)

    start time

  • :endTime (String)

    end time

Returns:

  • (Hash)

    recording duration data, or nil on error

Since:

  • 1.0.8



128
129
130
131
132
133
134
135
136
137
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 128

def recordings(params = {})
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  uri = '/reporting/lms/recording/duration'
  uri += "?#{query_string}" unless query_string.empty?
  response = @parent.send(:call, 'GET', uri)
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end

#transcodings(params = {}) ⇒ Hash

Get transcoding duration metrics

Parameters:

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

    query parameters

Options Hash (params):

  • :startTime (String)

    start time

  • :endTime (String)

    end time

Returns:

  • (Hash)

    transcoding duration data, or nil on error

Since:

  • 1.0.8



109
110
111
112
113
114
115
116
117
118
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 109

def transcodings(params = {})
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  uri = '/reporting/lms/transcoding/duration'
  uri += "?#{query_string}" unless query_string.empty?
  response = @parent.send(:call, 'GET', uri)
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  nil
end