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) ⇒ AllowanceThreshold

Returns a new instance of AllowanceThreshold.



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

def initialize(percentage50 = SKIP, percentage75 = SKIP,
               percentage90 = SKIP, percentage100 = SKIP)
  @percentage50 = percentage50 unless percentage50 == SKIP
  @percentage75 = percentage75 unless percentage75 == SKIP
  @percentage90 = percentage90 unless percentage90 == SKIP
  @percentage100 = percentage100 unless percentage100 == SKIP
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.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/verizon/models/allowance_threshold.rb', line 62

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 object from extracted values.
  AllowanceThreshold.new(percentage50,
                         percentage75,
                         percentage90,
                         percentage100)
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:



80
81
82
83
84
85
86
# File 'lib/verizon/models/allowance_threshold.rb', line 80

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.



96
97
98
99
100
101
# File 'lib/verizon/models/allowance_threshold.rb', line 96

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

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/verizon/models/allowance_threshold.rb', line 89

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