Class: Conversant::V3::Services::CDN::Analytics
- Inherits:
-
Object
- Object
- Conversant::V3::Services::CDN::Analytics
- Defined in:
- lib/conversant/v3/services/cdn/analytics.rb,
sig/conversant/v3/services/cdn.rbs
Overview
Nested service classes
Instance Attribute Summary collapse
-
#parent ⇒ CDN
readonly
The parent CDN service instance.
Instance Method Summary collapse
-
#bandwidths(payload) ⇒ Hash?
Get bandwidth analytics data.
-
#byte_hit_rate(params) ⇒ Hash?
Get byte hit rate analytics.
-
#http_codes(payload) ⇒ Hash?
Get HTTP status code analytics.
-
#initialize(parent) ⇒ Analytics
constructor
Initialize analytics service.
-
#isp(payload) ⇒ Array
Get ISP analytics.
- #logger ⇒ Object
-
#number_of_concurrent_viewers(payload) ⇒ Array
Get number of concurrent viewers by domain.
-
#origin_bandwidth(payload) ⇒ Array
Get origin bandwidth analytics.
-
#origin_http_codes(payload) ⇒ Array
Get origin HTTP status codes.
-
#origin_request(payload) ⇒ Hash?
Get origin request analytics.
-
#popular_content_url_by_domain(payload) ⇒ Array
Get popular content URLs by domain.
-
#popular_content_url_csv_by_domain(payload) ⇒ String?
Get popular content URL CSV export by domain.
-
#popular_content_url_total_by_domain(payload) ⇒ Hash?
Get total popular content URL count by domain.
-
#referrer_by_domain(payload) ⇒ Array
Get referrer analytics by domain.
-
#referrer_csv_by_domain(payload) ⇒ String?
Get referrer CSV export by domain.
-
#referrer_total_by_domain(payload) ⇒ Hash?
Get total referrer count by domain.
-
#request_hit_rate(params) ⇒ Hash?
Get request hit rate analytics.
-
#request_per_second(payload) ⇒ Hash?
Get requests per second (RPS) analytics.
-
#request_visit_number(payload) ⇒ Hash?
Get request and visit number statistics.
-
#user_agent(payload) ⇒ Array
Get user agent analytics by domain.
-
#user_agent_csv(payload) ⇒ String?
Get user agent CSV export by domain.
-
#viewers(payload) ⇒ Array?
Get viewer analytics data.
-
#volumes(payload) ⇒ Hash?
Get volume analytics data.
Constructor Details
#initialize(parent) ⇒ Analytics
Initialize analytics service
45 46 47 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 45 def initialize(parent) @parent = parent end |
Instance Attribute Details
#parent ⇒ CDN (readonly)
Returns the parent CDN service instance.
40 41 42 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 40 def parent @parent end |
Instance Method Details
#bandwidths(payload) ⇒ Hash?
Get bandwidth analytics data
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 73 def bandwidths(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/bandwidth', payload)) if response&.[]('bandwidth') { averageThroughput: response&.[]('averageThroughput'), data: response&.[]('bandwidth') } end rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#byte_hit_rate(params) ⇒ Hash?
Get byte hit rate analytics
326 327 328 329 330 331 332 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 326 def byte_hit_rate(params) query_string = URI.encode_www_form(params) JSON.parse(@parent.send(:call, 'GET', "/api/byte_rate_chart_data?#{query_string}", nil)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#http_codes(payload) ⇒ Hash?
Get HTTP status code analytics
202 203 204 205 206 207 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 202 def http_codes(payload) JSON.parse(@parent.send(:call, 'POST', "/api/report/customers/#{@parent.customer_id}/http_codes", payload)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#isp(payload) ⇒ Array
Get ISP analytics
439 440 441 442 443 444 445 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 439 def isp(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/isp', payload)) response || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#logger ⇒ Object
51 |
# File 'sig/conversant/v3/services/cdn.rbs', line 51
def logger: () -> untyped
|
#number_of_concurrent_viewers(payload) ⇒ Array
Get number of concurrent viewers by domain
352 353 354 355 356 357 358 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 352 def number_of_concurrent_viewers(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/domain/viewers', payload)) response || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#origin_bandwidth(payload) ⇒ Array
Get origin bandwidth analytics
339 340 341 342 343 344 345 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 339 def origin_bandwidth(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/origin_bandwidth', payload)) response || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#origin_http_codes(payload) ⇒ Array
Get origin HTTP status codes
365 366 367 368 369 370 371 372 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 365 def origin_http_codes(payload) customer_id = @parent.send(:customer_id) response = JSON.parse(@parent.send(:call, 'POST', "/api/report/customers/#{customer_id}/origin_http_codes", payload)) response || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#origin_request(payload) ⇒ Hash?
Get origin request analytics
293 294 295 296 297 298 299 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 293 def origin_request(payload) response = JSON.parse(@parent.send(:call, 'GET', "/api/origin_request_chart_data?#{payload.to_query}")) { data: response['requestSpots'] } if response&.[]('requestSpots') rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#popular_content_url_by_domain(payload) ⇒ Array
Get popular content URLs by domain
265 266 267 268 269 270 271 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 265 def popular_content_url_by_domain(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/getUrlByDomain', payload)) response&.[]('list') || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#popular_content_url_csv_by_domain(payload) ⇒ String?
Get popular content URL CSV export by domain
415 416 417 418 419 420 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 415 def popular_content_url_csv_by_domain(payload) @parent.send(:call, 'POST', '/api/report/getUrlCsvByDomain', payload) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#popular_content_url_total_by_domain(payload) ⇒ Hash?
Get total popular content URL count by domain
403 404 405 406 407 408 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 403 def popular_content_url_total_by_domain(payload) JSON.parse(@parent.send(:call, 'POST', '/api/report/getUrlTotalByDomain', payload)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#referrer_by_domain(payload) ⇒ Array
Get referrer analytics by domain
233 234 235 236 237 238 239 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 233 def referrer_by_domain(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/getReferrerByDomain', payload)) response&.[]('list') || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#referrer_csv_by_domain(payload) ⇒ String?
Get referrer CSV export by domain
391 392 393 394 395 396 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 391 def referrer_csv_by_domain(payload) @parent.send(:call, 'POST', '/api/report/getReferrerCsvByDomain', payload) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#referrer_total_by_domain(payload) ⇒ Hash?
Get total referrer count by domain
379 380 381 382 383 384 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 379 def referrer_total_by_domain(payload) JSON.parse(@parent.send(:call, 'POST', '/api/report/getReferrerTotalByDomain', payload)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#request_hit_rate(params) ⇒ Hash?
Get request hit rate analytics
313 314 315 316 317 318 319 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 313 def request_hit_rate(params) query_string = URI.encode_www_form(params) JSON.parse(@parent.send(:call, 'GET', "/api/hit_rate_chart_data?#{query_string}", nil)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#request_per_second(payload) ⇒ Hash?
Get requests per second (RPS) analytics
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 165 def request_per_second(payload) response = JSON.parse(@parent.send(:call, 'GET', "/api/rps_chart_data?#{payload.to_query}")) if response&.[]('datas') { maxQuantity: response['maxQuantity'], avgQuantity: response['avgQuantity'], httpTotalQuantity: response['httpTotalQuantity'], httpsTotalQuantity: response['httpsTotalQuantity'], data: response['datas'] } end rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#request_visit_number(payload) ⇒ Hash?
Get request and visit number statistics
427 428 429 430 431 432 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 427 def request_visit_number(payload) JSON.parse(@parent.send(:call, 'POST', '/api/report/request_visit_number', payload)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#user_agent(payload) ⇒ Array
Get user agent analytics by domain
452 453 454 455 456 457 458 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 452 def user_agent(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/domain/userAgent', payload)) response&.[]('list') || [] rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#user_agent_csv(payload) ⇒ String?
Get user agent CSV export by domain
465 466 467 468 469 470 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 465 def user_agent_csv(payload) @parent.send(:call, 'POST', '/api/report/domain/userAgentCsv', payload) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#viewers(payload) ⇒ Array?
Get viewer analytics data
136 137 138 139 140 141 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 136 def viewers(payload) JSON.parse(@parent.send(:call, 'POST', '/api/report/viewers', payload)) rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |
#volumes(payload) ⇒ Hash?
Get volume analytics data
108 109 110 111 112 113 114 |
# File 'lib/conversant/v3/services/cdn/analytics.rb', line 108 def volumes(payload) response = JSON.parse(@parent.send(:call, 'POST', '/api/report/volume', payload)) { data: response&.[]('volumes') } if response&.[]('volumes') rescue StandardError => e @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" nil end |