Class: Conversant::V3::Services::CDN::Business
- Inherits:
-
Object
- Object
- Conversant::V3::Services::CDN::Business
- Defined in:
- lib/conversant/v3/services/cdn/business.rb
Overview
Business metrics service for CDN billing and usage reporting
Provides access to business-level metrics used for billing calculations, usage reporting, and 95th percentile bandwidth measurements. These metrics are typically used for financial reporting and capacity planning.
Instance Attribute Summary collapse
-
#parent ⇒ CDN
readonly
The parent CDN service instance.
Instance Method Summary collapse
-
#bandwidth(payload) ⇒ Array
Get domain traffic usage for billing.
-
#bandwidth95th(params) ⇒ Array
Get 95th percentile bandwidth measurements.
-
#initialize(parent) ⇒ Business
constructor
Initialize business metrics service.
Constructor Details
#initialize(parent) ⇒ Business
Initialize business metrics service
35 36 37 |
# File 'lib/conversant/v3/services/cdn/business.rb', line 35 def initialize(parent) @parent = parent end |
Instance Attribute Details
#parent ⇒ CDN (readonly)
Returns the parent CDN service instance.
30 31 32 |
# File 'lib/conversant/v3/services/cdn/business.rb', line 30 def parent @parent end |
Instance Method Details
#bandwidth(payload) ⇒ Array
Get domain traffic usage for billing
Retrieves detailed traffic usage data by domain for billing and reporting purposes. This data is typically used for invoicing and usage analysis.
67 68 69 70 71 72 73 74 75 |
# File 'lib/conversant/v3/services/cdn/business.rb', line 67 def bandwidth(payload) response = @parent.send(:call, 'POST', '/api/domain_traffic_usage', payload) return [] if response.nil? JSON.parse(response)&.[]('list') || [] rescue StandardError => e logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |
#bandwidth95th(params) ⇒ Array
Get 95th percentile bandwidth measurements
Retrieves 95th percentile bandwidth measurements for the specified year. This metric is commonly used in CDN billing to calculate peak usage while excluding traffic spikes that occur less than 5% of the time.
103 104 105 106 107 108 109 110 111 |
# File 'lib/conversant/v3/services/cdn/business.rb', line 103 def bandwidth95th(params) response = @parent.send(:call, 'GET', "/api/report/bandwidth95th/#{params[:year]}", nil) return [] if response.nil? JSON.parse(response) rescue StandardError => e logger.error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.}" [] end |