Class: Pago::V2026_04::Models::CustomerOrderSubscription

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])
{
  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])
["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(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:) ⇒ CustomerOrderSubscription

Returns a new instance of CustomerOrderSubscription.

Parameters:

  • 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)


18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
# File 'lib/pago/v2026_04/models.rb', line 18106

def initialize(
  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(: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)


18005
18006
18007
# File 'lib/pago/v2026_04/models.rb', line 18005

def amount
  @amount
end

#cancel_at_period_endBoolean (readonly)

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

Returns:

  • (Boolean)


18047
18048
18049
# File 'lib/pago/v2026_04/models.rb', line 18047

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)


18051
18052
18053
# File 'lib/pago/v2026_04/models.rb', line 18051

def canceled_at
  @canceled_at
end

#checkout_idString? (readonly)

Returns:

  • (String, nil)


18094
18095
18096
# File 'lib/pago/v2026_04/models.rb', line 18094

def checkout_id
  @checkout_id
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


17993
17994
17995
# File 'lib/pago/v2026_04/models.rb', line 17993

def created_at
  @created_at
end

#currencyString (readonly)

The currency of the subscription.

Returns:

  • (String)


18009
18010
18011
# File 'lib/pago/v2026_04/models.rb', line 18009

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)


18035
18036
18037
# File 'lib/pago/v2026_04/models.rb', line 18035

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)


18031
18032
18033
# File 'lib/pago/v2026_04/models.rb', line 18031

def current_meter_period_start
  @current_meter_period_start
end

#current_period_endString (readonly)

The end timestamp of the current billing period.

Returns:

  • (String)


18027
18028
18029
# File 'lib/pago/v2026_04/models.rb', line 18027

def current_period_end
  @current_period_end
end

#current_period_startString (readonly)

The start timestamp of the current billing period.

Returns:

  • (String)


18023
18024
18025
# File 'lib/pago/v2026_04/models.rb', line 18023

def current_period_start
  @current_period_start
end

#customer_cancellation_commentString? (readonly)

Returns:

  • (String, nil)


18104
18105
18106
# File 'lib/pago/v2026_04/models.rb', line 18104

def customer_cancellation_comment
  @customer_cancellation_comment
end

#customer_cancellation_reasonString? (readonly)

Returns:

  • (String, nil)


18101
18102
18103
# File 'lib/pago/v2026_04/models.rb', line 18101

def customer_cancellation_reason
  @customer_cancellation_reason
end

#customer_idString (readonly)

The ID of the subscribed customer.

Returns:

  • (String)


18083
18084
18085
# File 'lib/pago/v2026_04/models.rb', line 18083

def customer_id
  @customer_id
end

#discount_idString? (readonly)

The ID of the applied discount, if any.

Returns:

  • (String, nil)


18091
18092
18093
# File 'lib/pago/v2026_04/models.rb', line 18091

def discount_id
  @discount_id
end

#ended_atString? (readonly)

The timestamp when the subscription ended.

Returns:

  • (String, nil)


18063
18064
18065
# File 'lib/pago/v2026_04/models.rb', line 18063

def ended_at
  @ended_at
end

#ends_atString? (readonly)

The timestamp when the subscription will end.

Returns:

  • (String, nil)


18059
18060
18061
# File 'lib/pago/v2026_04/models.rb', line 18059

def ends_at
  @ends_at
end

#idString (readonly)

The ID of the object.

Returns:

  • (String)


18001
18002
18003
# File 'lib/pago/v2026_04/models.rb', line 18001

def id
  @id
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


17997
17998
17999
# File 'lib/pago/v2026_04/models.rb', line 17997

def modified_at
  @modified_at
end

#past_due_atString? (readonly)

The timestamp when the subscription entered past_due status.

Returns:

  • (String, nil)


18067
18068
18069
# File 'lib/pago/v2026_04/models.rb', line 18067

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)


18071
18072
18073
# File 'lib/pago/v2026_04/models.rb', line 18071

def pause_at_period_end
  @pause_at_period_end
end

#paused_atString? (readonly)

The timestamp when the subscription was paused.

Returns:

  • (String, nil)


18075
18076
18077
# File 'lib/pago/v2026_04/models.rb', line 18075

def paused_at
  @paused_at
end

#product_idString (readonly)

The ID of the subscribed product.

Returns:

  • (String)


18087
18088
18089
# File 'lib/pago/v2026_04/models.rb', line 18087

def product_id
  @product_id
end

#recurring_intervalString (readonly)

Returns:

  • (String)


18012
18013
18014
# File 'lib/pago/v2026_04/models.rb', line 18012

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)


18016
18017
18018
# File 'lib/pago/v2026_04/models.rb', line 18016

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)


18079
18080
18081
# File 'lib/pago/v2026_04/models.rb', line 18079

def resumes_at
  @resumes_at
end

#seatsInteger? (readonly)

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

Returns:

  • (Integer, nil)


18098
18099
18100
# File 'lib/pago/v2026_04/models.rb', line 18098

def seats
  @seats
end

#started_atString? (readonly)

The timestamp when the subscription started.

Returns:

  • (String, nil)


18055
18056
18057
# File 'lib/pago/v2026_04/models.rb', line 18055

def started_at
  @started_at
end

#statusString (readonly)

Returns:

  • (String)


18019
18020
18021
# File 'lib/pago/v2026_04/models.rb', line 18019

def status
  @status
end

#trial_endString? (readonly)

The end timestamp of the trial period, if any.

Returns:

  • (String, nil)


18043
18044
18045
# File 'lib/pago/v2026_04/models.rb', line 18043

def trial_end
  @trial_end
end

#trial_startString? (readonly)

The start timestamp of the trial period, if any.

Returns:

  • (String, nil)


18039
18040
18041
# File 'lib/pago/v2026_04/models.rb', line 18039

def trial_start
  @trial_start
end

Class Method Details

.from_json(data) ⇒ CustomerOrderSubscription?

Parameters:

  • data (Hash, String, nil)

Returns:



18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
# File 'lib/pago/v2026_04/models.rb', line 18173

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(
      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