Class: Conversant::V3::Services::VMS::Partner::Business
- Inherits:
-
Object
- Object
- Conversant::V3::Services::VMS::Partner::Business
- Defined in:
- lib/conversant/v3/services/vms/partner/business.rb
Overview
VMS Business analytics for partner-level business reporting
Provides business-focused analytics methods that aggregate transcoding data for VOD (Video on Demand) billing and capacity planning.
Instance Attribute Summary collapse
-
#parent ⇒ Conversant::V3::Services::VMS::Partner::Analytics
readonly
The parent analytics instance.
Instance Method Summary collapse
-
#initialize(parent) ⇒ Business
constructor
Initialize partner VMS business service.
-
#transcoding(**args) ⇒ Hash
Fetches transcoding business analytics with codec breakdown.
Constructor Details
#initialize(parent) ⇒ Business
Initialize partner VMS business service
21 22 23 |
# File 'lib/conversant/v3/services/vms/partner/business.rb', line 21 def initialize(parent) @parent = parent end |
Instance Attribute Details
#parent ⇒ Conversant::V3::Services::VMS::Partner::Analytics (readonly)
Returns the parent analytics instance.
16 17 18 |
# File 'lib/conversant/v3/services/vms/partner/business.rb', line 16 def parent @parent end |
Instance Method Details
#transcoding(**args) ⇒ Hash
Fetches transcoding business analytics with codec breakdown
Aggregates VOD transcoding data including transmuxing and transcoding across different resolutions (SD, HD, UHD) and codecs (H264, H265).
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/conversant/v3/services/vms/partner/business.rb', line 49 def transcoding(**args) transcoding = { vms_transcoding: 0, vms_transmuxing: 0, vms_transcoding_sd: 0, vms_transcoding_hd: 0, vms_transcoding_uhd: 0 } data = @parent.duration_of_vod(**args).first return transcoding if data.nil? name = data.keys.first if data[name].present? data[name].each do |item| transcoding[:vms_transmuxing] += item['transmux'].to_f transcoding[:vms_transcoding_sd] += item['h264SdTranscoding'].to_f + item['h265SdTranscoding'].to_f transcoding[:vms_transcoding_hd] += item['h264HdTranscoding'].to_f + item['h265HdTranscoding'].to_f transcoding[:vms_transcoding_uhd] += item['h264UhdTranscoding'].to_f + item['h265UhdTranscoding'].to_f end end transcoding[:vms_transcoding] = transcoding[:vms_transcoding_sd] + transcoding[:vms_transcoding_hd] + transcoding[:vms_transcoding_uhd] transcoding rescue StandardError => e logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}" transcoding end |