Class: Pago::V2026_04::Models::WebhookSubscriptionCreatedPayload

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

Overview

Sent when a new subscription is created.

When this event occurs, the subscription status might not be active yet, as we can still have to wait for the first payment to be processed.

Discord & Slack support: Full

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  type: "type",
  timestamp: "timestamp",
  data: "data"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["type", "timestamp", "data"].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(type:, timestamp:, data:) ⇒ WebhookSubscriptionCreatedPayload

Returns a new instance of WebhookSubscriptionCreatedPayload.

Parameters:



45998
45999
46000
46001
46002
46003
46004
46005
46006
46007
# File 'lib/pago/v2026_04/models.rb', line 45998

def initialize(
  type:,
  timestamp:,
  data:
)
  super()
  assign(:type, type)
  assign(:timestamp, timestamp)
  assign(:data, data)
end

Instance Attribute Details

#dataModels::Subscription (readonly)



45996
45997
45998
# File 'lib/pago/v2026_04/models.rb', line 45996

def data
  @data
end

#timestampString (readonly)

Returns:

  • (String)


45993
45994
45995
# File 'lib/pago/v2026_04/models.rb', line 45993

def timestamp
  @timestamp
end

#typeString (readonly)

Returns:

  • (String)


45990
45991
45992
# File 'lib/pago/v2026_04/models.rb', line 45990

def type
  @type
end

Class Method Details

.from_json(data) ⇒ WebhookSubscriptionCreatedPayload?

Parameters:

  • data (Hash, String, nil)

Returns:



46011
46012
46013
46014
46015
46016
46017
46018
46019
46020
46021
46022
46023
46024
# File 'lib/pago/v2026_04/models.rb', line 46011

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(
      type: (data.key?("type") ? data["type"] : ::Pago::UNSET),
      timestamp: (data.key?("timestamp") ? data["timestamp"] : ::Pago::UNSET),
      data: (data.key?("data") ? Models::Subscription.from_json(data["data"]) : ::Pago::UNSET)
    ),
    data
  )
end