Class: ApiReference::PercentCompositeConfig1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::PercentCompositeConfig1
- Defined in:
- lib/api_reference/models/percent_composite_config1.rb
Overview
Configuration for percent pricing
Instance Attribute Summary collapse
-
#maximum_amount ⇒ String
Maximum amount to charge.
-
#minimum_amount ⇒ String
Minimum amount to charge.
-
#percent ⇒ Float
Fraction of the component subtotals to charge (0 < percent <= 1).
-
#prorated ⇒ TrueClass | FalseClass
If true, the minimum_amount is prorated based on the service 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(percent:, minimum_amount: SKIP, maximum_amount: SKIP, prorated: SKIP) ⇒ PercentCompositeConfig1
constructor
A new instance of PercentCompositeConfig1.
-
#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(percent:, minimum_amount: SKIP, maximum_amount: SKIP, prorated: SKIP) ⇒ PercentCompositeConfig1
Returns a new instance of PercentCompositeConfig1.
57 58 59 60 61 62 63 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 57 def initialize(percent:, minimum_amount: SKIP, maximum_amount: SKIP, prorated: SKIP) @percent = percent @minimum_amount = minimum_amount unless minimum_amount == SKIP @maximum_amount = maximum_amount unless maximum_amount == SKIP @prorated = prorated unless prorated == SKIP end |
Instance Attribute Details
#maximum_amount ⇒ String
Maximum amount to charge. If unset, the fee has no upper bound.
22 23 24 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 22 def maximum_amount @maximum_amount end |
#minimum_amount ⇒ String
Minimum amount to charge. If unset, the fee is bounded below by 0.
18 19 20 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 18 def minimum_amount @minimum_amount end |
#percent ⇒ Float
Fraction of the component subtotals to charge (0 < percent <= 1).
14 15 16 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 14 def percent @percent end |
#prorated ⇒ TrueClass | FalseClass
If true, the minimum_amount is prorated based on the service period. The maximum_amount is an absolute cap (never prorated), and the percent applied to upstream subtotals is never prorated either.
28 29 30 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 28 def prorated @prorated end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. percent = hash.key?('percent') ? hash['percent'] : nil minimum_amount = hash.key?('minimum_amount') ? hash['minimum_amount'] : SKIP maximum_amount = hash.key?('maximum_amount') ? hash['maximum_amount'] : SKIP prorated = hash.key?('prorated') ? hash['prorated'] : SKIP # Create object from extracted values. PercentCompositeConfig1.new(percent: percent, minimum_amount: minimum_amount, maximum_amount: maximum_amount, prorated: prorated) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['percent'] = 'percent' @_hash['minimum_amount'] = 'minimum_amount' @_hash['maximum_amount'] = 'maximum_amount' @_hash['prorated'] = 'prorated' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 53 54 55 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 50 def self.nullables %w[ minimum_amount maximum_amount ] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 41 def self.optionals %w[ minimum_amount maximum_amount prorated ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 86 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.percent, ->(val) { val.instance_of? Float }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['percent'], ->(val) { val.instance_of? Float }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
106 107 108 109 110 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 106 def inspect class_name = self.class.name.split('::').last "<#{class_name} percent: #{@percent.inspect}, minimum_amount: #{@minimum_amount.inspect},"\ " maximum_amount: #{@maximum_amount.inspect}, prorated: #{@prorated.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
99 100 101 102 103 |
# File 'lib/api_reference/models/percent_composite_config1.rb', line 99 def to_s class_name = self.class.name.split('::').last "<#{class_name} percent: #{@percent}, minimum_amount: #{@minimum_amount}, maximum_amount:"\ " #{@maximum_amount}, prorated: #{@prorated}>" end |