Class: ApiReference::ScalableMatrixWithTieredPricingConfig

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb

Overview

Configuration for scalable matrix with tiered pricing

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(tiers:, first_dimension:, matrix_scaling_factors:, second_dimension: SKIP) ⇒ ScalableMatrixWithTieredPricingConfig

Returns a new instance of ScalableMatrixWithTieredPricingConfig.



52
53
54
55
56
57
58
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 52

def initialize(tiers:, first_dimension:, matrix_scaling_factors:,
               second_dimension: SKIP)
  @tiers = tiers
  @first_dimension = first_dimension
  @second_dimension = second_dimension unless second_dimension == SKIP
  @matrix_scaling_factors = matrix_scaling_factors
end

Instance Attribute Details

#first_dimensionString

Used for the scalable matrix first dimension

Returns:

  • (String)


18
19
20
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 18

def first_dimension
  @first_dimension
end

#matrix_scaling_factorsArray[ScalableMatrixWithTieredScalingFactor]

Apply a scaling factor to each dimension



26
27
28
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 26

def matrix_scaling_factors
  @matrix_scaling_factors
end

#second_dimensionString

Used for the scalable matrix second dimension (optional)

Returns:

  • (String)


22
23
24
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 22

def second_dimension
  @second_dimension
end

#tiersArray[ScalableMatrixWithTieredTierEntry]

TODO: Write general description for this method



14
15
16
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 14

def tiers
  @tiers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 61

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
  tiers = nil
  unless hash['tiers'].nil?
    tiers = []
    hash['tiers'].each do |structure|
      tiers << (ScalableMatrixWithTieredTierEntry.from_hash(structure) if structure)
    end
  end

  tiers = nil unless hash.key?('tiers')
  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 << (ScalableMatrixWithTieredScalingFactor.from_hash(structure) if structure)
    end
  end

  matrix_scaling_factors = nil unless hash.key?('matrix_scaling_factors')
  second_dimension =
    hash.key?('second_dimension') ? hash['second_dimension'] : SKIP

  # Create object from extracted values.
  ScalableMatrixWithTieredPricingConfig.new(tiers: tiers,
                                            first_dimension: first_dimension,
                                            matrix_scaling_factors: matrix_scaling_factors,
                                            second_dimension: second_dimension)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tiers'] = 'tiers'
  @_hash['first_dimension'] = 'first_dimension'
  @_hash['second_dimension'] = 'second_dimension'
  @_hash['matrix_scaling_factors'] = 'matrix_scaling_factors'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
49
50
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 46

def self.nullables
  %w[
    second_dimension
  ]
end

.optionalsObject

An array for optional fields



39
40
41
42
43
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 39

def self.optionals
  %w[
    second_dimension
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
110
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 105

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tiers: #{@tiers.inspect}, first_dimension: #{@first_dimension.inspect},"\
  " second_dimension: #{@second_dimension.inspect}, matrix_scaling_factors:"\
  " #{@matrix_scaling_factors.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



98
99
100
101
102
# File 'lib/api_reference/models/scalable_matrix_with_tiered_pricing_config.rb', line 98

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tiers: #{@tiers}, first_dimension: #{@first_dimension}, second_dimension:"\
  " #{@second_dimension}, matrix_scaling_factors: #{@matrix_scaling_factors}>"
end