Class: ApiReference::MatrixWithDisplayNameConfig1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::MatrixWithDisplayNameConfig1
- Defined in:
- lib/api_reference/models/matrix_with_display_name_config1.rb
Overview
Configuration for matrix_with_display_name pricing
Instance Attribute Summary collapse
-
#dimension ⇒ String
Used to determine the unit rate.
-
#unit_amounts ⇒ Array[MatrixWithDisplayNameUnitAmountItem]
Apply per unit pricing to each dimension value.
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(dimension:, unit_amounts:) ⇒ MatrixWithDisplayNameConfig1
constructor
A new instance of MatrixWithDisplayNameConfig1.
-
#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(dimension:, unit_amounts:) ⇒ MatrixWithDisplayNameConfig1
Returns a new instance of MatrixWithDisplayNameConfig1.
38 39 40 41 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 38 def initialize(dimension:, unit_amounts:) @dimension = dimension @unit_amounts = unit_amounts end |
Instance Attribute Details
#dimension ⇒ String
Used to determine the unit rate
14 15 16 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 14 def dimension @dimension end |
#unit_amounts ⇒ Array[MatrixWithDisplayNameUnitAmountItem]
Apply per unit pricing to each dimension value
18 19 20 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 18 def unit_amounts @unit_amounts end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 44 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. dimension = hash.key?('dimension') ? hash['dimension'] : nil # Parameter is an array, so we need to iterate through it unit_amounts = nil unless hash['unit_amounts'].nil? unit_amounts = [] hash['unit_amounts'].each do |structure| unit_amounts << (MatrixWithDisplayNameUnitAmountItem.from_hash(structure) if structure) end end unit_amounts = nil unless hash.key?('unit_amounts') # Create object from extracted values. MatrixWithDisplayNameConfig1.new(dimension: dimension, unit_amounts: unit_amounts) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['dimension'] = 'dimension' @_hash['unit_amounts'] = 'unit_amounts' @_hash end |
.nullables ⇒ Object
An array for nullable fields
34 35 36 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 34 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 29 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 67 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.dimension, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.unit_amounts, ->(val) { MatrixWithDisplayNameUnitAmountItem.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['dimension'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['unit_amounts'], ->(val) { MatrixWithDisplayNameUnitAmountItem.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.
98 99 100 101 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 98 def inspect class_name = self.class.name.split('::').last "<#{class_name} dimension: #{@dimension.inspect}, unit_amounts: #{@unit_amounts.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 |
# File 'lib/api_reference/models/matrix_with_display_name_config1.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} dimension: #{@dimension}, unit_amounts: #{@unit_amounts}>" end |