Class: Verizon::AllowanceThreshold

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/allowance_threshold.rb

Overview

AllowanceThreshold 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(percentage50: SKIP, percentage75: SKIP, percentage90: SKIP, percentage100: SKIP, additional_properties: nil) ⇒ AllowanceThreshold

Returns a new instance of AllowanceThreshold.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/verizon/models/allowance_threshold.rb', line 53

def initialize(percentage50: SKIP, percentage75: SKIP, percentage90: SKIP,
               percentage100: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @percentage50 = percentage50 unless percentage50 == SKIP
  @percentage75 = percentage75 unless percentage75 == SKIP
  @percentage90 = percentage90 unless percentage90 == SKIP
  @percentage100 = percentage100 unless percentage100 == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#percentage100TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/verizon/models/allowance_threshold.rb', line 26

def percentage100
  @percentage100
end

#percentage50TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/verizon/models/allowance_threshold.rb', line 14

def percentage50
  @percentage50
end

#percentage75TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/verizon/models/allowance_threshold.rb', line 18

def percentage75
  @percentage75
end

#percentage90TrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/verizon/models/allowance_threshold.rb', line 22

def percentage90
  @percentage90
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/verizon/models/allowance_threshold.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  percentage50 = hash.key?('percentage50') ? hash['percentage50'] : SKIP
  percentage75 = hash.key?('percentage75') ? hash['percentage75'] : SKIP
  percentage90 = hash.key?('percentage90') ? hash['percentage90'] : SKIP
  percentage100 = hash.key?('percentage100') ? hash['percentage100'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  AllowanceThreshold.new(percentage50: percentage50,
                         percentage75: percentage75,
                         percentage90: percentage90,
                         percentage100: percentage100,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/verizon/models/allowance_threshold.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['percentage50'] = 'percentage50'
  @_hash['percentage75'] = 'percentage75'
  @_hash['percentage90'] = 'percentage90'
  @_hash['percentage100'] = 'percentage100'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/verizon/models/allowance_threshold.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/verizon/models/allowance_threshold.rb', line 39

def self.optionals
  %w[
    percentage50
    percentage75
    percentage90
    percentage100
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



92
93
94
95
96
97
98
# File 'lib/verizon/models/allowance_threshold.rb', line 92

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/verizon/models/allowance_threshold.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} percentage50: #{@percentage50.inspect}, percentage75:"\
  " #{@percentage75.inspect}, percentage90: #{@percentage90.inspect}, percentage100:"\
  " #{@percentage100.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
106
# File 'lib/verizon/models/allowance_threshold.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} percentage50: #{@percentage50}, percentage75: #{@percentage75},"\
  " percentage90: #{@percentage90}, percentage100: #{@percentage100}, additional_properties:"\
  " #{@additional_properties}>"
end