Class: ApiReference::GroupedWithMinMaxThresholdsConfig

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

Overview

Configuration for grouped with minimum and maximum thresholds 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(grouping_key:, per_unit_rate:, minimum_charge:, maximum_charge:) ⇒ GroupedWithMinMaxThresholdsConfig

Returns a new instance of GroupedWithMinMaxThresholdsConfig.



48
49
50
51
52
53
54
# File 'lib/api_reference/models/grouped_with_min_max_thresholds_config.rb', line 48

def initialize(grouping_key:, per_unit_rate:, minimum_charge:,
               maximum_charge:)
  @grouping_key = grouping_key
  @per_unit_rate = per_unit_rate
  @minimum_charge = minimum_charge
  @maximum_charge = maximum_charge
end

Instance Attribute Details

#grouping_keyString

The event property used to group before applying thresholds

Returns:

  • (String)


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

def grouping_key
  @grouping_key
end

#maximum_chargeString

The maximum amount to charge each group

Returns:

  • (String)


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

def maximum_charge
  @maximum_charge
end

#minimum_chargeString

The minimum amount to charge each group, regardless of usage

Returns:

  • (String)


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

def minimum_charge
  @minimum_charge
end

#per_unit_rateString

The base price charged per group

Returns:

  • (String)


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

def per_unit_rate
  @per_unit_rate
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  grouping_key = hash.key?('grouping_key') ? hash['grouping_key'] : nil
  per_unit_rate = hash.key?('per_unit_rate') ? hash['per_unit_rate'] : nil
  minimum_charge =
    hash.key?('minimum_charge') ? hash['minimum_charge'] : nil
  maximum_charge =
    hash.key?('maximum_charge') ? hash['maximum_charge'] : nil

  # Create object from extracted values.
  GroupedWithMinMaxThresholdsConfig.new(grouping_key: grouping_key,
                                        per_unit_rate: per_unit_rate,
                                        minimum_charge: minimum_charge,
                                        maximum_charge: maximum_charge)
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/grouped_with_min_max_thresholds_config.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['grouping_key'] = 'grouping_key'
  @_hash['per_unit_rate'] = 'per_unit_rate'
  @_hash['minimum_charge'] = 'minimum_charge'
  @_hash['maximum_charge'] = 'maximum_charge'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/api_reference/models/grouped_with_min_max_thresholds_config.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/api_reference/models/grouped_with_min_max_thresholds_config.rb', line 39

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



83
84
85
86
87
88
# File 'lib/api_reference/models/grouped_with_min_max_thresholds_config.rb', line 83

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} grouping_key: #{@grouping_key.inspect}, per_unit_rate:"\
  " #{@per_unit_rate.inspect}, minimum_charge: #{@minimum_charge.inspect}, maximum_charge:"\
  " #{@maximum_charge.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} grouping_key: #{@grouping_key}, per_unit_rate: #{@per_unit_rate},"\
  " minimum_charge: #{@minimum_charge}, maximum_charge: #{@maximum_charge}>"
end