Class: ApiReference::DimensionalPriceGroup
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::DimensionalPriceGroup
- Defined in:
- lib/api_reference/models/dimensional_price_group.rb
Overview
A dimensional price group is used to partition the result of a billable metric by a set of dimensions. Prices in a price group must specify the partition used to derive their usage.
Instance Attribute Summary collapse
-
#billable_metric_id ⇒ String
The billable metric associated with this dimensional price group.
-
#dimensions ⇒ Array[String]
The dimensions that this dimensional price group is defined over.
-
#external_dimensional_price_group_id ⇒ String
An alias for the dimensional price group.
-
#id ⇒ String
User specified key-value pairs for the resource.
-
#metadata ⇒ Hash[String, String]
User specified key-value pairs for the resource.
-
#name ⇒ String
The name of the dimensional price group.
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(metadata:, id:, name:, external_dimensional_price_group_id:, dimensions:, billable_metric_id:, additional_properties: nil) ⇒ DimensionalPriceGroup
constructor
A new instance of DimensionalPriceGroup.
-
#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(metadata:, id:, name:, external_dimensional_price_group_id:, dimensions:, billable_metric_id:, additional_properties: nil) ⇒ DimensionalPriceGroup
Returns a new instance of DimensionalPriceGroup.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 71 def initialize(metadata:, id:, name:, external_dimensional_price_group_id:, dimensions:, billable_metric_id:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @metadata = @id = id @name = name @external_dimensional_price_group_id = external_dimensional_price_group_id @dimensions = dimensions @billable_metric_id = billable_metric_id @additional_properties = additional_properties end |
Instance Attribute Details
#billable_metric_id ⇒ String
The billable metric associated with this dimensional price group. All prices associated with this dimensional price group will be computed using this billable metric.
44 45 46 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 44 def billable_metric_id @billable_metric_id end |
#dimensions ⇒ Array[String]
The dimensions that this dimensional price group is defined over
38 39 40 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 38 def dimensions @dimensions end |
#external_dimensional_price_group_id ⇒ String
An alias for the dimensional price group
34 35 36 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 34 def external_dimensional_price_group_id @external_dimensional_price_group_id end |
#id ⇒ String
User specified key-value pairs for the resource. If not present, this
defaults to an empty dictionary. Individual keys can be removed by setting
the value to null, and the entire metadata mapping can be cleared by
setting metadata to null.
26 27 28 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 26 def id @id end |
#metadata ⇒ Hash[String, String]
User specified key-value pairs for the resource. If not present, this
defaults to an empty dictionary. Individual keys can be removed by setting
the value to null, and the entire metadata mapping can be cleared by
setting metadata to null.
19 20 21 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 19 def @metadata end |
#name ⇒ String
The name of the dimensional price group
30 31 32 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 30 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = hash.key?('metadata') ? hash['metadata'] : nil id = hash.key?('id') ? hash['id'] : nil name = hash.key?('name') ? hash['name'] : nil external_dimensional_price_group_id = hash.key?('external_dimensional_price_group_id') ? hash['external_dimensional_price_group_id'] : nil dimensions = hash.key?('dimensions') ? hash['dimensions'] : nil billable_metric_id = hash.key?('billable_metric_id') ? hash['billable_metric_id'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. DimensionalPriceGroup.new(metadata: , id: id, name: name, external_dimensional_price_group_id: external_dimensional_price_group_id, dimensions: dimensions, billable_metric_id: billable_metric_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['metadata'] = 'metadata' @_hash['id'] = 'id' @_hash['name'] = 'name' @_hash['external_dimensional_price_group_id'] = 'external_dimensional_price_group_id' @_hash['dimensions'] = 'dimensions' @_hash['billable_metric_id'] = 'billable_metric_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
65 66 67 68 69 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 65 def self.nullables %w[ external_dimensional_price_group_id ] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 60 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
126 127 128 129 130 131 132 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 126 def inspect class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata.inspect}, id: #{@id.inspect}, name: #{@name.inspect},"\ " external_dimensional_price_group_id: #{@external_dimensional_price_group_id.inspect},"\ " dimensions: #{@dimensions.inspect}, billable_metric_id: #{@billable_metric_id.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
117 118 119 120 121 122 123 |
# File 'lib/api_reference/models/dimensional_price_group.rb', line 117 def to_s class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata}, id: #{@id}, name: #{@name},"\ " external_dimensional_price_group_id: #{@external_dimensional_price_group_id}, dimensions:"\ " #{@dimensions}, billable_metric_id: #{@billable_metric_id}, additional_properties:"\ " #{@additional_properties}>" end |