conversant 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.example +39 -0
- data/.gitignore +52 -0
- data/.gitlab-ci.yml +108 -0
- data/.rspec +3 -0
- data/.rubocop.yml +16 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +487 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +860 -0
- data/RELEASE.md +726 -0
- data/Rakefile +21 -0
- data/conversant.gemspec +49 -0
- data/examples/inheritance_integration.rb +348 -0
- data/examples/rails_initializer.rb +69 -0
- data/lib/conversant/configuration.rb +132 -0
- data/lib/conversant/v3/base.rb +47 -0
- data/lib/conversant/v3/http_client.rb +456 -0
- data/lib/conversant/v3/mixins/authentication.rb +221 -0
- data/lib/conversant/v3/services/authorization.rb +194 -0
- data/lib/conversant/v3/services/cdn/analytics.rb +483 -0
- data/lib/conversant/v3/services/cdn/audit.rb +71 -0
- data/lib/conversant/v3/services/cdn/business.rb +122 -0
- data/lib/conversant/v3/services/cdn/certificate.rb +180 -0
- data/lib/conversant/v3/services/cdn/dashboard.rb +109 -0
- data/lib/conversant/v3/services/cdn/domain.rb +223 -0
- data/lib/conversant/v3/services/cdn/monitoring.rb +65 -0
- data/lib/conversant/v3/services/cdn/partner/analytics.rb +233 -0
- data/lib/conversant/v3/services/cdn/partner.rb +60 -0
- data/lib/conversant/v3/services/cdn.rb +221 -0
- data/lib/conversant/v3/services/lms/dashboard.rb +99 -0
- data/lib/conversant/v3/services/lms/domain.rb +108 -0
- data/lib/conversant/v3/services/lms/job.rb +211 -0
- data/lib/conversant/v3/services/lms/partner/analytics.rb +266 -0
- data/lib/conversant/v3/services/lms/partner/business.rb +151 -0
- data/lib/conversant/v3/services/lms/partner/report.rb +170 -0
- data/lib/conversant/v3/services/lms/partner.rb +58 -0
- data/lib/conversant/v3/services/lms/preset.rb +57 -0
- data/lib/conversant/v3/services/lms.rb +173 -0
- data/lib/conversant/v3/services/oss/partner/analytics.rb +105 -0
- data/lib/conversant/v3/services/oss/partner.rb +48 -0
- data/lib/conversant/v3/services/oss.rb +128 -0
- data/lib/conversant/v3/services/portal/dashboard.rb +114 -0
- data/lib/conversant/v3/services/portal.rb +219 -0
- data/lib/conversant/v3/services/vms/analytics.rb +114 -0
- data/lib/conversant/v3/services/vms/business.rb +190 -0
- data/lib/conversant/v3/services/vms/partner/analytics.rb +133 -0
- data/lib/conversant/v3/services/vms/partner/business.rb +90 -0
- data/lib/conversant/v3/services/vms/partner.rb +57 -0
- data/lib/conversant/v3/services/vms/transcoding.rb +184 -0
- data/lib/conversant/v3/services/vms.rb +166 -0
- data/lib/conversant/v3.rb +36 -0
- data/lib/conversant/version.rb +5 -0
- data/lib/conversant.rb +108 -0
- data/publish.sh +107 -0
- data/sig/conversant/v3/services/authorization.rbs +34 -0
- data/sig/conversant/v3/services/cdn.rbs +123 -0
- data/sig/conversant/v3/services/lms.rbs +80 -0
- data/sig/conversant/v3/services/portal.rbs +22 -0
- data/sig/conversant/v3/services/vms.rbs +64 -0
- data/sig/conversant/v3.rbs +85 -0
- data/sig/conversant.rbs +37 -0
- metadata +267 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conversant
|
|
4
|
+
module V3
|
|
5
|
+
module Services
|
|
6
|
+
class LMS
|
|
7
|
+
class Partner
|
|
8
|
+
# LMS analytics service for partner-level reporting
|
|
9
|
+
#
|
|
10
|
+
# Provides partner-level analytics and reporting for Live Media Streaming services
|
|
11
|
+
# including live duration, recording duration, transcoding metrics, and job statistics
|
|
12
|
+
# across multiple customer accounts.
|
|
13
|
+
#
|
|
14
|
+
# @since 1.0.12
|
|
15
|
+
class Analytics
|
|
16
|
+
# @return [Conversant::V3::Services::LMS] the parent LMS service instance
|
|
17
|
+
attr_reader :parent
|
|
18
|
+
|
|
19
|
+
# Initialize partner LMS analytics service
|
|
20
|
+
#
|
|
21
|
+
# @param parent [Conversant::V3::Services::LMS] the parent LMS service instance
|
|
22
|
+
def initialize(parent)
|
|
23
|
+
@parent = parent
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Get report service instance
|
|
27
|
+
#
|
|
28
|
+
# Provides access to detailed partner-level reporting for LMS services
|
|
29
|
+
# including transcoding, recording, jobs, and DRM analytics.
|
|
30
|
+
#
|
|
31
|
+
# @return [Report] report service for LMS detailed analytics
|
|
32
|
+
# @since 1.0.15
|
|
33
|
+
#
|
|
34
|
+
# @example Access report methods
|
|
35
|
+
# lms = Conversant::V3.lms(12345)
|
|
36
|
+
# report = lms.partner.analytics.report
|
|
37
|
+
# transcodings = report.transcodings(startTime: '2025-01-01', endTime: '2025-01-31')
|
|
38
|
+
def report
|
|
39
|
+
@report ||= Report.new(self)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Get business service instance
|
|
43
|
+
#
|
|
44
|
+
# Provides access to business-focused analytics that aggregate transcoding,
|
|
45
|
+
# recording, and streaming data for billing and capacity planning.
|
|
46
|
+
#
|
|
47
|
+
# @return [Business] business service for LMS aggregated analytics
|
|
48
|
+
# @since 1.0.15
|
|
49
|
+
#
|
|
50
|
+
# @example Access business methods
|
|
51
|
+
# lms = Conversant::V3.lms(12345)
|
|
52
|
+
# business = lms.partner.analytics.business
|
|
53
|
+
# metrics = business.transcoding(startTime: Time.now.beginning_of_month)
|
|
54
|
+
def business
|
|
55
|
+
@business ||= Business.new(self)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Get duration of live streaming for business usage reporting
|
|
59
|
+
#
|
|
60
|
+
# @param args [Hash] query parameters
|
|
61
|
+
# @option args [Time, String] :startTime start time for the report (defaults to beginning of current month)
|
|
62
|
+
# @option args [String, Integer] :type customer type filter (defaults to 2)
|
|
63
|
+
#
|
|
64
|
+
# @return [Array] live streaming duration data, or empty array on error
|
|
65
|
+
# @since 1.0.8
|
|
66
|
+
def duration_of_live(**args)
|
|
67
|
+
month, type, timestamp = queries(**args)
|
|
68
|
+
|
|
69
|
+
payload = {
|
|
70
|
+
month: month,
|
|
71
|
+
selectType: 'ltd',
|
|
72
|
+
customerType: type,
|
|
73
|
+
_: timestamp
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}")
|
|
77
|
+
return [] if response.nil?
|
|
78
|
+
|
|
79
|
+
JSON.parse(response)&.map(&:with_indifferent_access) || []
|
|
80
|
+
rescue StandardError => e
|
|
81
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
82
|
+
[]
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Get duration of live recording for business usage reporting
|
|
86
|
+
#
|
|
87
|
+
# @param args [Hash] query parameters
|
|
88
|
+
# @option args [Time, String] :startTime start time for the report (defaults to beginning of current month)
|
|
89
|
+
# @option args [String, Integer] :type customer type filter (defaults to 2)
|
|
90
|
+
#
|
|
91
|
+
# @return [Array] recording duration data, or empty array on error
|
|
92
|
+
# @since 1.0.8
|
|
93
|
+
def duration_of_live_recording(**args)
|
|
94
|
+
month, type, timestamp = queries(**args)
|
|
95
|
+
|
|
96
|
+
payload = {
|
|
97
|
+
month: month,
|
|
98
|
+
selectType: 'rtd',
|
|
99
|
+
customerType: type,
|
|
100
|
+
_: timestamp
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}")
|
|
104
|
+
return [] if response.nil?
|
|
105
|
+
|
|
106
|
+
JSON.parse(response)&.map(&:with_indifferent_access) || []
|
|
107
|
+
rescue StandardError => e
|
|
108
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
109
|
+
[]
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Get number of live streaming jobs for business usage reporting
|
|
113
|
+
#
|
|
114
|
+
# @param args [Hash] query parameters
|
|
115
|
+
# @option args [Time, String] :startTime start time for the report (defaults to beginning of current month)
|
|
116
|
+
# @option args [String, Integer] :type customer type filter (defaults to 2)
|
|
117
|
+
#
|
|
118
|
+
# @return [Array] live job count data, or empty array on error
|
|
119
|
+
# @since 1.0.8
|
|
120
|
+
def no_of_live_jobs(**args)
|
|
121
|
+
month, type, timestamp = queries(**args)
|
|
122
|
+
|
|
123
|
+
payload = {
|
|
124
|
+
month: month,
|
|
125
|
+
selectType: 'ltn',
|
|
126
|
+
customerType: type,
|
|
127
|
+
_: timestamp
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
response = @parent.send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}")
|
|
131
|
+
return [] if response.nil?
|
|
132
|
+
|
|
133
|
+
JSON.parse(response)&.map(&:with_indifferent_access) || []
|
|
134
|
+
rescue StandardError => e
|
|
135
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
136
|
+
[]
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Get duration metrics by scope (live/recording/transcoding)
|
|
140
|
+
#
|
|
141
|
+
# @param scope [String] scope type (e.g., 'live', 'recording', 'transcoding')
|
|
142
|
+
# @param params [Hash] query parameters
|
|
143
|
+
#
|
|
144
|
+
# @return [Array] duration data for specified scope, or empty array on error
|
|
145
|
+
# @since 1.0.8
|
|
146
|
+
def durations(scope, params = {})
|
|
147
|
+
query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
|
|
148
|
+
uri = "/v2/reporting/lms/#{scope}/duration"
|
|
149
|
+
uri += "?#{query_string}" unless query_string.empty?
|
|
150
|
+
response = @parent.send(:call, 'GET', uri)
|
|
151
|
+
return [] if response.nil?
|
|
152
|
+
|
|
153
|
+
JSON.parse(response)&.map(&:with_indifferent_access) || []
|
|
154
|
+
rescue StandardError => e
|
|
155
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
156
|
+
[]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Get transcoding duration metrics
|
|
160
|
+
#
|
|
161
|
+
# @param params [Hash] query parameters
|
|
162
|
+
# @option params [String] :startTime start time
|
|
163
|
+
# @option params [String] :endTime end time
|
|
164
|
+
#
|
|
165
|
+
# @return [Hash] transcoding duration data, or nil on error
|
|
166
|
+
# @since 1.0.8
|
|
167
|
+
def transcodings(params = {})
|
|
168
|
+
query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
|
|
169
|
+
uri = '/reporting/lms/transcoding/duration'
|
|
170
|
+
uri += "?#{query_string}" unless query_string.empty?
|
|
171
|
+
response = @parent.send(:call, 'GET', uri)
|
|
172
|
+
JSON.parse(response)
|
|
173
|
+
rescue StandardError => e
|
|
174
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
175
|
+
nil
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Get recording duration metrics
|
|
179
|
+
#
|
|
180
|
+
# @param params [Hash] query parameters
|
|
181
|
+
# @option params [String] :startTime start time
|
|
182
|
+
# @option params [String] :endTime end time
|
|
183
|
+
#
|
|
184
|
+
# @return [Hash] recording duration data, or nil on error
|
|
185
|
+
# @since 1.0.8
|
|
186
|
+
def recordings(params = {})
|
|
187
|
+
query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
|
|
188
|
+
uri = '/reporting/lms/recording/duration'
|
|
189
|
+
uri += "?#{query_string}" unless query_string.empty?
|
|
190
|
+
response = @parent.send(:call, 'GET', uri)
|
|
191
|
+
JSON.parse(response)
|
|
192
|
+
rescue StandardError => e
|
|
193
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
194
|
+
nil
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Get transcoding job count metrics
|
|
198
|
+
#
|
|
199
|
+
# @param params [Hash] query parameters
|
|
200
|
+
# @option params [String] :startTime start time
|
|
201
|
+
# @option params [String] :endTime end time
|
|
202
|
+
#
|
|
203
|
+
# @return [Hash] job count data, or nil on error
|
|
204
|
+
# @since 1.0.8
|
|
205
|
+
def jobs(params = {})
|
|
206
|
+
query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
|
|
207
|
+
uri = '/reporting/lms/transcoding/number'
|
|
208
|
+
uri += "?#{query_string}" unless query_string.empty?
|
|
209
|
+
response = @parent.send(:call, 'GET', uri)
|
|
210
|
+
JSON.parse(response)
|
|
211
|
+
rescue StandardError => e
|
|
212
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
213
|
+
nil
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Get transcoding duration metrics (v2 endpoint)
|
|
217
|
+
#
|
|
218
|
+
# @param params [Hash] query parameters
|
|
219
|
+
# @option params [String] :startTime start time
|
|
220
|
+
# @option params [String] :endTime end time
|
|
221
|
+
#
|
|
222
|
+
# @return [Hash, nil] transcoding duration data, or nil on error
|
|
223
|
+
# @since 1.0.8
|
|
224
|
+
def duration_v2_transcoding(params = {})
|
|
225
|
+
query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
|
|
226
|
+
uri = '/v2/reporting/lms/transcoding/duration'
|
|
227
|
+
uri += "?#{query_string}" unless query_string.empty?
|
|
228
|
+
response = @parent.send(:call, 'GET', uri)
|
|
229
|
+
return nil if response.nil?
|
|
230
|
+
|
|
231
|
+
JSON.parse(response)
|
|
232
|
+
rescue StandardError => e
|
|
233
|
+
@parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
234
|
+
nil
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
private
|
|
238
|
+
|
|
239
|
+
def logger
|
|
240
|
+
@parent.send(:logger)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Helper method to build query parameters
|
|
244
|
+
#
|
|
245
|
+
# Generates month, customer type, and timestamp parameters for LMS business usage queries.
|
|
246
|
+
# Defaults to current month if startTime is not provided.
|
|
247
|
+
#
|
|
248
|
+
# @param args [Hash] Input parameters
|
|
249
|
+
# @option args [Time, String] :startTime Start time for the report (defaults to beginning of current month)
|
|
250
|
+
# @option args [String, Integer] :type Customer type filter (defaults to parent's type or 2)
|
|
251
|
+
#
|
|
252
|
+
# @return [Array<String, Integer, Integer>] Array containing [month (YYYYMM), customer_type, timestamp (ms)]
|
|
253
|
+
def queries(**args)
|
|
254
|
+
month = (args[:startTime] || Time.now&.beginning_of_month)&.to_datetime&.strftime('%Y%m')
|
|
255
|
+
customer_type = args[:type]
|
|
256
|
+
customer_type = @parent.type || 2 unless customer_type.present?
|
|
257
|
+
timestamp = Time.now.getutc.to_i * 1000
|
|
258
|
+
|
|
259
|
+
[month, customer_type, timestamp]
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conversant
|
|
4
|
+
module V3
|
|
5
|
+
module Services
|
|
6
|
+
class LMS
|
|
7
|
+
class Partner
|
|
8
|
+
# LMS Business analytics for partner-level business reporting
|
|
9
|
+
#
|
|
10
|
+
# Provides business-focused analytics methods that aggregate transcoding,
|
|
11
|
+
# recording, and streaming data for billing and capacity planning.
|
|
12
|
+
#
|
|
13
|
+
# @since 1.0.15
|
|
14
|
+
class Business
|
|
15
|
+
# @return [Conversant::V3::Services::LMS::Partner::Analytics] the parent analytics instance
|
|
16
|
+
attr_reader :parent
|
|
17
|
+
|
|
18
|
+
# Initialize partner LMS business service
|
|
19
|
+
#
|
|
20
|
+
# @param parent [Conversant::V3::Services::LMS::Partner::Analytics] the parent analytics instance
|
|
21
|
+
def initialize(parent)
|
|
22
|
+
@parent = parent
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Fetches transcoding business analytics with codec breakdown
|
|
26
|
+
#
|
|
27
|
+
# Aggregates transcoding data including transmuxing, audio-only, and transcoding
|
|
28
|
+
# across different resolutions (SD, HD, UHD) and codecs (H264, H265).
|
|
29
|
+
#
|
|
30
|
+
# @param args [Hash] Parameters for the query
|
|
31
|
+
# @option args [Time, String] :startTime start time for the report (defaults to beginning of current month)
|
|
32
|
+
# @option args [String, Integer] :type customer type filter (defaults to 2)
|
|
33
|
+
#
|
|
34
|
+
# @return [Hash, nil] Transcoding business data with breakdown by codec and resolution, or nil if no data
|
|
35
|
+
#
|
|
36
|
+
# @example Get transcoding business metrics
|
|
37
|
+
# business = lms.partner.analytics.business
|
|
38
|
+
# metrics = business.transcoding(startTime: Time.now.beginning_of_month)
|
|
39
|
+
# puts "Total transcoding: #{metrics[:lms_transcoding]} minutes"
|
|
40
|
+
# puts "SD: #{metrics[:lms_transcoding_sd]}, HD: #{metrics[:lms_transcoding_hd]}, UHD: #{metrics[:lms_transcoding_uhd]}"
|
|
41
|
+
#
|
|
42
|
+
# @since 1.0.15
|
|
43
|
+
def transcoding(**args)
|
|
44
|
+
transcode = {
|
|
45
|
+
lms_transcoding: 0,
|
|
46
|
+
lms_transmuxing: 0,
|
|
47
|
+
lms_transcoding_sd: 0,
|
|
48
|
+
lms_transcoding_hd: 0,
|
|
49
|
+
lms_transcoding_uhd: 0,
|
|
50
|
+
lms_audio_only: 0
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
data = @parent.duration_of_live(**args).first
|
|
54
|
+
return nil if data.nil?
|
|
55
|
+
|
|
56
|
+
name = data.keys.first
|
|
57
|
+
|
|
58
|
+
data[name]&.each do |item|
|
|
59
|
+
transcode[:lms_transmuxing] += item[:transmux].to_f
|
|
60
|
+
transcode[:lms_audio_only] += item[:audioOnly].to_f
|
|
61
|
+
transcode[:lms_transcoding_sd] += item[:h264SdTranscoding].to_f + item[:h265SdTranscoding].to_f
|
|
62
|
+
transcode[:lms_transcoding_hd] += item[:h264HdTranscoding].to_f + item[:h265HdTranscoding].to_f
|
|
63
|
+
transcode[:lms_transcoding_uhd] += item[:h264UhdTranscoding].to_f + item[:h265UhdTranscoding].to_f
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
transcode[:lms_transcoding] =
|
|
67
|
+
transcode[:lms_transcoding_sd] + transcode[:lms_transcoding_hd] + transcode[:lms_transcoding_uhd]
|
|
68
|
+
transcode
|
|
69
|
+
rescue StandardError => e
|
|
70
|
+
logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
71
|
+
nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Fetches recording business analytics with codec breakdown
|
|
75
|
+
#
|
|
76
|
+
# Aggregates recording data including total recording duration, transmuxing,
|
|
77
|
+
# audio-only, and transcoding across different resolutions and codecs.
|
|
78
|
+
#
|
|
79
|
+
# @param args [Hash] Parameters for the query
|
|
80
|
+
# @option args [Time, String] :startTime start time for the report (defaults to beginning of current month)
|
|
81
|
+
# @option args [String, Integer] :type customer type filter (defaults to 2)
|
|
82
|
+
#
|
|
83
|
+
# @return [Hash, nil] Recording business data with breakdown by codec and resolution, or nil if no data
|
|
84
|
+
#
|
|
85
|
+
# @example Get recording business metrics
|
|
86
|
+
# business = lms.partner.analytics.business
|
|
87
|
+
# metrics = business.recording(startTime: Time.now.beginning_of_month)
|
|
88
|
+
# puts "Total recording: #{metrics[:lms_recording]} minutes"
|
|
89
|
+
#
|
|
90
|
+
# @since 1.0.15
|
|
91
|
+
def recording(**args)
|
|
92
|
+
recording = {
|
|
93
|
+
lms_recording: 0,
|
|
94
|
+
lms_transmuxing: 0,
|
|
95
|
+
lms_transcoding_sd: 0,
|
|
96
|
+
lms_transcoding_hd: 0,
|
|
97
|
+
lms_transcoding_uhd: 0,
|
|
98
|
+
lms_audio_only: 0
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
data = @parent.duration_of_live_recording(**args).first
|
|
102
|
+
return nil if data.nil?
|
|
103
|
+
|
|
104
|
+
name = data.keys.first
|
|
105
|
+
|
|
106
|
+
data[name]&.each do |item|
|
|
107
|
+
recording[:lms_recording] += item[:total].to_f
|
|
108
|
+
recording[:lms_transmuxing] += item[:transmux].to_f
|
|
109
|
+
recording[:lms_audio_only] += item[:audioOnly].to_f
|
|
110
|
+
recording[:lms_transcoding_sd] += item[:h264SdTranscoding].to_f + item[:h265SdTranscoding].to_f
|
|
111
|
+
recording[:lms_transcoding_hd] += item[:h264HdTranscoding].to_f + item[:h265HdTranscoding].to_f
|
|
112
|
+
recording[:lms_transcoding_uhd] += item[:h264UhdTranscoding].to_f + item[:h265UhdTranscoding].to_f
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
recording
|
|
116
|
+
rescue StandardError => e
|
|
117
|
+
logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
118
|
+
nil
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Fetches stream jobs data
|
|
122
|
+
#
|
|
123
|
+
# Retrieves the number of live streaming jobs for business usage reporting.
|
|
124
|
+
# This is an alias for the parent analytics' no_of_live_jobs method.
|
|
125
|
+
#
|
|
126
|
+
# @param args [Hash] Parameters for the query
|
|
127
|
+
# @option args [Time, String] :startTime start time for the report (defaults to beginning of current month)
|
|
128
|
+
# @option args [String, Integer] :type customer type filter (defaults to 2)
|
|
129
|
+
#
|
|
130
|
+
# @return [Array] Stream jobs count data, or empty array on error
|
|
131
|
+
#
|
|
132
|
+
# @example Get stream jobs count
|
|
133
|
+
# business = lms.partner.analytics.business
|
|
134
|
+
# jobs = business.stream_jobs(startTime: Time.now.beginning_of_month)
|
|
135
|
+
#
|
|
136
|
+
# @since 1.0.15
|
|
137
|
+
def stream_jobs(**args)
|
|
138
|
+
@parent.no_of_live_jobs(**args)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
private
|
|
142
|
+
|
|
143
|
+
def logger
|
|
144
|
+
@parent.send(:logger)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conversant
|
|
4
|
+
module V3
|
|
5
|
+
module Services
|
|
6
|
+
class LMS
|
|
7
|
+
class Partner
|
|
8
|
+
# LMS Report analytics for detailed partner-level reporting
|
|
9
|
+
#
|
|
10
|
+
# Provides detailed reporting methods for transcoding, recording, jobs,
|
|
11
|
+
# DRM analytics, and business usage data.
|
|
12
|
+
#
|
|
13
|
+
# @since 1.0.15
|
|
14
|
+
class Report
|
|
15
|
+
# @return [Conversant::V3::Services::LMS::Partner::Analytics] the parent analytics instance
|
|
16
|
+
attr_reader :parent
|
|
17
|
+
|
|
18
|
+
# Initialize partner LMS report service
|
|
19
|
+
#
|
|
20
|
+
# @param parent [Conversant::V3::Services::LMS::Partner::Analytics] the parent analytics instance
|
|
21
|
+
def initialize(parent)
|
|
22
|
+
@parent = parent
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Fetches transcoding analytics data
|
|
26
|
+
#
|
|
27
|
+
# Retrieves detailed transcoding duration metrics for live streaming services,
|
|
28
|
+
# useful for billing calculations and capacity planning.
|
|
29
|
+
#
|
|
30
|
+
# @param payload [Hash] Parameters for the query
|
|
31
|
+
# @option payload [String] :startTime start time in ISO 8601 format or timestamp
|
|
32
|
+
# @option payload [String] :endTime end time in ISO 8601 format or timestamp
|
|
33
|
+
#
|
|
34
|
+
# @return [Hash, nil] Transcoding duration data with breakdown by resolution and codec, or nil on error
|
|
35
|
+
#
|
|
36
|
+
# @example Get transcoding data for a time range
|
|
37
|
+
# report = lms.partner.analytics.report
|
|
38
|
+
# data = report.transcodings(startTime: '2025-01-01', endTime: '2025-01-31')
|
|
39
|
+
#
|
|
40
|
+
# @since 1.0.15
|
|
41
|
+
def transcodings(payload)
|
|
42
|
+
response = @parent.instance_variable_get(:@parent).send(:call, 'GET', "/reporting/lms/transcoding/duration?#{payload.to_query}")
|
|
43
|
+
return nil if response.nil?
|
|
44
|
+
|
|
45
|
+
JSON.parse(response)
|
|
46
|
+
rescue StandardError => e
|
|
47
|
+
logger.error "#{identifier}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
48
|
+
nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Fetches recording analytics data
|
|
52
|
+
#
|
|
53
|
+
# Retrieves detailed recording duration metrics for live streaming recordings,
|
|
54
|
+
# including breakdown by codec and resolution for billing purposes.
|
|
55
|
+
#
|
|
56
|
+
# @param payload [Hash] Parameters for the query
|
|
57
|
+
# @option payload [String] :startTime start time in ISO 8601 format or timestamp
|
|
58
|
+
# @option payload [String] :endTime end time in ISO 8601 format or timestamp
|
|
59
|
+
#
|
|
60
|
+
# @return [Hash, nil] Recording duration data with codec breakdown, or nil on error
|
|
61
|
+
#
|
|
62
|
+
# @example Get recording data for a time range
|
|
63
|
+
# report = lms.partner.analytics.report
|
|
64
|
+
# data = report.recordings(startTime: '2025-01-01', endTime: '2025-01-31')
|
|
65
|
+
#
|
|
66
|
+
# @since 1.0.15
|
|
67
|
+
def recordings(payload)
|
|
68
|
+
response = @parent.instance_variable_get(:@parent).send(:call, 'GET', "/reporting/lms/recording/duration?#{payload.to_query}")
|
|
69
|
+
return nil if response.nil?
|
|
70
|
+
|
|
71
|
+
JSON.parse(response)
|
|
72
|
+
rescue StandardError => e
|
|
73
|
+
logger.error "#{identifier}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
74
|
+
nil
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Fetches transcoding jobs count analytics
|
|
78
|
+
#
|
|
79
|
+
# Retrieves the number of transcoding jobs executed within a specified time range,
|
|
80
|
+
# useful for understanding service usage patterns and billing.
|
|
81
|
+
#
|
|
82
|
+
# @param payload [Hash] Parameters for the query
|
|
83
|
+
# @option payload [String] :startTime start time in ISO 8601 format or timestamp
|
|
84
|
+
# @option payload [String] :endTime end time in ISO 8601 format or timestamp
|
|
85
|
+
#
|
|
86
|
+
# @return [Hash, nil] Jobs count data by time period, or nil on error
|
|
87
|
+
#
|
|
88
|
+
# @example Get job counts for a time range
|
|
89
|
+
# report = lms.partner.analytics.report
|
|
90
|
+
# data = report.jobs(startTime: '2025-01-01', endTime: '2025-01-31')
|
|
91
|
+
#
|
|
92
|
+
# @since 1.0.15
|
|
93
|
+
def jobs(payload)
|
|
94
|
+
response = @parent.instance_variable_get(:@parent).send(:call, 'GET', "/reporting/lms/transcoding/number?#{payload.to_query}")
|
|
95
|
+
return nil if response.nil?
|
|
96
|
+
|
|
97
|
+
JSON.parse(response)
|
|
98
|
+
rescue StandardError => e
|
|
99
|
+
logger.error "#{identifier}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
100
|
+
nil
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Fetches v2 transcoding duration data
|
|
104
|
+
#
|
|
105
|
+
# Retrieves transcoding duration metrics using the v2 API endpoint.
|
|
106
|
+
# This provides backward compatibility with the legacy reporting format.
|
|
107
|
+
#
|
|
108
|
+
# @param payload [Hash] Parameters for the query
|
|
109
|
+
# @option payload [String] :startTime start time in ISO 8601 format or timestamp
|
|
110
|
+
# @option payload [String] :endTime end time in ISO 8601 format or timestamp
|
|
111
|
+
#
|
|
112
|
+
# @return [Hash, nil] Transcoding duration data in v2 format, or nil on error
|
|
113
|
+
#
|
|
114
|
+
# @example Get v2 transcoding duration
|
|
115
|
+
# report = lms.partner.analytics.report
|
|
116
|
+
# data = report.duration_v2_transcoding(startTime: '2025-01-01', endTime: '2025-01-31')
|
|
117
|
+
#
|
|
118
|
+
# @since 1.0.15
|
|
119
|
+
def duration_v2_transcoding(payload)
|
|
120
|
+
response = @parent.instance_variable_get(:@parent).send(:call, 'GET', "/v2/reporting/lms/transcoding/duration?#{payload.to_query}")
|
|
121
|
+
return nil if response.nil?
|
|
122
|
+
|
|
123
|
+
JSON.parse(response)
|
|
124
|
+
rescue StandardError => e
|
|
125
|
+
logger.error "#{identifier}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
126
|
+
nil
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Fetches business live usage data
|
|
130
|
+
#
|
|
131
|
+
# Retrieves business-level live streaming usage data aggregated by month,
|
|
132
|
+
# including filtering by customer type and metric selection type.
|
|
133
|
+
#
|
|
134
|
+
# @param payload [Hash] Parameters for the query
|
|
135
|
+
# @option payload [String] :month month in YYYYMM format (e.g., '202501' for January 2025)
|
|
136
|
+
# @option payload [String] :selectType select type filter ('ltd' for live duration, 'rtd' for recording, 'ltn' for job count)
|
|
137
|
+
# @option payload [String] :customerType customer type filter (e.g., '2' for standard customers)
|
|
138
|
+
#
|
|
139
|
+
# @return [Hash, nil] Business live usage data with detailed metrics, or nil on error
|
|
140
|
+
#
|
|
141
|
+
# @example Get live duration for January 2025
|
|
142
|
+
# report = lms.partner.analytics.report
|
|
143
|
+
# data = report.bussiness_live_usage(month: '202501', selectType: 'ltd', customerType: '2')
|
|
144
|
+
#
|
|
145
|
+
# @since 1.0.15
|
|
146
|
+
def bussiness_live_usage(payload)
|
|
147
|
+
response = @parent.instance_variable_get(:@parent).send(:call, 'GET', "/v4/reporting/lms/business/usage/search?#{payload.to_query}")
|
|
148
|
+
return nil if response.nil?
|
|
149
|
+
|
|
150
|
+
JSON.parse(response)
|
|
151
|
+
rescue StandardError => e
|
|
152
|
+
logger.error "#{identifier}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
|
|
153
|
+
nil
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
private
|
|
157
|
+
|
|
158
|
+
def logger
|
|
159
|
+
@parent.instance_variable_get(:@parent).send(:logger)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def identifier
|
|
163
|
+
@parent.instance_variable_get(:@parent).send(:identifier)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Conversant
|
|
4
|
+
module V3
|
|
5
|
+
module Services
|
|
6
|
+
class LMS
|
|
7
|
+
# Partner service for LMS partner-level operations
|
|
8
|
+
#
|
|
9
|
+
# Provides access to partner-level analytics for Live Media Streaming
|
|
10
|
+
# that aggregate data across multiple customer accounts.
|
|
11
|
+
#
|
|
12
|
+
# @example Access partner analytics
|
|
13
|
+
# lms = Conversant::V3.lms(12345)
|
|
14
|
+
#
|
|
15
|
+
# # Partner-level LMS analytics
|
|
16
|
+
# duration = lms.partner.analytics.duration({
|
|
17
|
+
# startTime: "2025-01-01T00:00:00Z",
|
|
18
|
+
# endTime: "2025-01-31T23:59:59Z"
|
|
19
|
+
# })
|
|
20
|
+
#
|
|
21
|
+
# @since 1.0.12
|
|
22
|
+
class Partner
|
|
23
|
+
# @return [LMS] the parent LMS service instance
|
|
24
|
+
attr_reader :parent
|
|
25
|
+
|
|
26
|
+
# Initialize partner service
|
|
27
|
+
#
|
|
28
|
+
# @param parent [LMS] the parent LMS service instance
|
|
29
|
+
def initialize(parent)
|
|
30
|
+
@parent = parent
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Get partner analytics service instance
|
|
34
|
+
#
|
|
35
|
+
# Provides partner-level analytics for LMS services including streaming
|
|
36
|
+
# duration, bandwidth, and viewer metrics across multiple customers.
|
|
37
|
+
#
|
|
38
|
+
# @return [Analytics] LMS partner analytics service
|
|
39
|
+
# @since 1.0.12
|
|
40
|
+
def analytics
|
|
41
|
+
@analytics ||= Analytics.new(@parent)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def logger
|
|
47
|
+
@parent.send(:logger)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Load nested analytics class after Partner is defined
|
|
56
|
+
require_relative 'partner/analytics'
|
|
57
|
+
require_relative 'partner/report'
|
|
58
|
+
require_relative 'partner/business'
|