Class: Pago::V2026_04::Models::OrderSubscription

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

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  metadata: "metadata",
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  amount: "amount",
  currency: "currency",
  recurring_interval: "recurring_interval",
  recurring_interval_count: "recurring_interval_count",
  status: "status",
  current_period_start: "current_period_start",
  current_period_end: "current_period_end",
  current_meter_period_start: "current_meter_period_start",
  current_meter_period_end: "current_meter_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",
  ended_at: "ended_at",
  past_due_at: "past_due_at",
  pause_at_period_end: "pause_at_period_end",
  paused_at: "paused_at",
  resumes_at: "resumes_at",
  customer_id: "customer_id",
  product_id: "product_id",
  discount_id: "discount_id",
  checkout_id: "checkout_id",
  seats: "seats",
  customer_cancellation_reason: "customer_cancellation_reason",
  customer_cancellation_comment: "customer_cancellation_comment"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["metadata", "created_at", "modified_at", "id", "amount", "currency", "recurring_interval", "recurring_interval_count", "status", "current_period_start", "current_period_end", "current_meter_period_start", "current_meter_period_end", "trial_start", "trial_end", "cancel_at_period_end", "canceled_at", "started_at", "ends_at", "ended_at", "pause_at_period_end", "paused_at", "resumes_at", "customer_id", "product_id", "discount_id", "checkout_id", "customer_cancellation_reason", "customer_cancellation_comment"].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(metadata:, created_at:, modified_at:, id:, amount:, currency:, recurring_interval:, recurring_interval_count:, status:, current_period_start:, current_period_end:, current_meter_period_start:, current_meter_period_end:, trial_start:, trial_end:, cancel_at_period_end:, canceled_at:, started_at:, ends_at:, ended_at:, past_due_at: ::Pago::UNSET, pause_at_period_end:, paused_at:, resumes_at:, customer_id:, product_id:, discount_id:, checkout_id:, seats: ::Pago::UNSET, customer_cancellation_reason:, customer_cancellation_comment:) ⇒ OrderSubscription

Returns a new instance of OrderSubscription.

Parameters:

  • metadata: (Hash[String, untyped])
  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • amount: (Integer)
  • currency: (String)
  • recurring_interval: (String)
  • recurring_interval_count: (Integer)
  • status: (String)
  • current_period_start: (String)
  • current_period_end: (String)
  • current_meter_period_start: (String, nil)
  • current_meter_period_end: (String, nil)
  • 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)
  • ended_at: (String, nil)
  • past_due_at: (String, nil) (defaults to: ::Pago::UNSET)
  • pause_at_period_end: (Boolean)
  • paused_at: (String, nil)
  • resumes_at: (String, nil)
  • customer_id: (String)
  • product_id: (String)
  • discount_id: (String, nil)
  • checkout_id: (String, nil)
  • seats: (Integer, nil) (defaults to: ::Pago::UNSET)
  • customer_cancellation_reason: (String, nil)
  • customer_cancellation_comment: (String, nil)


33490
33491
33492
33493
33494
33495
33496
33497
33498
33499
33500
33501
33502
33503
33504
33505
33506
33507
33508
33509
33510
33511
33512
33513
33514
33515
33516
33517
33518
33519
33520
33521
33522
33523
33524
33525
33526
33527
33528
33529
33530
33531
33532
33533
33534
33535
33536
33537
33538
33539
33540
33541
33542
33543
33544
33545
33546
33547
33548
33549
33550
33551
33552
33553
33554
33555
# File 'lib/pago/v2026_04/models.rb', line 33490

def initialize(
  metadata:,
  created_at:,
  modified_at:,
  id:,
  amount:,
  currency:,
  recurring_interval:,
  recurring_interval_count:,
  status:,
  current_period_start:,
  current_period_end:,
  current_meter_period_start:,
  current_meter_period_end:,
  trial_start:,
  trial_end:,
  cancel_at_period_end:,
  canceled_at:,
  started_at:,
  ends_at:,
  ended_at:,
  past_due_at: ::Pago::UNSET,
  pause_at_period_end:,
  paused_at:,
  resumes_at:,
  customer_id:,
  product_id:,
  discount_id:,
  checkout_id:,
  seats: ::Pago::UNSET,
  customer_cancellation_reason:,
  customer_cancellation_comment:
)
  super()
  assign(:metadata, )
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:id, id)
  assign(:amount, amount)
  assign(:currency, currency)
  assign(:recurring_interval, recurring_interval)
  assign(:recurring_interval_count, recurring_interval_count)
  assign(:status, status)
  assign(:current_period_start, current_period_start)
  assign(:current_period_end, current_period_end)
  assign(:current_meter_period_start, current_meter_period_start)
  assign(:current_meter_period_end, current_meter_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(:ended_at, ended_at)
  assign(:past_due_at, past_due_at)
  assign(:pause_at_period_end, pause_at_period_end)
  assign(:paused_at, paused_at)
  assign(:resumes_at, resumes_at)
  assign(:customer_id, customer_id)
  assign(:product_id, product_id)
  assign(:discount_id, discount_id)
  assign(:checkout_id, checkout_id)
  assign(:seats, seats)
  assign(:customer_cancellation_reason, customer_cancellation_reason)
  assign(:customer_cancellation_comment, customer_cancellation_comment)
end

Instance Attribute Details

#amountInteger (readonly)

The amount of the subscription.

Returns:

  • (Integer)


33389
33390
33391
# File 'lib/pago/v2026_04/models.rb', line 33389

def amount
  @amount
end

#cancel_at_period_endBoolean (readonly)

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

Returns:

  • (Boolean)


33431
33432
33433
# File 'lib/pago/v2026_04/models.rb', line 33431

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)


33435
33436
33437
# File 'lib/pago/v2026_04/models.rb', line 33435

def canceled_at
  @canceled_at
end

#checkout_idString? (readonly)

Returns:

  • (String, nil)


33478
33479
33480
# File 'lib/pago/v2026_04/models.rb', line 33478

def checkout_id
  @checkout_id
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


33377
33378
33379
# File 'lib/pago/v2026_04/models.rb', line 33377

def created_at
  @created_at
end

#currencyString (readonly)

The currency of the subscription.

Returns:

  • (String)


33393
33394
33395
# File 'lib/pago/v2026_04/models.rb', line 33393

def currency
  @currency
end

#current_meter_period_endString? (readonly)

The end timestamp of the current meter period, if the product has a meter cycle set. This is when credits next renew.

Returns:

  • (String, nil)


33419
33420
33421
# File 'lib/pago/v2026_04/models.rb', line 33419

def current_meter_period_end
  @current_meter_period_end
end

#current_meter_period_startString? (readonly)

The start timestamp of the current meter period, if the product has a meter cycle set. Metered credits are granted and overage is settled on this cadence.

Returns:

  • (String, nil)


33415
33416
33417
# File 'lib/pago/v2026_04/models.rb', line 33415

def current_meter_period_start
  @current_meter_period_start
end

#current_period_endString (readonly)

The end timestamp of the current billing period.

Returns:

  • (String)


33411
33412
33413
# File 'lib/pago/v2026_04/models.rb', line 33411

def current_period_end
  @current_period_end
end

#current_period_startString (readonly)

The start timestamp of the current billing period.

Returns:

  • (String)


33407
33408
33409
# File 'lib/pago/v2026_04/models.rb', line 33407

def current_period_start
  @current_period_start
end

#customer_cancellation_commentString? (readonly)

Returns:

  • (String, nil)


33488
33489
33490
# File 'lib/pago/v2026_04/models.rb', line 33488

def customer_cancellation_comment
  @customer_cancellation_comment
end

#customer_cancellation_reasonString? (readonly)

Returns:

  • (String, nil)


33485
33486
33487
# File 'lib/pago/v2026_04/models.rb', line 33485

def customer_cancellation_reason
  @customer_cancellation_reason
end

#customer_idString (readonly)

The ID of the subscribed customer.

Returns:

  • (String)


33467
33468
33469
# File 'lib/pago/v2026_04/models.rb', line 33467

def customer_id
  @customer_id
end

#discount_idString? (readonly)

The ID of the applied discount, if any.

Returns:

  • (String, nil)


33475
33476
33477
# File 'lib/pago/v2026_04/models.rb', line 33475

def discount_id
  @discount_id
end

#ended_atString? (readonly)

The timestamp when the subscription ended.

Returns:

  • (String, nil)


33447
33448
33449
# File 'lib/pago/v2026_04/models.rb', line 33447

def ended_at
  @ended_at
end

#ends_atString? (readonly)

The timestamp when the subscription will end.

Returns:

  • (String, nil)


33443
33444
33445
# File 'lib/pago/v2026_04/models.rb', line 33443

def ends_at
  @ends_at
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


33385
33386
33387
# File 'lib/pago/v2026_04/models.rb', line 33385

def id
  @id
end

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

Returns:

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


33373
33374
33375
# File 'lib/pago/v2026_04/models.rb', line 33373

def 
  @metadata
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


33381
33382
33383
# File 'lib/pago/v2026_04/models.rb', line 33381

def modified_at
  @modified_at
end

#past_due_atString? (readonly)

The timestamp when the subscription entered past_due status.

Returns:

  • (String, nil)


33451
33452
33453
# File 'lib/pago/v2026_04/models.rb', line 33451

def past_due_at
  @past_due_at
end

#pause_at_period_endBoolean (readonly)

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

Returns:

  • (Boolean)


33455
33456
33457
# File 'lib/pago/v2026_04/models.rb', line 33455

def pause_at_period_end
  @pause_at_period_end
end

#paused_atString? (readonly)

The timestamp when the subscription was paused.

Returns:

  • (String, nil)


33459
33460
33461
# File 'lib/pago/v2026_04/models.rb', line 33459

def paused_at
  @paused_at
end

#product_idString (readonly)

The ID of the subscribed product.

Returns:

  • (String)


33471
33472
33473
# File 'lib/pago/v2026_04/models.rb', line 33471

def product_id
  @product_id
end

#recurring_intervalString (readonly)

Returns:

  • (String)


33396
33397
33398
# File 'lib/pago/v2026_04/models.rb', line 33396

def recurring_interval
  @recurring_interval
end

#recurring_interval_countInteger (readonly)

Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on.

Returns:

  • (Integer)


33400
33401
33402
# File 'lib/pago/v2026_04/models.rb', line 33400

def recurring_interval_count
  @recurring_interval_count
end

#resumes_atString? (readonly)

The timestamp when a paused subscription is scheduled to automatically resume, if set.

Returns:

  • (String, nil)


33463
33464
33465
# File 'lib/pago/v2026_04/models.rb', line 33463

def resumes_at
  @resumes_at
end

#seatsInteger? (readonly)

The number of seats for seat-based subscriptions. None for non-seat subscriptions.

Returns:

  • (Integer, nil)


33482
33483
33484
# File 'lib/pago/v2026_04/models.rb', line 33482

def seats
  @seats
end

#started_atString? (readonly)

The timestamp when the subscription started.

Returns:

  • (String, nil)


33439
33440
33441
# File 'lib/pago/v2026_04/models.rb', line 33439

def started_at
  @started_at
end

#statusString (readonly)

Returns:

  • (String)


33403
33404
33405
# File 'lib/pago/v2026_04/models.rb', line 33403

def status
  @status
end

#trial_endString? (readonly)

The end timestamp of the trial period, if any.

Returns:

  • (String, nil)


33427
33428
33429
# File 'lib/pago/v2026_04/models.rb', line 33427

def trial_end
  @trial_end
end

#trial_startString? (readonly)

The start timestamp of the trial period, if any.

Returns:

  • (String, nil)


33423
33424
33425
# File 'lib/pago/v2026_04/models.rb', line 33423

def trial_start
  @trial_start
end

Class Method Details

.from_json(data) ⇒ OrderSubscription?

Parameters:

  • data (Hash, String, nil)

Returns:



33559
33560
33561
33562
33563
33564
33565
33566
33567
33568
33569
33570
33571
33572
33573
33574
33575
33576
33577
33578
33579
33580
33581
33582
33583
33584
33585
33586
33587
33588
33589
33590
33591
33592
33593
33594
33595
33596
33597
33598
33599
33600
# File 'lib/pago/v2026_04/models.rb', line 33559

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(
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      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),
      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),
      recurring_interval_count: (data.key?("recurring_interval_count") ? data["recurring_interval_count"] : ::Pago::UNSET),
      status: (data.key?("status") ? data["status"] : ::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),
      current_meter_period_start: (data.key?("current_meter_period_start") ? data["current_meter_period_start"] : ::Pago::UNSET),
      current_meter_period_end: (data.key?("current_meter_period_end") ? data["current_meter_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),
      ended_at: (data.key?("ended_at") ? data["ended_at"] : ::Pago::UNSET),
      past_due_at: (data.key?("past_due_at") ? data["past_due_at"] : ::Pago::UNSET),
      pause_at_period_end: (data.key?("pause_at_period_end") ? data["pause_at_period_end"] : ::Pago::UNSET),
      paused_at: (data.key?("paused_at") ? data["paused_at"] : ::Pago::UNSET),
      resumes_at: (data.key?("resumes_at") ? data["resumes_at"] : ::Pago::UNSET),
      customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET),
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      discount_id: (data.key?("discount_id") ? data["discount_id"] : ::Pago::UNSET),
      checkout_id: (data.key?("checkout_id") ? data["checkout_id"] : ::Pago::UNSET),
      seats: (data.key?("seats") ? data["seats"] : ::Pago::UNSET),
      customer_cancellation_reason: (data.key?("customer_cancellation_reason") ? data["customer_cancellation_reason"] : ::Pago::UNSET),
      customer_cancellation_comment: (data.key?("customer_cancellation_comment") ? data["customer_cancellation_comment"] : ::Pago::UNSET)
    ),
    data
  )
end