Class: Verizon::Suspenddetailsobject

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

Overview

Suspenddetailsobject 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(suspend_from_accounts: SKIP, suspend_duration: SKIP, suspend_option: SKIP, threshold: SKIP, threshold_unit: SKIP, additional_properties: nil) ⇒ Suspenddetailsobject

Returns a new instance of Suspenddetailsobject.



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/verizon/models/suspenddetailsobject.rb', line 60

def initialize(suspend_from_accounts: SKIP, suspend_duration: SKIP,
               suspend_option: SKIP, threshold: SKIP, threshold_unit: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @suspend_from_accounts = suspend_from_accounts unless suspend_from_accounts == SKIP
  @suspend_duration = suspend_duration unless suspend_duration == SKIP
  @suspend_option = suspend_option unless suspend_option == SKIP
  @threshold = threshold unless threshold == SKIP
  @threshold_unit = threshold_unit unless threshold_unit == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#suspend_durationInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def suspend_duration
  @suspend_duration
end

#suspend_from_accountsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def suspend_from_accounts
  @suspend_from_accounts
end

#suspend_optionString

TODO: Write general description for this method

Returns:

  • (String)


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

def suspend_option
  @suspend_option
end

#thresholdInteger

The threshold value the trigger monitors for

Returns:

  • (Integer)


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

def threshold
  @threshold
end

#threshold_unitThresholdUnit

The units of the threshold. This can be KB, Kilobits, MB, Megabits, or GB, Gigabits

Returns:



31
32
33
# File 'lib/verizon/models/suspenddetailsobject.rb', line 31

def threshold_unit
  @threshold_unit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/verizon/models/suspenddetailsobject.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  suspend_from_accounts =
    hash.key?('suspendFromAccounts') ? hash['suspendFromAccounts'] : SKIP
  suspend_duration =
    hash.key?('suspendDuration') ? hash['suspendDuration'] : SKIP
  suspend_option = hash.key?('suspendOption') ? hash['suspendOption'] : SKIP
  threshold = hash.key?('threshold') ? hash['threshold'] : SKIP
  threshold_unit = hash.key?('thresholdUnit') ? hash['thresholdUnit'] : 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.
  Suspenddetailsobject.new(suspend_from_accounts: suspend_from_accounts,
                           suspend_duration: suspend_duration,
                           suspend_option: suspend_option,
                           threshold: threshold,
                           threshold_unit: threshold_unit,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/verizon/models/suspenddetailsobject.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['suspend_from_accounts'] = 'suspendFromAccounts'
  @_hash['suspend_duration'] = 'suspendDuration'
  @_hash['suspend_option'] = 'suspendOption'
  @_hash['threshold'] = 'threshold'
  @_hash['threshold_unit'] = 'thresholdUnit'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/verizon/models/suspenddetailsobject.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/verizon/models/suspenddetailsobject.rb', line 45

def self.optionals
  %w[
    suspend_from_accounts
    suspend_duration
    suspend_option
    threshold
    threshold_unit
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



105
106
107
108
109
110
111
# File 'lib/verizon/models/suspenddetailsobject.rb', line 105

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.



122
123
124
125
126
127
128
# File 'lib/verizon/models/suspenddetailsobject.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} suspend_from_accounts: #{@suspend_from_accounts.inspect}, suspend_duration:"\
  " #{@suspend_duration.inspect}, suspend_option: #{@suspend_option.inspect}, threshold:"\
  " #{@threshold.inspect}, threshold_unit: #{@threshold_unit.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/verizon/models/suspenddetailsobject.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} suspend_from_accounts: #{@suspend_from_accounts}, suspend_duration:"\
  " #{@suspend_duration}, suspend_option: #{@suspend_option}, threshold: #{@threshold},"\
  " threshold_unit: #{@threshold_unit}, additional_properties: #{@additional_properties}>"
end