Class: ShellDataReportingApIs::FeeRuleTier

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb

Overview

FeeRuleTier Model.

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(tier_minimum = SKIP, value = SKIP, tier_maximum = SKIP) ⇒ FeeRuleTier

Returns a new instance of FeeRuleTier.



51
52
53
54
55
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 51

def initialize(tier_minimum = SKIP, value = SKIP, tier_maximum = SKIP)
  @tier_minimum = tier_minimum unless tier_minimum == SKIP
  @value = value unless value == SKIP
  @tier_maximum = tier_maximum unless tier_maximum == SKIP
end

Instance Attribute Details

#tier_maximumInteger

Maximum consumption configured in the tier.

Returns:

  • (Integer)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 22

def tier_maximum
  @tier_maximum
end

#tier_minimumInteger

Minimum consumption configured in the tier.

Returns:

  • (Integer)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 14

def tier_minimum
  @tier_minimum
end

#valueFloat

Bonus value for the tier.

Returns:

  • (Float)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 18

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  tier_minimum = hash.key?('TierMinimum') ? hash['TierMinimum'] : SKIP
  value = hash.key?('Value') ? hash['Value'] : SKIP
  tier_maximum = hash.key?('TierMaximum') ? hash['TierMaximum'] : SKIP

  # Create object from extracted values.
  FeeRuleTier.new(tier_minimum,
                  value,
                  tier_maximum)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tier_minimum'] = 'TierMinimum'
  @_hash['value'] = 'Value'
  @_hash['tier_maximum'] = 'TierMaximum'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
46
47
48
49
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 43

def self.nullables
  %w[
    tier_minimum
    value
    tier_maximum
  ]
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 34

def self.optionals
  %w[
    tier_minimum
    value
    tier_maximum
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



80
81
82
83
84
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 80

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tier_minimum: #{@tier_minimum.inspect}, value: #{@value.inspect},"\
  " tier_maximum: #{@tier_maximum.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



73
74
75
76
77
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_tier.rb', line 73

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tier_minimum: #{@tier_minimum}, value: #{@value}, tier_maximum:"\
  " #{@tier_maximum}>"
end