Class: Pago::V2026_04::Models::WebhookEvent

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Overview

A webhook event.

An event represent something that happened in the system that should be sent to the webhook endpoint.

It can be delivered multiple times until it's marked as succeeded, each one creating a new delivery.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  last_http_code: "last_http_code",
  succeeded: "succeeded",
  skipped: "skipped",
  payload: "payload",
  type: "type",
  is_archived: "is_archived"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["created_at", "modified_at", "id", "skipped", "payload", "type", "is_archived"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(created_at:, modified_at:, id:, last_http_code: ::Pago::UNSET, succeeded: ::Pago::UNSET, skipped:, payload:, type:, is_archived:) ⇒ WebhookEvent

Returns a new instance of WebhookEvent.

Parameters:

  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • last_http_code: (Integer, nil) (defaults to: ::Pago::UNSET)
  • succeeded: (Boolean, nil) (defaults to: ::Pago::UNSET)
  • skipped: (Boolean)
  • payload: (String, nil)
  • type: (String)
  • is_archived: (Boolean)


44409
44410
44411
44412
44413
44414
44415
44416
44417
44418
44419
44420
44421
44422
44423
44424
44425
44426
44427
44428
44429
44430
# File 'lib/pago/v2026_04/models.rb', line 44409

def initialize(
  created_at:,
  modified_at:,
  id:,
  last_http_code: ::Pago::UNSET,
  succeeded: ::Pago::UNSET,
  skipped:,
  payload:,
  type:,
  is_archived:
)
  super()
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:id, id)
  assign(:last_http_code, last_http_code)
  assign(:succeeded, succeeded)
  assign(:skipped, skipped)
  assign(:payload, payload)
  assign(:type, type)
  assign(:is_archived, is_archived)
end

Instance Attribute Details

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


44376
44377
44378
# File 'lib/pago/v2026_04/models.rb', line 44376

def created_at
  @created_at
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


44384
44385
44386
# File 'lib/pago/v2026_04/models.rb', line 44384

def id
  @id
end

#is_archivedBoolean (readonly)

Whether this event is archived. Archived events can't be redelivered, and the payload is not accessible anymore.

Returns:

  • (Boolean)


44407
44408
44409
# File 'lib/pago/v2026_04/models.rb', line 44407

def is_archived
  @is_archived
end

#last_http_codeInteger? (readonly)

Last HTTP code returned by the URL. null if no delviery has been attempted or if the endpoint was unreachable.

Returns:

  • (Integer, nil)


44388
44389
44390
# File 'lib/pago/v2026_04/models.rb', line 44388

def last_http_code
  @last_http_code
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


44380
44381
44382
# File 'lib/pago/v2026_04/models.rb', line 44380

def modified_at
  @modified_at
end

#payloadString? (readonly)

The payload of the webhook event.

Returns:

  • (String, nil)


44400
44401
44402
# File 'lib/pago/v2026_04/models.rb', line 44400

def payload
  @payload
end

#skippedBoolean (readonly)

Whether this event was skipped because the webhook endpoint was disabled.

Returns:

  • (Boolean)


44396
44397
44398
# File 'lib/pago/v2026_04/models.rb', line 44396

def skipped
  @skipped
end

#succeededBoolean? (readonly)

Whether this event was successfully delivered. null if no delivery has been attempted.

Returns:

  • (Boolean, nil)


44392
44393
44394
# File 'lib/pago/v2026_04/models.rb', line 44392

def succeeded
  @succeeded
end

#typeString (readonly)

Returns:

  • (String)


44403
44404
44405
# File 'lib/pago/v2026_04/models.rb', line 44403

def type
  @type
end

Class Method Details

.from_json(data) ⇒ WebhookEvent?

Parameters:

  • data (Hash, String, nil)

Returns:



44434
44435
44436
44437
44438
44439
44440
44441
44442
44443
44444
44445
44446
44447
44448
44449
44450
44451
44452
44453
# File 'lib/pago/v2026_04/models.rb', line 44434

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      last_http_code: (data.key?("last_http_code") ? data["last_http_code"] : ::Pago::UNSET),
      succeeded: (data.key?("succeeded") ? data["succeeded"] : ::Pago::UNSET),
      skipped: (data.key?("skipped") ? data["skipped"] : ::Pago::UNSET),
      payload: (data.key?("payload") ? data["payload"] : ::Pago::UNSET),
      type: (data.key?("type") ? data["type"] : ::Pago::UNSET),
      is_archived: (data.key?("is_archived") ? data["is_archived"] : ::Pago::UNSET)
    ),
    data
  )
end