Class: Conversant::V3::Services::LMS::Partner::Business
- Inherits:
-
Object
- Object
- Conversant::V3::Services::LMS::Partner::Business
- Defined in:
- lib/conversant/v3/services/lms/partner/business.rb
Overview
LMS Business analytics for partner-level business reporting
Provides business-focused analytics methods that aggregate transcoding, recording, and streaming data for billing and capacity planning.
Instance Attribute Summary collapse
-
#parent ⇒ Conversant::V3::Services::LMS::Partner::Analytics
readonly
The parent analytics instance.
Instance Method Summary collapse
-
#initialize(parent) ⇒ Business
constructor
Initialize partner LMS business service.
-
#recording(**args) ⇒ Hash?
Fetches recording business analytics with codec breakdown.
-
#stream_jobs(**args) ⇒ Array
Fetches stream jobs data.
-
#transcoding(**args) ⇒ Hash?
Fetches transcoding business analytics with codec breakdown.
Constructor Details
#initialize(parent) ⇒ Business
Initialize partner LMS business service
21 22 23 |
# File 'lib/conversant/v3/services/lms/partner/business.rb', line 21 def initialize(parent) @parent = parent end |
Instance Attribute Details
#parent ⇒ Conversant::V3::Services::LMS::Partner::Analytics (readonly)
Returns the parent analytics instance.
16 17 18 |
# File 'lib/conversant/v3/services/lms/partner/business.rb', line 16 def parent @parent end |
Instance Method Details
#recording(**args) ⇒ Hash?
Fetches recording business analytics with codec breakdown
Aggregates recording data including total recording duration, transmuxing, audio-only, and transcoding across different resolutions and codecs.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/conversant/v3/services/lms/partner/business.rb', line 91 def recording(**args) recording = { lms_recording: 0, lms_transmuxing: 0, lms_transcoding_sd: 0, lms_transcoding_hd: 0, lms_transcoding_uhd: 0, lms_audio_only: 0 } data = @parent.duration_of_live_recording(**args).first return nil if data.nil? name = data.keys.first data[name]&.each do |item| recording[:lms_recording] += item[:total].to_f recording[:lms_transmuxing] += item[:transmux].to_f recording[:lms_audio_only] += item[:audioOnly].to_f recording[:lms_transcoding_sd] += item[:h264SdTranscoding].to_f + item[:h265SdTranscoding].to_f recording[:lms_transcoding_hd] += item[:h264HdTranscoding].to_f + item[:h265HdTranscoding].to_f recording[:lms_transcoding_uhd] += item[:h264UhdTranscoding].to_f + item[:h265UhdTranscoding].to_f end recording rescue StandardError => e logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" nil end |
#stream_jobs(**args) ⇒ Array
Fetches stream jobs data
Retrieves the number of live streaming jobs for business usage reporting. This is an alias for the parent analytics' no_of_live_jobs method.
137 138 139 |
# File 'lib/conversant/v3/services/lms/partner/business.rb', line 137 def stream_jobs(**args) @parent.no_of_live_jobs(**args) end |
#transcoding(**args) ⇒ Hash?
Fetches transcoding business analytics with codec breakdown
Aggregates transcoding data including transmuxing, audio-only, and transcoding across different resolutions (SD, HD, UHD) and codecs (H264, H265).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/conversant/v3/services/lms/partner/business.rb', line 43 def transcoding(**args) transcode = { lms_transcoding: 0, lms_transmuxing: 0, lms_transcoding_sd: 0, lms_transcoding_hd: 0, lms_transcoding_uhd: 0, lms_audio_only: 0 } data = @parent.duration_of_live(**args).first return nil if data.nil? name = data.keys.first data[name]&.each do |item| transcode[:lms_transmuxing] += item[:transmux].to_f transcode[:lms_audio_only] += item[:audioOnly].to_f transcode[:lms_transcoding_sd] += item[:h264SdTranscoding].to_f + item[:h265SdTranscoding].to_f transcode[:lms_transcoding_hd] += item[:h264HdTranscoding].to_f + item[:h265HdTranscoding].to_f transcode[:lms_transcoding_uhd] += item[:h264UhdTranscoding].to_f + item[:h265UhdTranscoding].to_f end transcode[:lms_transcoding] = transcode[:lms_transcoding_sd] + transcode[:lms_transcoding_hd] + transcode[:lms_transcoding_uhd] transcode rescue StandardError => e logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" nil end |