Class: ApiReference::ThresholdTotalAmountConfig
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::ThresholdTotalAmountConfig
- Defined in:
- lib/api_reference/models/threshold_total_amount_config.rb
Overview
Configuration for tiered total pricing
Instance Attribute Summary collapse
-
#consumption_table ⇒ Array[TieredTotalThreshold]
When the quantity consumed passes a provided threshold, the configured total will be charged.
-
#prorate ⇒ TrueClass | FalseClass
If true, the unit price will be prorated to the billing period.
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(consumption_table:, prorate: false) ⇒ ThresholdTotalAmountConfig
constructor
A new instance of ThresholdTotalAmountConfig.
-
#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(consumption_table:, prorate: false) ⇒ ThresholdTotalAmountConfig
Returns a new instance of ThresholdTotalAmountConfig.
43 44 45 46 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 43 def initialize(consumption_table:, prorate: false) @consumption_table = consumption_table @prorate = prorate unless prorate == SKIP end |
Instance Attribute Details
#consumption_table ⇒ Array[TieredTotalThreshold]
When the quantity consumed passes a provided threshold, the configured total will be charged
15 16 17 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 15 def consumption_table @consumption_table end |
#prorate ⇒ TrueClass | FalseClass
If true, the unit price will be prorated to the billing period
19 20 21 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 19 def prorate @prorate end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 49 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 consumption_table = nil unless hash['consumption_table'].nil? consumption_table = [] hash['consumption_table'].each do |structure| consumption_table << (TieredTotalThreshold.from_hash(structure) if structure) end end consumption_table = nil unless hash.key?('consumption_table') prorate = hash['prorate'] ||= false # Create object from extracted values. ThresholdTotalAmountConfig.new(consumption_table: consumption_table, prorate: prorate) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['consumption_table'] = 'consumption_table' @_hash['prorate'] = 'prorate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 40 41 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 37 def self.nullables %w[ prorate ] end |
.optionals ⇒ Object
An array for optional fields
30 31 32 33 34 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 30 def self.optionals %w[ prorate ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
77 78 79 80 81 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 77 def inspect class_name = self.class.name.split('::').last "<#{class_name} consumption_table: #{@consumption_table.inspect}, prorate:"\ " #{@prorate.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
71 72 73 74 |
# File 'lib/api_reference/models/threshold_total_amount_config.rb', line 71 def to_s class_name = self.class.name.split('::').last "<#{class_name} consumption_table: #{@consumption_table}, prorate: #{@prorate}>" end |