Class: ApiReference::ThresholdTotalAmountConfig1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::ThresholdTotalAmountConfig1
- Defined in:
- lib/api_reference/models/threshold_total_amount_config1.rb
Overview
Configuration for threshold_total_amount 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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(consumption_table:, prorate: false) ⇒ ThresholdTotalAmountConfig1
constructor
A new instance of ThresholdTotalAmountConfig1.
-
#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) ⇒ ThresholdTotalAmountConfig1
Returns a new instance of ThresholdTotalAmountConfig1.
43 44 45 46 |
# File 'lib/api_reference/models/threshold_total_amount_config1.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_config1.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_config1.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_config1.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. ThresholdTotalAmountConfig1.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_config1.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_config1.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_config1.rb', line 30 def self.optionals %w[ prorate ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/api_reference/models/threshold_total_amount_config1.rb', line 72 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.consumption_table, ->(val) { TieredTotalThreshold.validate(val) }, is_model_hash: true, is_inner_model_hash: true) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['consumption_table'], ->(val) { TieredTotalThreshold.validate(val) }, is_model_hash: true, is_inner_model_hash: true) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
95 96 97 98 99 |
# File 'lib/api_reference/models/threshold_total_amount_config1.rb', line 95 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.
89 90 91 92 |
# File 'lib/api_reference/models/threshold_total_amount_config1.rb', line 89 def to_s class_name = self.class.name.split('::').last "<#{class_name} consumption_table: #{@consumption_table}, prorate: #{@prorate}>" end |