Class: Verizon::Notificationarray

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

Overview

Notificationarray 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(notification_type: SKIP, callback: SKIP, email_notification: SKIP, notification_group_name: SKIP, notification_frequency_factor: SKIP, notification_frequency_interval: SKIP, external_email_recipients: SKIP, sms_notification: SKIP, sms_numbers: SKIP, reminder: SKIP, severity: SKIP, additional_properties: nil) ⇒ Notificationarray

Returns a new instance of Notificationarray.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/verizon/models/notificationarray.rb', line 96

def initialize(notification_type: SKIP, callback: SKIP,
               email_notification: SKIP, notification_group_name: SKIP,
               notification_frequency_factor: SKIP,
               notification_frequency_interval: SKIP,
               external_email_recipients: SKIP, sms_notification: SKIP,
               sms_numbers: SKIP, reminder: SKIP, severity: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @notification_type = notification_type unless notification_type == SKIP
  @callback = callback unless callback == SKIP
  @email_notification = email_notification unless email_notification == SKIP
  @notification_group_name = notification_group_name unless notification_group_name == SKIP
  unless notification_frequency_factor == SKIP
    @notification_frequency_factor =
      notification_frequency_factor
  end
  unless notification_frequency_interval == SKIP
    @notification_frequency_interval =
      notification_frequency_interval
  end
  unless external_email_recipients == SKIP
    @external_email_recipients =
      external_email_recipients
  end
  @sms_notification = sms_notification unless sms_notification == SKIP
  @sms_numbers = sms_numbers unless sms_numbers == SKIP
  @reminder = reminder unless reminder == SKIP
  @severity = severity unless severity == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#callbackTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def callback
  @callback
end

#email_notificationTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def email_notification
  @email_notification
end

#external_email_recipientsString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/notificationarray.rb', line 38

def external_email_recipients
  @external_email_recipients
end

#notification_frequency_factorInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/verizon/models/notificationarray.rb', line 30

def notification_frequency_factor
  @notification_frequency_factor
end

#notification_frequency_intervalString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/notificationarray.rb', line 34

def notification_frequency_interval
  @notification_frequency_interval
end

#notification_group_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def notification_group_name
  @notification_group_name
end

#notification_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def notification_type
  @notification_type
end

#reminderTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


50
51
52
# File 'lib/verizon/models/notificationarray.rb', line 50

def reminder
  @reminder
end

#severityString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/verizon/models/notificationarray.rb', line 54

def severity
  @severity
end

#sms_notificationTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


42
43
44
# File 'lib/verizon/models/notificationarray.rb', line 42

def sms_notification
  @sms_notification
end

#sms_numbersArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


46
47
48
# File 'lib/verizon/models/notificationarray.rb', line 46

def sms_numbers
  @sms_numbers
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/verizon/models/notificationarray.rb', line 130

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  notification_type =
    hash.key?('notificationType') ? hash['notificationType'] : SKIP
  callback = hash.key?('callback') ? hash['callback'] : SKIP
  email_notification =
    hash.key?('emailNotification') ? hash['emailNotification'] : SKIP
  notification_group_name =
    hash.key?('notificationGroupName') ? hash['notificationGroupName'] : SKIP
  notification_frequency_factor =
    hash.key?('notificationFrequencyFactor') ? hash['notificationFrequencyFactor'] : SKIP
  notification_frequency_interval =
    hash.key?('notificationFrequencyInterval') ? hash['notificationFrequencyInterval'] : SKIP
  external_email_recipients =
    hash.key?('externalEmailRecipients') ? hash['externalEmailRecipients'] : SKIP
  sms_notification =
    hash.key?('smsNotification') ? hash['smsNotification'] : SKIP
  sms_numbers = hash.key?('smsNumbers') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:NotificationarraySmsNumbers), hash['smsNumbers']
  ) : SKIP
  reminder = hash.key?('reminder') ? hash['reminder'] : SKIP
  severity = hash.key?('severity') ? hash['severity'] : 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.
  Notificationarray.new(notification_type: notification_type,
                        callback: callback,
                        email_notification: email_notification,
                        notification_group_name: notification_group_name,
                        notification_frequency_factor: notification_frequency_factor,
                        notification_frequency_interval: notification_frequency_interval,
                        external_email_recipients: external_email_recipients,
                        sms_notification: sms_notification,
                        sms_numbers: sms_numbers,
                        reminder: reminder,
                        severity: severity,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['notification_type'] = 'notificationType'
  @_hash['callback'] = 'callback'
  @_hash['email_notification'] = 'emailNotification'
  @_hash['notification_group_name'] = 'notificationGroupName'
  @_hash['notification_frequency_factor'] = 'notificationFrequencyFactor'
  @_hash['notification_frequency_interval'] =
    'notificationFrequencyInterval'
  @_hash['external_email_recipients'] = 'externalEmailRecipients'
  @_hash['sms_notification'] = 'smsNotification'
  @_hash['sms_numbers'] = 'smsNumbers'
  @_hash['reminder'] = 'reminder'
  @_hash['severity'] = 'severity'
  @_hash
end

.nullablesObject

An array for nullable fields



92
93
94
# File 'lib/verizon/models/notificationarray.rb', line 92

def self.nullables
  []
end

.optionalsObject

An array for optional fields



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/verizon/models/notificationarray.rb', line 75

def self.optionals
  %w[
    notification_type
    callback
    email_notification
    notification_group_name
    notification_frequency_factor
    notification_frequency_interval
    external_email_recipients
    sms_notification
    sms_numbers
    reminder
    severity
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



179
180
181
182
183
184
185
# File 'lib/verizon/models/notificationarray.rb', line 179

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.



201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/verizon/models/notificationarray.rb', line 201

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} notification_type: #{@notification_type.inspect}, callback:"\
  " #{@callback.inspect}, email_notification: #{@email_notification.inspect},"\
  " notification_group_name: #{@notification_group_name.inspect},"\
  " notification_frequency_factor: #{@notification_frequency_factor.inspect},"\
  " notification_frequency_interval: #{@notification_frequency_interval.inspect},"\
  " external_email_recipients: #{@external_email_recipients.inspect}, sms_notification:"\
  " #{@sms_notification.inspect}, sms_numbers: #{@sms_numbers.inspect}, reminder:"\
  " #{@reminder.inspect}, severity: #{@severity.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



188
189
190
191
192
193
194
195
196
197
198
# File 'lib/verizon/models/notificationarray.rb', line 188

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} notification_type: #{@notification_type}, callback: #{@callback},"\
  " email_notification: #{@email_notification}, notification_group_name:"\
  " #{@notification_group_name}, notification_frequency_factor:"\
  " #{@notification_frequency_factor}, notification_frequency_interval:"\
  " #{@notification_frequency_interval}, external_email_recipients:"\
  " #{@external_email_recipients}, sms_notification: #{@sms_notification}, sms_numbers:"\
  " #{@sms_numbers}, reminder: #{@reminder}, severity: #{@severity}, additional_properties:"\
  " #{@additional_properties}>"
end