Class: ApiReference::TieredPackagePricingWithMinimumConfig

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

Overview

Configuration for tiered package pricing with minimum

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:, package_size:) ⇒ TieredPackagePricingWithMinimumConfig

Returns a new instance of TieredPackagePricingWithMinimumConfig.



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

def initialize(tiers:, package_size:)
  @tiers = tiers
  @package_size = package_size
end

Instance Attribute Details

#package_sizeFloat

Apply tiered pricing after rounding up the quantity to the package size. Tiers are defined using exclusive lower bounds.

Returns:

  • (Float)


20
21
22
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 20

def package_size
  @package_size
end

#tiersArray[TieredPackageWithMinimumTierItem]

Apply tiered pricing after rounding up the quantity to the package size. Tiers are defined using exclusive lower bounds.



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

def tiers
  @tiers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 46

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

  tiers = nil unless hash.key?('tiers')
  package_size = hash.key?('package_size') ? hash['package_size'] : nil

  # Create object from extracted values.
  TieredPackagePricingWithMinimumConfig.new(tiers: tiers,
                                            package_size: package_size)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
28
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 23

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

.nullablesObject

An array for nullable fields



36
37
38
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 36

def self.nullables
  []
end

.optionalsObject

An array for optional fields



31
32
33
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 31

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



74
75
76
77
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 74

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

#to_sObject

Provides a human-readable string representation of the object.



68
69
70
71
# File 'lib/api_reference/models/tiered_package_pricing_with_minimum_config.rb', line 68

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