Class: Pago::V2026_04::Models::CustomerWallet

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

Overview

A wallet represents your balance with an organization.

You can top-up your wallet and use the balance to pay for usage.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  id: "id",
  created_at: "created_at",
  modified_at: "modified_at",
  customer_id: "customer_id",
  balance: "balance",
  currency: "currency"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["id", "created_at", "modified_at", "customer_id", "balance", "currency"].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:, created_at:, modified_at:, customer_id:, balance:, currency:) ⇒ CustomerWallet

Returns a new instance of CustomerWallet.

Parameters:

  • id: (String)
  • created_at: (String)
  • modified_at: (String, nil)
  • customer_id: (String)
  • balance: (Integer)
  • currency: (String)


22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
# File 'lib/pago/v2026_04/models.rb', line 22314

def initialize(
  id:,
  created_at:,
  modified_at:,
  customer_id:,
  balance:,
  currency:
)
  super()
  assign(:id, id)
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:customer_id, customer_id)
  assign(:balance, balance)
  assign(:currency, currency)
end

Instance Attribute Details

#balanceInteger (readonly)

The current balance of the wallet, in cents.

Returns:

  • (Integer)


22308
22309
22310
# File 'lib/pago/v2026_04/models.rb', line 22308

def balance
  @balance
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


22296
22297
22298
# File 'lib/pago/v2026_04/models.rb', line 22296

def created_at
  @created_at
end

#currencyString (readonly)

The currency of the wallet.

Returns:

  • (String)


22312
22313
22314
# File 'lib/pago/v2026_04/models.rb', line 22312

def currency
  @currency
end

#customer_idString (readonly)

The ID of the customer that owns the wallet.

Returns:

  • (String)


22304
22305
22306
# File 'lib/pago/v2026_04/models.rb', line 22304

def customer_id
  @customer_id
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


22292
22293
22294
# File 'lib/pago/v2026_04/models.rb', line 22292

def id
  @id
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


22300
22301
22302
# File 'lib/pago/v2026_04/models.rb', line 22300

def modified_at
  @modified_at
end

Class Method Details

.from_json(data) ⇒ CustomerWallet?

Parameters:

  • data (Hash, String, nil)

Returns:



22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
# File 'lib/pago/v2026_04/models.rb', line 22333

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),
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET),
      balance: (data.key?("balance") ? data["balance"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET)
    ),
    data
  )
end