Class: Pago::V2026_04::Models::CustomerStateSubscription
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
An active customer subscription.
Constant Summary collapse
- JSON_KEYS =
{ 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 =
["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
-
#amount ⇒ Integer
readonly
The amount of the subscription.
-
#cancel_at_period_end ⇒ Boolean
readonly
Whether the subscription will be canceled at the end of the current period.
-
#canceled_at ⇒ String?
readonly
The timestamp when the subscription was canceled.
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
-
#currency ⇒ String
readonly
The currency of the subscription.
-
#current_period_end ⇒ String
readonly
The end timestamp of the current billing period.
-
#current_period_start ⇒ String
readonly
The start timestamp of the current billing period.
-
#custom_field_data ⇒ Hash{String => String, Integer, Boolean, nil}
readonly
Key-value object storing custom field values.
-
#discount_id ⇒ String?
readonly
The ID of the applied discount, if any.
-
#ends_at ⇒ String?
readonly
The timestamp when the subscription will end.
-
#id ⇒ String
readonly
The ID of the subscription.
- #metadata ⇒ Hash{String => String, Integer, Float, Boolean} readonly
-
#meters ⇒ Array<Models::CustomerStateSubscriptionMeter>
readonly
List of meters associated with the subscription.
-
#modified_at ⇒ String?
readonly
Last modification timestamp of the object.
-
#product_id ⇒ String
readonly
The ID of the subscribed product.
- #recurring_interval ⇒ String readonly
-
#started_at ⇒ String?
readonly
The timestamp when the subscription started.
- #status ⇒ String readonly
-
#trial_end ⇒ String?
readonly
The end timestamp of the trial period, if any.
-
#trial_start ⇒ String?
readonly
The start timestamp of the trial period, if any.
Class Method Summary collapse
Instance Method Summary collapse
-
#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
constructor
A new instance of CustomerStateSubscription.
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.
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
#amount ⇒ Integer (readonly)
The amount of the subscription.
20324 20325 20326 |
# File 'lib/pago/v2026_04/models.rb', line 20324 def amount @amount end |
#cancel_at_period_end ⇒ Boolean (readonly)
Whether the subscription will be canceled at the end of the current period.
20351 20352 20353 |
# File 'lib/pago/v2026_04/models.rb', line 20351 def cancel_at_period_end @cancel_at_period_end end |
#canceled_at ⇒ String? (readonly)
The timestamp when the subscription was canceled. The subscription might still be active if cancel_at_period_end is true.
20355 20356 20357 |
# File 'lib/pago/v2026_04/models.rb', line 20355 def canceled_at @canceled_at end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
20306 20307 20308 |
# File 'lib/pago/v2026_04/models.rb', line 20306 def created_at @created_at end |
#currency ⇒ String (readonly)
The currency of the subscription.
20328 20329 20330 |
# File 'lib/pago/v2026_04/models.rb', line 20328 def currency @currency end |
#current_period_end ⇒ String (readonly)
The end timestamp of the current billing period.
20339 20340 20341 |
# File 'lib/pago/v2026_04/models.rb', line 20339 def current_period_end @current_period_end end |
#current_period_start ⇒ String (readonly)
The start timestamp of the current billing period.
20335 20336 20337 |
# File 'lib/pago/v2026_04/models.rb', line 20335 def current_period_start @current_period_start end |
#custom_field_data ⇒ Hash{String => String, Integer, Boolean, nil} (readonly)
Key-value object storing custom field values.
20314 20315 20316 |
# File 'lib/pago/v2026_04/models.rb', line 20314 def custom_field_data @custom_field_data end |
#discount_id ⇒ String? (readonly)
The ID of the applied discount, if any.
20371 20372 20373 |
# File 'lib/pago/v2026_04/models.rb', line 20371 def discount_id @discount_id end |
#ends_at ⇒ String? (readonly)
The timestamp when the subscription will end.
20363 20364 20365 |
# File 'lib/pago/v2026_04/models.rb', line 20363 def ends_at @ends_at end |
#id ⇒ String (readonly)
The ID of the subscription.
20302 20303 20304 |
# File 'lib/pago/v2026_04/models.rb', line 20302 def id @id end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
20317 20318 20319 |
# File 'lib/pago/v2026_04/models.rb', line 20317 def @metadata end |
#meters ⇒ Array<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_at ⇒ String? (readonly)
Last modification timestamp of the object.
20310 20311 20312 |
# File 'lib/pago/v2026_04/models.rb', line 20310 def modified_at @modified_at end |
#product_id ⇒ String (readonly)
The ID of the subscribed product.
20367 20368 20369 |
# File 'lib/pago/v2026_04/models.rb', line 20367 def product_id @product_id end |
#recurring_interval ⇒ String (readonly)
20331 20332 20333 |
# File 'lib/pago/v2026_04/models.rb', line 20331 def recurring_interval @recurring_interval end |
#started_at ⇒ String? (readonly)
The timestamp when the subscription started.
20359 20360 20361 |
# File 'lib/pago/v2026_04/models.rb', line 20359 def started_at @started_at end |
#status ⇒ String (readonly)
20320 20321 20322 |
# File 'lib/pago/v2026_04/models.rb', line 20320 def status @status end |
#trial_end ⇒ String? (readonly)
The end timestamp of the trial period, if any.
20347 20348 20349 |
# File 'lib/pago/v2026_04/models.rb', line 20347 def trial_end @trial_end end |
#trial_start ⇒ String? (readonly)
The start timestamp of the trial period, if any.
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?
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 |