Class: Pago::V2026_04::Models::MeterCreditEvent

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

Overview

An event created by Pago when credits are added to a customer meter.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  id: "id",
  timestamp: "timestamp",
  organization_id: "organization_id",
  customer_id: "customer_id",
  customer: "customer",
  external_customer_id: "external_customer_id",
  member_id: "member_id",
  external_member_id: "external_member_id",
  child_count: "child_count",
  parent_id: "parent_id",
  label: "label",
  source: "source",
  name: "name",
  metadata: "metadata"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["id", "timestamp", "organization_id", "customer_id", "customer", "external_customer_id", "label", "source", "name", "metadata"].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(id:, timestamp:, organization_id:, customer_id:, customer:, external_customer_id:, member_id: ::Pago::UNSET, external_member_id: ::Pago::UNSET, child_count: ::Pago::UNSET, parent_id: ::Pago::UNSET, label:, source:, name:, metadata:) ⇒ MeterCreditEvent

Returns a new instance of MeterCreditEvent.

Parameters:

  • id: (String)
  • timestamp: (String)
  • organization_id: (String)
  • customer_id: (String, nil)
  • customer: (Object)
  • external_customer_id: (String, nil)
  • member_id: (String, nil) (defaults to: ::Pago::UNSET)
  • external_member_id: (String, nil) (defaults to: ::Pago::UNSET)
  • child_count: (Integer, nil) (defaults to: ::Pago::UNSET)
  • parent_id: (String, nil) (defaults to: ::Pago::UNSET)
  • label: (String)
  • source: (String)
  • name: (String)
  • metadata: (Models::MeterCreditedMetadata)


29295
29296
29297
29298
29299
29300
29301
29302
29303
29304
29305
29306
29307
29308
29309
29310
29311
29312
29313
29314
29315
29316
29317
29318
29319
29320
29321
29322
29323
29324
29325
29326
# File 'lib/pago/v2026_04/models.rb', line 29295

def initialize(
  id:,
  timestamp:,
  organization_id:,
  customer_id:,
  customer:,
  external_customer_id:,
  member_id: ::Pago::UNSET,
  external_member_id: ::Pago::UNSET,
  child_count: ::Pago::UNSET,
  parent_id: ::Pago::UNSET,
  label:,
  source:,
  name:,
  metadata:
)
  super()
  assign(:id, id)
  assign(:timestamp, timestamp)
  assign(:organization_id, organization_id)
  assign(:customer_id, customer_id)
  assign(:customer, customer)
  assign(:external_customer_id, external_customer_id)
  assign(:member_id, member_id)
  assign(:external_member_id, external_member_id)
  assign(:child_count, child_count)
  assign(:parent_id, parent_id)
  assign(:label, label)
  assign(:source, source)
  assign(:name, name)
  assign(:metadata, )
end

Instance Attribute Details

#child_countInteger (readonly)

Number of direct child events linked to this event.

Returns:

  • (Integer)


29274
29275
29276
# File 'lib/pago/v2026_04/models.rb', line 29274

def child_count
  @child_count
end

#customerObject? (readonly)

The customer associated with the event.

Returns:

  • (Object, nil)


29258
29259
29260
# File 'lib/pago/v2026_04/models.rb', line 29258

def customer
  @customer
end

#customer_idString? (readonly)

ID of the customer in your Pago organization associated with the event.

Returns:

  • (String, nil)


29254
29255
29256
# File 'lib/pago/v2026_04/models.rb', line 29254

def customer_id
  @customer_id
end

#external_customer_idString? (readonly)

ID of the customer in your system associated with the event.

Returns:

  • (String, nil)


29262
29263
29264
# File 'lib/pago/v2026_04/models.rb', line 29262

def external_customer_id
  @external_customer_id
end

#external_member_idString? (readonly)

ID of the member in your system within the customer's organization who performed the action inside B2B.

Returns:

  • (String, nil)


29270
29271
29272
# File 'lib/pago/v2026_04/models.rb', line 29270

def external_member_id
  @external_member_id
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


29242
29243
29244
# File 'lib/pago/v2026_04/models.rb', line 29242

def id
  @id
end

#labelString (readonly)

Human readable label of the event type.

Returns:

  • (String)


29282
29283
29284
# File 'lib/pago/v2026_04/models.rb', line 29282

def label
  @label
end

#member_idString? (readonly)

ID of the member within the customer's organization who performed the action inside B2B.

Returns:

  • (String, nil)


29266
29267
29268
# File 'lib/pago/v2026_04/models.rb', line 29266

def member_id
  @member_id
end

#metadataModels::MeterCreditedMetadata (readonly)



29293
29294
29295
# File 'lib/pago/v2026_04/models.rb', line 29293

def 
  @metadata
end

#nameString (readonly)

The name of the event.

Returns:

  • (String)


29290
29291
29292
# File 'lib/pago/v2026_04/models.rb', line 29290

def name
  @name
end

#organization_idString (readonly)

The ID of the organization owning the event.

Returns:

  • (String)


29250
29251
29252
# File 'lib/pago/v2026_04/models.rb', line 29250

def organization_id
  @organization_id
end

#parent_idString? (readonly)

The ID of the parent event.

Returns:

  • (String, nil)


29278
29279
29280
# File 'lib/pago/v2026_04/models.rb', line 29278

def parent_id
  @parent_id
end

#sourceString (readonly)

The source of the event. system events are created by Pago. user events are the one you create through our ingestion API.

Returns:

  • (String)


29286
29287
29288
# File 'lib/pago/v2026_04/models.rb', line 29286

def source
  @source
end

#timestampString (readonly)

The timestamp of the event.

Returns:

  • (String)


29246
29247
29248
# File 'lib/pago/v2026_04/models.rb', line 29246

def timestamp
  @timestamp
end

Class Method Details

.from_json(data) ⇒ MeterCreditEvent?

Parameters:

  • data (Hash, String, nil)

Returns:



29330
29331
29332
29333
29334
29335
29336
29337
29338
29339
29340
29341
29342
29343
29344
29345
29346
29347
29348
29349
29350
29351
29352
29353
29354
# File 'lib/pago/v2026_04/models.rb', line 29330

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(
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      timestamp: (data.key?("timestamp") ? data["timestamp"] : ::Pago::UNSET),
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET),
      customer: (data.key?("customer") ? Unions::Customer.from_json(data["customer"]) : ::Pago::UNSET),
      external_customer_id: (data.key?("external_customer_id") ? data["external_customer_id"] : ::Pago::UNSET),
      member_id: (data.key?("member_id") ? data["member_id"] : ::Pago::UNSET),
      external_member_id: (data.key?("external_member_id") ? data["external_member_id"] : ::Pago::UNSET),
      child_count: (data.key?("child_count") ? data["child_count"] : ::Pago::UNSET),
      parent_id: (data.key?("parent_id") ? data["parent_id"] : ::Pago::UNSET),
      label: (data.key?("label") ? data["label"] : ::Pago::UNSET),
      source: (data.key?("source") ? data["source"] : ::Pago::UNSET),
      name: (data.key?("name") ? data["name"] : ::Pago::UNSET),
      metadata: (data.key?("metadata") ? Models::MeterCreditedMetadata.from_json(data["metadata"]) : ::Pago::UNSET)
    ),
    data
  )
end