Class: ApiReference::TieredWithProrationConfig1

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

Overview

Configuration for tiered_with_proration 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:) ⇒ TieredWithProrationConfig1

Returns a new instance of TieredWithProrationConfig1.



34
35
36
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 34

def initialize(tiers:)
  @tiers = tiers
end

Instance Attribute Details

#tiersArray[TieredWithProrationTier]

Tiers for rating based on total usage quantities into the specified tier with proration

Returns:



15
16
17
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 15

def tiers
  @tiers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 39

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 << (TieredWithProrationTier.from_hash(structure) if structure)
    end
  end

  tiers = nil unless hash.key?('tiers')

  # Create object from extracted values.
  TieredWithProrationConfig1.new(tiers: tiers)
end

.namesObject

A mapping from model property names to API property names.



18
19
20
21
22
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 18

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

.nullablesObject

An array for nullable fields



30
31
32
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 30

def self.nullables
  []
end

.optionalsObject

An array for optional fields



25
26
27
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 25

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 60

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.tiers,
                                 ->(val) { TieredWithProrationTier.validate(val) },
                                 is_model_hash: true,
                                 is_inner_model_hash: true)
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['tiers'],
                        ->(val) { TieredWithProrationTier.validate(val) },
                        is_model_hash: true,
                        is_inner_model_hash: true)
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



83
84
85
86
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 83

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

#to_sObject

Provides a human-readable string representation of the object.



77
78
79
80
# File 'lib/api_reference/models/tiered_with_proration_config1.rb', line 77

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