Class: ApiReference::TieredPackagePricingConfig
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::TieredPackagePricingConfig
- Defined in:
- lib/api_reference/models/tiered_package_pricing_config.rb
Overview
Configuration for tiered package pricing
Instance Attribute Summary collapse
-
#package_size ⇒ String
Apply tiered pricing after rounding up the quantity to the package size.
-
#tiers ⇒ Array[TieredPackageTierItem]
Apply tiered pricing after rounding up the quantity to the package size.
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(tiers:, package_size:) ⇒ TieredPackagePricingConfig
constructor
A new instance of TieredPackagePricingConfig.
-
#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(tiers:, package_size:) ⇒ TieredPackagePricingConfig
Returns a new instance of TieredPackagePricingConfig.
44 45 46 47 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 44 def initialize(tiers:, package_size:) @tiers = tiers @package_size = package_size end |
Instance Attribute Details
#package_size ⇒ String
Apply tiered pricing after rounding up the quantity to the package size. Tiers are defined using exclusive lower bounds. The tier bounds are defined based on the total quantity rather than the number of packages, so they must be multiples of the package size.
24 25 26 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 24 def package_size @package_size end |
#tiers ⇒ Array[TieredPackageTierItem]
Apply tiered pricing after rounding up the quantity to the package size. Tiers are defined using exclusive lower bounds. The tier bounds are defined based on the total quantity rather than the number of packages, so they must be multiples of the package size.
17 18 19 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 17 def tiers @tiers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 50 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 << (TieredPackageTierItem.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. TieredPackagePricingConfig.new(tiers: tiers, package_size: package_size) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['tiers'] = 'tiers' @_hash['package_size'] = 'package_size' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 35 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
78 79 80 81 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 78 def inspect class_name = self.class.name.split('::').last "<#{class_name} tiers: #{@tiers.inspect}, package_size: #{@package_size.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
72 73 74 75 |
# File 'lib/api_reference/models/tiered_package_pricing_config.rb', line 72 def to_s class_name = self.class.name.split('::').last "<#{class_name} tiers: #{@tiers}, package_size: #{@package_size}>" end |