Class: Verizon::TriggerNotification
- Defined in:
- lib/verizon/models/trigger_notification.rb
Overview
The notification details of the trigger.
Instance Attribute Summary collapse
-
#callback ⇒ TrueClass | FalseClass
Whether or not the notification should be sent via callback.<br />true<br />false.
-
#email_notification ⇒ TrueClass | FalseClass
Whether or not the notification should be sent via e-mail.<br />true<br />false.
-
#external_email_recipients ⇒ String
E-mail address(es) where the notification should be delivered.
-
#notification_frequency_factor ⇒ Integer
Frequency factor for notification.
-
#notification_frequency_interval ⇒ String
Frequency interval for notification.
-
#notification_group_name ⇒ String
Name for the notification group.
-
#notification_type ⇒ String
The type of notification, i.e.
-
#reminder ⇒ TrueClass | FalseClass
List of SMS numbers.
-
#severity ⇒ String
Severity level associated with the notification.
-
#sms_notification ⇒ TrueClass | FalseClass
SMS notification.
-
#sms_numbers ⇒ Array[SMSNumber]
List of SMS numbers.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#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) ⇒ TriggerNotification
constructor
A new instance of TriggerNotification.
Methods inherited from BaseModel
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) ⇒ TriggerNotification
Returns a new instance of TriggerNotification.
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 |
# File 'lib/verizon/models/trigger_notification.rb', line 99 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) @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 end |
Instance Attribute Details
#callback ⇒ TrueClass | FalseClass
Whether or not the notification should be sent via callback.<br />true<br />false.
19 20 21 |
# File 'lib/verizon/models/trigger_notification.rb', line 19 def callback @callback end |
#email_notification ⇒ TrueClass | FalseClass
Whether or not the notification should be sent via e-mail.<br />true<br />false.
24 25 26 |
# File 'lib/verizon/models/trigger_notification.rb', line 24 def email_notification @email_notification end |
#external_email_recipients ⇒ String
E-mail address(es) where the notification should be delivered.
40 41 42 |
# File 'lib/verizon/models/trigger_notification.rb', line 40 def external_email_recipients @external_email_recipients end |
#notification_frequency_factor ⇒ Integer
Frequency factor for notification.
32 33 34 |
# File 'lib/verizon/models/trigger_notification.rb', line 32 def notification_frequency_factor @notification_frequency_factor end |
#notification_frequency_interval ⇒ String
Frequency interval for notification.
36 37 38 |
# File 'lib/verizon/models/trigger_notification.rb', line 36 def notification_frequency_interval @notification_frequency_interval end |
#notification_group_name ⇒ String
Name for the notification group.
28 29 30 |
# File 'lib/verizon/models/trigger_notification.rb', line 28 def notification_group_name @notification_group_name end |
#notification_type ⇒ String
The type of notification, i.e. ‘DailySummary’.
14 15 16 |
# File 'lib/verizon/models/trigger_notification.rb', line 14 def notification_type @notification_type end |
#reminder ⇒ TrueClass | FalseClass
List of SMS numbers.
52 53 54 |
# File 'lib/verizon/models/trigger_notification.rb', line 52 def reminder @reminder end |
#severity ⇒ String
Severity level associated with the notification. Examples would be:<br />Major<br />Minor<br />Critical<br />NotApplicable.
57 58 59 |
# File 'lib/verizon/models/trigger_notification.rb', line 57 def severity @severity end |
#sms_notification ⇒ TrueClass | FalseClass
SMS notification.
44 45 46 |
# File 'lib/verizon/models/trigger_notification.rb', line 44 def sms_notification @sms_notification end |
#sms_numbers ⇒ Array[SMSNumber]
List of SMS numbers.
48 49 50 |
# File 'lib/verizon/models/trigger_notification.rb', line 48 def sms_numbers @sms_numbers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
128 129 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 |
# File 'lib/verizon/models/trigger_notification.rb', line 128 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 # Parameter is an array, so we need to iterate through it sms_numbers = nil unless hash['smsNumbers'].nil? sms_numbers = [] hash['smsNumbers'].each do |structure| sms_numbers << (SMSNumber.from_hash(structure) if structure) end end sms_numbers = SKIP unless hash.key?('smsNumbers') reminder = hash.key?('reminder') ? hash['reminder'] : SKIP severity = hash.key?('severity') ? hash['severity'] : SKIP # Create object from extracted values. TriggerNotification.new(notification_type, callback, email_notification, notification_group_name, notification_frequency_factor, notification_frequency_interval, external_email_recipients, sms_notification, sms_numbers, reminder, severity) end |
.names ⇒ Object
A mapping from model property names to API property names.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/verizon/models/trigger_notification.rb', line 60 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 |
.nullables ⇒ Object
An array for nullable fields
95 96 97 |
# File 'lib/verizon/models/trigger_notification.rb', line 95 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/verizon/models/trigger_notification.rb', line 78 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 |