Class: ApiReference::ScalableMatrixWithUnitPricingConfig
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::ScalableMatrixWithUnitPricingConfig
- Defined in:
- lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb
Overview
Configuration for scalable matrix with unit pricing
Instance Attribute Summary collapse
-
#first_dimension ⇒ String
Used to determine the unit rate.
-
#grouping_key ⇒ String
The property used to group this price.
-
#matrix_scaling_factors ⇒ Array[ScalableMatrixWithUnitScalingFactor]
Apply a scaling factor to each dimension.
-
#prorate ⇒ TrueClass | FalseClass
If true, the unit price will be prorated to the billing period.
-
#second_dimension ⇒ String
Used to determine the unit rate (optional).
-
#unit_price ⇒ String
The final unit price to rate against the output of the matrix.
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(unit_price:, first_dimension:, matrix_scaling_factors:, grouping_key: SKIP, second_dimension: SKIP, prorate: false) ⇒ ScalableMatrixWithUnitPricingConfig
constructor
A new instance of ScalableMatrixWithUnitPricingConfig.
-
#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(unit_price:, first_dimension:, matrix_scaling_factors:, grouping_key: SKIP, second_dimension: SKIP, prorate: false) ⇒ ScalableMatrixWithUnitPricingConfig
Returns a new instance of ScalableMatrixWithUnitPricingConfig.
66 67 68 69 70 71 72 73 74 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 66 def initialize(unit_price:, first_dimension:, matrix_scaling_factors:, grouping_key: SKIP, second_dimension: SKIP, prorate: false) @grouping_key = grouping_key unless grouping_key == SKIP @unit_price = unit_price @first_dimension = first_dimension @second_dimension = second_dimension unless second_dimension == SKIP @matrix_scaling_factors = matrix_scaling_factors @prorate = prorate unless prorate == SKIP end |
Instance Attribute Details
#first_dimension ⇒ String
Used to determine the unit rate
22 23 24 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 22 def first_dimension @first_dimension end |
#grouping_key ⇒ String
The property used to group this price
14 15 16 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 14 def grouping_key @grouping_key end |
#matrix_scaling_factors ⇒ Array[ScalableMatrixWithUnitScalingFactor]
Apply a scaling factor to each dimension
30 31 32 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 30 def matrix_scaling_factors @matrix_scaling_factors end |
#prorate ⇒ TrueClass | FalseClass
If true, the unit price will be prorated to the billing period
34 35 36 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 34 def prorate @prorate end |
#second_dimension ⇒ String
Used to determine the unit rate (optional)
26 27 28 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 26 def second_dimension @second_dimension end |
#unit_price ⇒ String
The final unit price to rate against the output of the matrix
18 19 20 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 18 def unit_price @unit_price end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. unit_price = hash.key?('unit_price') ? hash['unit_price'] : nil first_dimension = hash.key?('first_dimension') ? hash['first_dimension'] : nil # Parameter is an array, so we need to iterate through it matrix_scaling_factors = nil unless hash['matrix_scaling_factors'].nil? matrix_scaling_factors = [] hash['matrix_scaling_factors'].each do |structure| matrix_scaling_factors << (ScalableMatrixWithUnitScalingFactor.from_hash(structure) if structure) end end matrix_scaling_factors = nil unless hash.key?('matrix_scaling_factors') grouping_key = hash.key?('grouping_key') ? hash['grouping_key'] : SKIP second_dimension = hash.key?('second_dimension') ? hash['second_dimension'] : SKIP prorate = hash['prorate'] ||= false # Create object from extracted values. ScalableMatrixWithUnitPricingConfig.new(unit_price: unit_price, first_dimension: first_dimension, matrix_scaling_factors: matrix_scaling_factors, grouping_key: grouping_key, second_dimension: second_dimension, prorate: prorate) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['grouping_key'] = 'grouping_key' @_hash['unit_price'] = 'unit_price' @_hash['first_dimension'] = 'first_dimension' @_hash['second_dimension'] = 'second_dimension' @_hash['matrix_scaling_factors'] = 'matrix_scaling_factors' @_hash['prorate'] = 'prorate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 61 62 63 64 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 58 def self.nullables %w[ grouping_key second_dimension prorate ] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 49 def self.optionals %w[ grouping_key second_dimension prorate ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
117 118 119 120 121 122 123 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 117 def inspect class_name = self.class.name.split('::').last "<#{class_name} grouping_key: #{@grouping_key.inspect}, unit_price: #{@unit_price.inspect},"\ " first_dimension: #{@first_dimension.inspect}, second_dimension:"\ " #{@second_dimension.inspect}, matrix_scaling_factors: #{@matrix_scaling_factors.inspect},"\ " prorate: #{@prorate.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
109 110 111 112 113 114 |
# File 'lib/api_reference/models/scalable_matrix_with_unit_pricing_config.rb', line 109 def to_s class_name = self.class.name.split('::').last "<#{class_name} grouping_key: #{@grouping_key}, unit_price: #{@unit_price},"\ " first_dimension: #{@first_dimension}, second_dimension: #{@second_dimension},"\ " matrix_scaling_factors: #{@matrix_scaling_factors}, prorate: #{@prorate}>" end |