Class: Pago::V2026_04::Models::CustomerStateSubscription

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

Overview

An active customer subscription.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  id: "id",
  created_at: "created_at",
  modified_at: "modified_at",
  custom_field_data: "custom_field_data",
  metadata: "metadata",
  status: "status",
  amount: "amount",
  currency: "currency",
  recurring_interval: "recurring_interval",
  current_period_start: "current_period_start",
  current_period_end: "current_period_end",
  trial_start: "trial_start",
  trial_end: "trial_end",
  cancel_at_period_end: "cancel_at_period_end",
  canceled_at: "canceled_at",
  started_at: "started_at",
  ends_at: "ends_at",
  product_id: "product_id",
  discount_id: "discount_id",
  meters: "meters"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["id", "created_at", "modified_at", "metadata", "status", "amount", "currency", "recurring_interval", "current_period_start", "current_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "product_id", "discount_id", "meters"].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:, custom_field_data: ::Pago::UNSET, metadata:, status:, amount:, currency:, recurring_interval:, current_period_start:, current_period_end:, trial_start:, trial_end:, cancel_at_period_end:, canceled_at:, started_at:, ends_at:, product_id:, discount_id:, meters:) ⇒ CustomerStateSubscription

Returns a new instance of CustomerStateSubscription.

Parameters:

  • id: (String)
  • created_at: (String)
  • modified_at: (String, nil)
  • custom_field_data: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • metadata: (Hash[String, untyped])
  • status: (String)
  • amount: (Integer)
  • currency: (String)
  • recurring_interval: (String)
  • current_period_start: (String)
  • current_period_end: (String)
  • trial_start: (String, nil)
  • trial_end: (String, nil)
  • cancel_at_period_end: (Boolean)
  • canceled_at: (String, nil)
  • started_at: (String, nil)
  • ends_at: (String, nil)
  • product_id: (String)
  • discount_id: (String, nil)
  • meters: (Array[Models::CustomerStateSubscriptionMeter])


20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
# File 'lib/pago/v2026_04/models.rb', line 20377

def initialize(
  id:,
  created_at:,
  modified_at:,
  custom_field_data: ::Pago::UNSET,
  metadata:,
  status:,
  amount:,
  currency:,
  recurring_interval:,
  current_period_start:,
  current_period_end:,
  trial_start:,
  trial_end:,
  cancel_at_period_end:,
  canceled_at:,
  started_at:,
  ends_at:,
  product_id:,
  discount_id:,
  meters:
)
  super()
  assign(:id, id)
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:custom_field_data, custom_field_data)
  assign(:metadata, )
  assign(:status, status)
  assign(:amount, amount)
  assign(:currency, currency)
  assign(:recurring_interval, recurring_interval)
  assign(:current_period_start, current_period_start)
  assign(:current_period_end, current_period_end)
  assign(:trial_start, trial_start)
  assign(:trial_end, trial_end)
  assign(:cancel_at_period_end, cancel_at_period_end)
  assign(:canceled_at, canceled_at)
  assign(:started_at, started_at)
  assign(:ends_at, ends_at)
  assign(:product_id, product_id)
  assign(:discount_id, discount_id)
  assign(:meters, meters)
end

Instance Attribute Details

#amountInteger (readonly)

The amount of the subscription.

Returns:

  • (Integer)


20324
20325
20326
# File 'lib/pago/v2026_04/models.rb', line 20324

def amount
  @amount
end

#cancel_at_period_endBoolean (readonly)

Whether the subscription will be canceled at the end of the current period.

Returns:

  • (Boolean)


20351
20352
20353
# File 'lib/pago/v2026_04/models.rb', line 20351

def cancel_at_period_end
  @cancel_at_period_end
end

#canceled_atString? (readonly)

The timestamp when the subscription was canceled. The subscription might still be active if cancel_at_period_end is true.

Returns:

  • (String, nil)


20355
20356
20357
# File 'lib/pago/v2026_04/models.rb', line 20355

def canceled_at
  @canceled_at
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


20306
20307
20308
# File 'lib/pago/v2026_04/models.rb', line 20306

def created_at
  @created_at
end

#currencyString (readonly)

The currency of the subscription.

Returns:

  • (String)


20328
20329
20330
# File 'lib/pago/v2026_04/models.rb', line 20328

def currency
  @currency
end

#current_period_endString (readonly)

The end timestamp of the current billing period.

Returns:

  • (String)


20339
20340
20341
# File 'lib/pago/v2026_04/models.rb', line 20339

def current_period_end
  @current_period_end
end

#current_period_startString (readonly)

The start timestamp of the current billing period.

Returns:

  • (String)


20335
20336
20337
# File 'lib/pago/v2026_04/models.rb', line 20335

def current_period_start
  @current_period_start
end

#custom_field_dataHash{String => String, Integer, Boolean, nil} (readonly)

Key-value object storing custom field values.

Returns:

  • (Hash{String => String, Integer, Boolean, nil})


20314
20315
20316
# File 'lib/pago/v2026_04/models.rb', line 20314

def custom_field_data
  @custom_field_data
end

#discount_idString? (readonly)

The ID of the applied discount, if any.

Returns:

  • (String, nil)


20371
20372
20373
# File 'lib/pago/v2026_04/models.rb', line 20371

def discount_id
  @discount_id
end

#ends_atString? (readonly)

The timestamp when the subscription will end.

Returns:

  • (String, nil)


20363
20364
20365
# File 'lib/pago/v2026_04/models.rb', line 20363

def ends_at
  @ends_at
end

#idString (readonly)

The ID of the subscription.

Returns:

  • (String)


20302
20303
20304
# File 'lib/pago/v2026_04/models.rb', line 20302

def id
  @id
end

#metadataHash{String => String, Integer, Float, Boolean} (readonly)

Returns:

  • (Hash{String => String, Integer, Float, Boolean})


20317
20318
20319
# File 'lib/pago/v2026_04/models.rb', line 20317

def 
  @metadata
end

#metersArray<Models::CustomerStateSubscriptionMeter> (readonly)

List of meters associated with the subscription.



20375
20376
20377
# File 'lib/pago/v2026_04/models.rb', line 20375

def meters
  @meters
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


20310
20311
20312
# File 'lib/pago/v2026_04/models.rb', line 20310

def modified_at
  @modified_at
end

#product_idString (readonly)

The ID of the subscribed product.

Returns:

  • (String)


20367
20368
20369
# File 'lib/pago/v2026_04/models.rb', line 20367

def product_id
  @product_id
end

#recurring_intervalString (readonly)

Returns:

  • (String)


20331
20332
20333
# File 'lib/pago/v2026_04/models.rb', line 20331

def recurring_interval
  @recurring_interval
end

#started_atString? (readonly)

The timestamp when the subscription started.

Returns:

  • (String, nil)


20359
20360
20361
# File 'lib/pago/v2026_04/models.rb', line 20359

def started_at
  @started_at
end

#statusString (readonly)

Returns:

  • (String)


20320
20321
20322
# File 'lib/pago/v2026_04/models.rb', line 20320

def status
  @status
end

#trial_endString? (readonly)

The end timestamp of the trial period, if any.

Returns:

  • (String, nil)


20347
20348
20349
# File 'lib/pago/v2026_04/models.rb', line 20347

def trial_end
  @trial_end
end

#trial_startString? (readonly)

The start timestamp of the trial period, if any.

Returns:

  • (String, nil)


20343
20344
20345
# File 'lib/pago/v2026_04/models.rb', line 20343

def trial_start
  @trial_start
end

Class Method Details

.from_json(data) ⇒ CustomerStateSubscription?

Parameters:

  • data (Hash, String, nil)

Returns:



20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
# File 'lib/pago/v2026_04/models.rb', line 20424

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),
      custom_field_data: (data.key?("custom_field_data") ? data["custom_field_data"] : ::Pago::UNSET),
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      status: (data.key?("status") ? data["status"] : ::Pago::UNSET),
      amount: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET),
      recurring_interval: (data.key?("recurring_interval") ? data["recurring_interval"] : ::Pago::UNSET),
      current_period_start: (data.key?("current_period_start") ? data["current_period_start"] : ::Pago::UNSET),
      current_period_end: (data.key?("current_period_end") ? data["current_period_end"] : ::Pago::UNSET),
      trial_start: (data.key?("trial_start") ? data["trial_start"] : ::Pago::UNSET),
      trial_end: (data.key?("trial_end") ? data["trial_end"] : ::Pago::UNSET),
      cancel_at_period_end: (data.key?("cancel_at_period_end") ? data["cancel_at_period_end"] : ::Pago::UNSET),
      canceled_at: (data.key?("canceled_at") ? data["canceled_at"] : ::Pago::UNSET),
      started_at: (data.key?("started_at") ? data["started_at"] : ::Pago::UNSET),
      ends_at: (data.key?("ends_at") ? data["ends_at"] : ::Pago::UNSET),
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      discount_id: (data.key?("discount_id") ? data["discount_id"] : ::Pago::UNSET),
      meters: (data.key?("meters") ? ::Pago::Serde.array(data["meters"]) { |item0| Models::CustomerStateSubscriptionMeter.from_json(item0) } : ::Pago::UNSET)
    ),
    data
  )
end