Class: Sendmux::Management::Generated::WebhookDeliveryAttempt

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/sendmux_management_generated/models/webhook_delivery_attempt.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 = {}) ⇒ WebhookDeliveryAttempt

Initializes the object

Parameters:

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

    Model attributes in the form of hash



155
156
157
158
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_delivery_attempt.rb', line 155

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::WebhookDeliveryAttempt` 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::WebhookDeliveryAttempt`. 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?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#created_atObject

ISO 8601 attempt timestamp



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

def created_at
  @created_at
end

#delivery_attemptObject

1-based retry attempt number.



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

def delivery_attempt
  @delivery_attempt
end

#error_messageObject

Public-safe network error category when no HTTP response was received.



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

def error_message
  @error_message
end

#event_idObject

Webhook event ID



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

def event_id
  @event_id
end

#event_typeObject

Event types a webhook may subscribe to. ‘sendmux.test` is accepted so you can verify end-to-end delivery via POST /webhooks/#id/test.



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

def event_type
  @event_type
end

#idObject

Delivery-attempt public ID



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

def id
  @id
end

#max_attemptsObject

Maximum attempts before the subscription is marked failing.



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

def max_attempts
  @max_attempts
end

#next_retry_atObject

Next retry timestamp when result is retrying; otherwise null.



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

def next_retry_at
  @next_retry_at
end

#payload_availableObject

True while the delivered request payload can still be fetched.



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

def payload_available
  @payload_available
end

#payload_expires_atObject

Timestamp when the retained request payload expires.



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

def payload_expires_at
  @payload_expires_at
end

#request_payload_bytesObject

Size of the delivered request payload in bytes.



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

def request_payload_bytes
  @request_payload_bytes
end

#request_payload_sha256Object

SHA-256 digest of the delivered request payload.



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

def request_payload_sha256
  @request_payload_sha256
end

#response_bodyObject

Truncated endpoint response preview, if any.



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

def response_body
  @response_body
end

#response_msObject

End-to-end delivery latency in milliseconds.



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

def response_ms
  @response_ms
end

#response_statusObject

HTTP status returned by the endpoint, or null for network/timeout failures.



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

def response_status
  @response_status
end

#resultObject

Delivery result for this attempt.



64
65
66
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 64

def result
  @result
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



111
112
113
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 111

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



116
117
118
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 116

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 89

def self.attribute_map
  {
    :'created_at' => :'created_at',
    :'delivery_attempt' => :'delivery_attempt',
    :'error_message' => :'error_message',
    :'event_id' => :'event_id',
    :'event_type' => :'event_type',
    :'id' => :'id',
    :'max_attempts' => :'max_attempts',
    :'next_retry_at' => :'next_retry_at',
    :'payload_available' => :'payload_available',
    :'payload_expires_at' => :'payload_expires_at',
    :'request_payload_bytes' => :'request_payload_bytes',
    :'request_payload_sha256' => :'request_payload_sha256',
    :'response_body' => :'response_body',
    :'response_ms' => :'response_ms',
    :'response_status' => :'response_status',
    :'result' => :'result'
  }
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



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 524

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



143
144
145
146
147
148
149
150
151
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 143

def self.openapi_nullable
  Set.new([
    :'error_message',
    :'next_retry_at',
    :'request_payload_sha256',
    :'response_body',
    :'response_status',
  ])
end

.openapi_typesObject

Attribute type mapping.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 121

def self.openapi_types
  {
    :'created_at' => :'String',
    :'delivery_attempt' => :'Integer',
    :'error_message' => :'String',
    :'event_id' => :'String',
    :'event_type' => :'String',
    :'id' => :'String',
    :'max_attempts' => :'Integer',
    :'next_retry_at' => :'String',
    :'payload_available' => :'Boolean',
    :'payload_expires_at' => :'String',
    :'request_payload_bytes' => :'Integer',
    :'request_payload_sha256' => :'String',
    :'response_body' => :'String',
    :'response_ms' => :'Integer',
    :'response_status' => :'Integer',
    :'result' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 488

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created_at == o.created_at &&
      delivery_attempt == o.delivery_attempt &&
      error_message == o.error_message &&
      event_id == o.event_id &&
      event_type == o.event_type &&
      id == o.id &&
      max_attempts == o.max_attempts &&
      next_retry_at == o.next_retry_at &&
      payload_available == o.payload_available &&
      payload_expires_at == o.payload_expires_at &&
      request_payload_bytes == o.request_payload_bytes &&
      request_payload_sha256 == o.request_payload_sha256 &&
      response_body == o.response_body &&
      response_ms == o.response_ms &&
      response_status == o.response_status &&
      result == o.result
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


511
512
513
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 511

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



517
518
519
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 517

def hash
  [created_at, delivery_attempt, error_message, event_id, event_type, id, max_attempts, next_retry_at, payload_available, payload_expires_at, request_payload_bytes, request_payload_sha256, response_body, response_ms, response_status, result].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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 268

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

  if @delivery_attempt.nil?
    invalid_properties.push('invalid value for "delivery_attempt", delivery_attempt cannot be nil.')
  end

  if @delivery_attempt <= 0
    invalid_properties.push('invalid value for "delivery_attempt", must be greater than 0.')
  end

  if @event_id.nil?
    invalid_properties.push('invalid value for "event_id", event_id cannot be nil.')
  end

  if @event_type.nil?
    invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @max_attempts.nil?
    invalid_properties.push('invalid value for "max_attempts", max_attempts cannot be nil.')
  end

  if @max_attempts <= 0
    invalid_properties.push('invalid value for "max_attempts", must be greater than 0.')
  end

  if @payload_available.nil?
    invalid_properties.push('invalid value for "payload_available", payload_available cannot be nil.')
  end

  if @payload_expires_at.nil?
    invalid_properties.push('invalid value for "payload_expires_at", payload_expires_at cannot be nil.')
  end

  if @request_payload_bytes.nil?
    invalid_properties.push('invalid value for "request_payload_bytes", request_payload_bytes cannot be nil.')
  end

  if @request_payload_bytes < 0
    invalid_properties.push('invalid value for "request_payload_bytes", must be greater than or equal to 0.')
  end

  if @response_ms.nil?
    invalid_properties.push('invalid value for "response_ms", response_ms cannot be nil.')
  end

  if @response_ms < 0
    invalid_properties.push('invalid value for "response_ms", must be greater than or equal to 0.')
  end

  if @result.nil?
    invalid_properties.push('invalid value for "result", result 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



546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 546

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



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/sendmux_management_generated/models/webhook_delivery_attempt.rb', line 336

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @created_at.nil?
  return false if @delivery_attempt.nil?
  return false if @delivery_attempt <= 0
  return false if @event_id.nil?
  return false if @event_type.nil?
  event_type_validator = EnumAttributeValidator.new('String', ["message.delivered", "message.bounced", "message.complained", "message.rejected", "message.delivery_delayed", "message.received", "message.received.spam", "sendmux.test", "unknown_default_open_api"])
  return false unless event_type_validator.valid?(@event_type)
  return false if @id.nil?
  return false if @max_attempts.nil?
  return false if @max_attempts <= 0
  return false if @payload_available.nil?
  return false if @payload_expires_at.nil?
  return false if @request_payload_bytes.nil?
  return false if @request_payload_bytes < 0
  return false if @response_ms.nil?
  return false if @response_ms < 0
  return false if @result.nil?
  result_validator = EnumAttributeValidator.new('String', ["success", "retrying", "failed", "permanent_failure", "unknown_default_open_api"])
  return false unless result_validator.valid?(@result)
  true
end