Class: ApiReference::CumulativeGroupedAllocationConfig
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CumulativeGroupedAllocationConfig
- Defined in:
- lib/api_reference/models/cumulative_grouped_allocation_config.rb
Overview
Configuration for cumulative grouped allocation pricing. This rating function groups usage by a grouping key and applies both per-group and cumulative allocations. For each group (ordered by group value), it calculates the larger of the group overage and the incremental cumulative overage.
Instance Attribute Summary collapse
-
#cumulative_allocation ⇒ String
The overall allocation across all groups.
-
#group_allocation ⇒ String
The allocation per individual group.
-
#grouping_key ⇒ String
The event property used to group usage before applying allocations.
-
#unit_amount ⇒ String
The amount to charge for each unit outside of the allocation.
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(grouping_key:, group_allocation:, cumulative_allocation:, unit_amount:) ⇒ CumulativeGroupedAllocationConfig
constructor
A new instance of CumulativeGroupedAllocationConfig.
-
#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(grouping_key:, group_allocation:, cumulative_allocation:, unit_amount:) ⇒ CumulativeGroupedAllocationConfig
Returns a new instance of CumulativeGroupedAllocationConfig.
52 53 54 55 56 57 58 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 52 def initialize(grouping_key:, group_allocation:, cumulative_allocation:, unit_amount:) @grouping_key = grouping_key @group_allocation = group_allocation @cumulative_allocation = cumulative_allocation @unit_amount = unit_amount end |
Instance Attribute Details
#cumulative_allocation ⇒ String
The overall allocation across all groups
26 27 28 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 26 def cumulative_allocation @cumulative_allocation end |
#group_allocation ⇒ String
The allocation per individual group
22 23 24 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 22 def group_allocation @group_allocation end |
#grouping_key ⇒ String
The event property used to group usage before applying allocations
18 19 20 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 18 def grouping_key @grouping_key end |
#unit_amount ⇒ String
The amount to charge for each unit outside of the allocation
30 31 32 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 30 def unit_amount @unit_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 61 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. grouping_key = hash.key?('grouping_key') ? hash['grouping_key'] : nil group_allocation = hash.key?('group_allocation') ? hash['group_allocation'] : nil cumulative_allocation = hash.key?('cumulative_allocation') ? hash['cumulative_allocation'] : nil unit_amount = hash.key?('unit_amount') ? hash['unit_amount'] : nil # Create object from extracted values. CumulativeGroupedAllocationConfig.new(grouping_key: grouping_key, group_allocation: group_allocation, cumulative_allocation: cumulative_allocation, unit_amount: unit_amount) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['grouping_key'] = 'grouping_key' @_hash['group_allocation'] = 'group_allocation' @_hash['cumulative_allocation'] = 'cumulative_allocation' @_hash['unit_amount'] = 'unit_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 43 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
87 88 89 90 91 92 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 87 def inspect class_name = self.class.name.split('::').last "<#{class_name} grouping_key: #{@grouping_key.inspect}, group_allocation:"\ " #{@group_allocation.inspect}, cumulative_allocation: #{@cumulative_allocation.inspect},"\ " unit_amount: #{@unit_amount.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
80 81 82 83 84 |
# File 'lib/api_reference/models/cumulative_grouped_allocation_config.rb', line 80 def to_s class_name = self.class.name.split('::').last "<#{class_name} grouping_key: #{@grouping_key}, group_allocation: #{@group_allocation},"\ " cumulative_allocation: #{@cumulative_allocation}, unit_amount: #{@unit_amount}>" end |