Class: ApiReference::BulkWithFiltersConfig
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::BulkWithFiltersConfig
- Defined in:
- lib/api_reference/models/bulk_with_filters_config.rb
Overview
Bulk pricing with event filtering applies bulk pricing tiers based on total usage volume, but only charges for events that match specified property filters. How it works: 1. Tier Selection: Uses the customer's total usage quantity to determine which bulk pricing tier applies 2. Event Filtering: Only counts events where the specified property filters match (supports single or multiple filters) 3. Billing: Charges the filtered quantity at the rate determined by the total usage tier Example: - Total usage: 150 events - Bulk tiers: 0-99 = $1.00, 100+ = $0.80 - Filters: region="us-east-1" AND environment="production" - Filtered events: 75 events matching both filters - Result: 75 events × $0.80 = $60.00 (rate determined by 150 total, but only 75 charged) This allows customers to get bulk discounts based on their total volume while only paying for usage in specific regions, environments, or other filtered categories.
Instance Attribute Summary collapse
-
#filters ⇒ Array[FilterRule]
Property filters to apply (all must match).
-
#tiers ⇒ Array[BulkWithFiltersTier]
Bulk tiers for rating based on total usage volume.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(tiers:, filters:) ⇒ BulkWithFiltersConfig
constructor
A new instance of BulkWithFiltersConfig.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(tiers:, filters:) ⇒ BulkWithFiltersConfig
Returns a new instance of BulkWithFiltersConfig.
50 51 52 53 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 50 def initialize(tiers:, filters:) @tiers = tiers @filters = filters end |
Instance Attribute Details
#filters ⇒ Array[FilterRule]
Property filters to apply (all must match)
30 31 32 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 30 def filters @filters end |
#tiers ⇒ Array[BulkWithFiltersTier]
Bulk tiers for rating based on total usage volume
26 27 28 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 26 def tiers @tiers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it tiers = nil unless hash['tiers'].nil? tiers = [] hash['tiers'].each do |structure| tiers << (BulkWithFiltersTier.from_hash(structure) if structure) end end tiers = nil unless hash.key?('tiers') # Parameter is an array, so we need to iterate through it filters = nil unless hash['filters'].nil? filters = [] hash['filters'].each do |structure| filters << (FilterRule.from_hash(structure) if structure) end end filters = nil unless hash.key?('filters') # Create object from extracted values. BulkWithFiltersConfig.new(tiers: tiers, filters: filters) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['tiers'] = 'tiers' @_hash['filters'] = 'filters' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 41 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
93 94 95 96 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 93 def inspect class_name = self.class.name.split('::').last "<#{class_name} tiers: #{@tiers.inspect}, filters: #{@filters.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
87 88 89 90 |
# File 'lib/api_reference/models/bulk_with_filters_config.rb', line 87 def to_s class_name = self.class.name.split('::').last "<#{class_name} tiers: #{@tiers}, filters: #{@filters}>" end |