Class: Conversant::V3::Services::LMS::Partner::Analytics
- Inherits:
-
Object
- Object
- Conversant::V3::Services::LMS::Partner::Analytics
- 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.
Instance Attribute Summary collapse
-
#parent ⇒ Conversant::V3::Services::LMS
readonly
The parent LMS service instance.
Instance Method Summary collapse
-
#business ⇒ Business
Get business service instance.
-
#duration_of_live(**args) ⇒ Array
Get duration of live streaming for business usage reporting.
-
#duration_of_live_recording(**args) ⇒ Array
Get duration of live recording for business usage reporting.
-
#duration_v2_transcoding(params = {}) ⇒ Hash?
Get transcoding duration metrics (v2 endpoint).
-
#durations(scope, params = {}) ⇒ Array
Get duration metrics by scope (live/recording/transcoding).
-
#initialize(parent) ⇒ Analytics
constructor
Initialize partner LMS analytics service.
-
#jobs(params = {}) ⇒ Hash
Get transcoding job count metrics.
-
#no_of_live_jobs(**args) ⇒ Array
Get number of live streaming jobs for business usage reporting.
-
#recordings(params = {}) ⇒ Hash
Get recording duration metrics.
-
#report ⇒ Report
Get report service instance.
-
#transcodings(params = {}) ⇒ Hash
Get transcoding duration metrics.
Constructor Details
#initialize(parent) ⇒ Analytics
Initialize partner LMS analytics service
22 23 24 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 22 def initialize(parent) @parent = parent end |
Instance Attribute Details
#parent ⇒ Conversant::V3::Services::LMS (readonly)
Returns the parent LMS service instance.
17 18 19 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 17 def parent @parent end |
Instance Method Details
#business ⇒ Business
Get business service instance
Provides access to business-focused analytics that aggregate transcoding, recording, and streaming data for billing and capacity planning.
54 55 56 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 54 def business @business ||= Business.new(self) end |
#duration_of_live(**args) ⇒ Array
Get duration of live streaming for business usage reporting
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 66 def duration_of_live(**args) month, type, = queries(**args) payload = { month: month, selectType: 'ltd', customerType: type, _: } response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}") return [] if response.nil? JSON.parse(response)&.map(&:with_indifferent_access) || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" [] end |
#duration_of_live_recording(**args) ⇒ Array
Get duration of live recording for business usage reporting
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 93 def duration_of_live_recording(**args) month, type, = queries(**args) payload = { month: month, selectType: 'rtd', customerType: type, _: } response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}") return [] if response.nil? JSON.parse(response)&.map(&:with_indifferent_access) || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" [] end |
#duration_v2_transcoding(params = {}) ⇒ Hash?
Get transcoding duration metrics (v2 endpoint)
224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 224 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) return nil if response.nil? JSON.parse(response) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" nil end |
#durations(scope, params = {}) ⇒ Array
Get duration metrics by scope (live/recording/transcoding)
146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 146 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) return [] if response.nil? JSON.parse(response)&.map(&:with_indifferent_access) || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" [] end |
#jobs(params = {}) ⇒ Hash
Get transcoding job count metrics
205 206 207 208 209 210 211 212 213 214 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 205 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(**args) ⇒ Array
Get number of live streaming jobs for business usage reporting
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 120 def no_of_live_jobs(**args) month, type, = queries(**args) payload = { month: month, selectType: 'ltn', customerType: type, _: } response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}") return [] if response.nil? JSON.parse(response)&.map(&:with_indifferent_access) || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" [] end |
#recordings(params = {}) ⇒ Hash
Get recording duration metrics
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 186 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 |
#report ⇒ Report
Get report service instance
Provides access to detailed partner-level reporting for LMS services including transcoding, recording, jobs, and DRM analytics.
38 39 40 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 38 def report @report ||= Report.new(self) end |
#transcodings(params = {}) ⇒ Hash
Get transcoding duration metrics
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/conversant/v3/services/lms/partner/analytics.rb', line 167 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 |