Class: Sendmux::Management::Generated::WebhookEventData

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/sendmux_management_generated/models/webhook_event_data.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ WebhookEventData

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 159

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::WebhookEventData` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Management::Generated::WebhookEventData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'bounce_subtype')
    self.bounce_subtype = attributes[:'bounce_subtype']
  else
    self.bounce_subtype = nil
  end

  if attributes.key?(:'bounce_type')
    self.bounce_type = attributes[:'bounce_type']
  else
    self.bounce_type = nil
  end

  if attributes.key?(:'complaint_subtype')
    self.complaint_subtype = attributes[:'complaint_subtype']
  else
    self.complaint_subtype = nil
  end

  if attributes.key?(:'complaint_type')
    self.complaint_type = attributes[:'complaint_type']
  else
    self.complaint_type = nil
  end

  if attributes.key?(:'delay_expires_at')
    self.delay_expires_at = attributes[:'delay_expires_at']
  else
    self.delay_expires_at = nil
  end

  if attributes.key?(:'delay_type')
    self.delay_type = attributes[:'delay_type']
  else
    self.delay_type = nil
  end

  if attributes.key?(:'is_spam')
    self.is_spam = attributes[:'is_spam']
  else
    self.is_spam = nil
  end

  if attributes.key?(:'mailbox_id')
    self.mailbox_id = attributes[:'mailbox_id']
  else
    self.mailbox_id = nil
  end

  if attributes.key?(:'message_id')
    self.message_id = attributes[:'message_id']
  else
    self.message_id = nil
  end

  if attributes.key?(:'message_id_kind')
    self.message_id_kind = attributes[:'message_id_kind']
  else
    self.message_id_kind = nil
  end

  if attributes.key?(:'recipients')
    if (value = attributes[:'recipients']).is_a?(Array)
      self.recipients = value
    end
  else
    self.recipients = nil
  end

  if attributes.key?(:'reject_reason')
    self.reject_reason = attributes[:'reject_reason']
  else
    self.reject_reason = nil
  end

  if attributes.key?(:'sender')
    self.sender = attributes[:'sender']
  else
    self.sender = nil
  end

  if attributes.key?(:'sendmux_message_id')
    self.sendmux_message_id = attributes[:'sendmux_message_id']
  else
    self.sendmux_message_id = nil
  end

  if attributes.key?(:'webhook_id')
    self.webhook_id = attributes[:'webhook_id']
  else
    self.webhook_id = nil
  end
end

Instance Attribute Details

#bounce_subtypeObject

More specific bounce category when available.



19
20
21
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 19

def bounce_subtype
  @bounce_subtype
end

#bounce_typeObject

Bounce category for ‘message.bounced` events.



22
23
24
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 22

def bounce_type
  @bounce_type
end

#complaint_subtypeObject

More specific complaint category when available.



25
26
27
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 25

def complaint_subtype
  @complaint_subtype
end

#complaint_typeObject

Complaint category for ‘message.complained` events.



28
29
30
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 28

def complaint_type
  @complaint_type
end

#delay_expires_atObject

When delivery retries are expected to stop, when provided.



31
32
33
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 31

def delay_expires_at
  @delay_expires_at
end

#delay_typeObject

Delay category for ‘message.delivery_delayed` events.



34
35
36
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 34

def delay_type
  @delay_type
end

#is_spamObject

Only populated for inbound mailbox events.



37
38
39
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 37

def is_spam
  @is_spam
end

#mailbox_idObject

Mailbox public ID for inbound mailbox events when resolved.



40
41
42
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 40

def mailbox_id
  @mailbox_id
end

#message_idObject

Message identifier from the event source.



43
44
45
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 43

def message_id
  @message_id
end

#message_id_kindObject

‘provider` for sending feedback IDs; `rfc5322` for inbound email Message-ID header values.



46
47
48
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 46

def message_id_kind
  @message_id_kind
end

#recipientsObject

All affected recipients. Empty for synthetic test events.



49
50
51
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 49

def recipients
  @recipients
end

#reject_reasonObject

Reject reason for ‘message.rejected` events.



52
53
54
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 52

def reject_reason
  @reject_reason
end

#senderObject

Sender/envelope-from address when available.



55
56
57
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 55

def sender
  @sender
end

#sendmux_message_idObject

Sendmux message correlation ID for outbound sending feedback when available.



58
59
60
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 58

def sendmux_message_id
  @sendmux_message_id
end

#webhook_idObject

Target webhook ID for synthetic ‘sendmux.test` payloads.



61
62
63
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 61

def webhook_id
  @webhook_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 86

def self.attribute_map
  {
    :'bounce_subtype' => :'bounce_subtype',
    :'bounce_type' => :'bounce_type',
    :'complaint_subtype' => :'complaint_subtype',
    :'complaint_type' => :'complaint_type',
    :'delay_expires_at' => :'delay_expires_at',
    :'delay_type' => :'delay_type',
    :'is_spam' => :'is_spam',
    :'mailbox_id' => :'mailbox_id',
    :'message_id' => :'message_id',
    :'message_id_kind' => :'message_id_kind',
    :'recipients' => :'recipients',
    :'reject_reason' => :'reject_reason',
    :'sender' => :'sender',
    :'sendmux_message_id' => :'sendmux_message_id',
    :'webhook_id' => :'webhook_id'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 357

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 138

def self.openapi_nullable
  Set.new([
    :'bounce_subtype',
    :'bounce_type',
    :'complaint_subtype',
    :'complaint_type',
    :'delay_expires_at',
    :'delay_type',
    :'is_spam',
    :'mailbox_id',
    :'message_id',
    :'message_id_kind',
    :'reject_reason',
    :'sender',
    :'sendmux_message_id',
    :'webhook_id'
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 117

def self.openapi_types
  {
    :'bounce_subtype' => :'String',
    :'bounce_type' => :'String',
    :'complaint_subtype' => :'String',
    :'complaint_type' => :'String',
    :'delay_expires_at' => :'String',
    :'delay_type' => :'String',
    :'is_spam' => :'Boolean',
    :'mailbox_id' => :'String',
    :'message_id' => :'String',
    :'message_id_kind' => :'String',
    :'recipients' => :'Array<String>',
    :'reject_reason' => :'String',
    :'sender' => :'String',
    :'sendmux_message_id' => :'String',
    :'webhook_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 322

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      bounce_subtype == o.bounce_subtype &&
      bounce_type == o.bounce_type &&
      complaint_subtype == o.complaint_subtype &&
      complaint_type == o.complaint_type &&
      delay_expires_at == o.delay_expires_at &&
      delay_type == o.delay_type &&
      is_spam == o.is_spam &&
      mailbox_id == o.mailbox_id &&
      message_id == o.message_id &&
      message_id_kind == o.message_id_kind &&
      recipients == o.recipients &&
      reject_reason == o.reject_reason &&
      sender == o.sender &&
      sendmux_message_id == o.sendmux_message_id &&
      webhook_id == o.webhook_id
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


344
345
346
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 344

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



350
351
352
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 350

def hash
  [bounce_subtype, bounce_type, complaint_subtype, complaint_type, delay_expires_at, delay_type, is_spam, mailbox_id, message_id, message_id_kind, recipients, reject_reason, sender, sendmux_message_id, webhook_id].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



268
269
270
271
272
273
274
275
276
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 268

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @recipients.nil?
    invalid_properties.push('invalid value for "recipients", recipients cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 379

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



280
281
282
283
284
285
286
287
288
# File 'lib/sendmux_management_generated/models/webhook_event_data.rb', line 280

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  bounce_type_validator = EnumAttributeValidator.new('String', ["Permanent", "Transient", "Undetermined", "unknown_default_open_api"])
  return false unless bounce_type_validator.valid?(@bounce_type)
  message_id_kind_validator = EnumAttributeValidator.new('String', ["provider", "rfc5322", "unknown_default_open_api"])
  return false unless message_id_kind_validator.valid?(@message_id_kind)
  return false if @recipients.nil?
  true
end