Class: Pago::V2026_04::Models::CustomerSubscription
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Constant Summary collapse
- JSON_KEYS =
{ 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", product: "product", prices: "prices", meters: "meters", pending_update: "pending_update" }.freeze
- REQUIRED_KEYS =
["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", "product", "prices", "meters", "pending_update"].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.
- #checkout_id ⇒ String? readonly
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
-
#currency ⇒ String
readonly
The currency of the subscription.
-
#current_meter_period_end ⇒ String?
readonly
The end timestamp of the current meter period, if the product has a meter cycle set.
-
#current_meter_period_start ⇒ String?
readonly
The start timestamp of the current meter period, if the product has a meter cycle set.
-
#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.
- #customer_cancellation_comment ⇒ String? readonly
- #customer_cancellation_reason ⇒ String? readonly
-
#customer_id ⇒ String
readonly
The ID of the subscribed customer.
-
#discount_id ⇒ String?
readonly
The ID of the applied discount, if any.
-
#ended_at ⇒ String?
readonly
The timestamp when the subscription ended.
-
#ends_at ⇒ String?
readonly
The timestamp when the subscription will end.
-
#id ⇒ String
readonly
The ID of the object.
-
#meters ⇒ Array<Models::CustomerSubscriptionMeter>
readonly
List of meters associated with the subscription.
-
#modified_at ⇒ String?
readonly
Last modification timestamp of the object.
-
#past_due_at ⇒ String?
readonly
The timestamp when the subscription entered
past_duestatus. -
#pause_at_period_end ⇒ Boolean
readonly
Whether the subscription will be paused at the end of the current period.
-
#paused_at ⇒ String?
readonly
The timestamp when the subscription was paused.
-
#pending_update ⇒ Models::PendingSubscriptionUpdate?
readonly
Pending subscription update that will be applied at the beginning of the next period.
-
#prices ⇒ Array<Object>
readonly
List of enabled prices for the subscription.
- #product ⇒ Models::CustomerSubscriptionProduct readonly
-
#product_id ⇒ String
readonly
The ID of the subscribed product.
- #recurring_interval ⇒ String readonly
-
#recurring_interval_count ⇒ Integer
readonly
Number of interval units of the subscription.
-
#resumes_at ⇒ String?
readonly
The timestamp when a paused subscription is scheduled to automatically resume, if set.
-
#seats ⇒ Integer?
readonly
The number of seats for seat-based subscriptions.
-
#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
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:, product:, prices:, meters:, pending_update:) ⇒ CustomerSubscription
Returns a new instance of CustomerSubscription.
20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 20926 20927 20928 20929 20930 20931 20932 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 20948 20949 20950 20951 20952 20953 20954 20955 20956 20957 20958 20959 20960 20961 20962 20963 20964 |
# File 'lib/pago/v2026_04/models.rb', line 20893 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:, product:, prices:, meters:, pending_update: ) 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) assign(:product, product) assign(:prices, prices) assign(:meters, meters) assign(:pending_update, pending_update) end |
Instance Attribute Details
#amount ⇒ Integer (readonly)
The amount of the subscription.
20777 20778 20779 |
# File 'lib/pago/v2026_04/models.rb', line 20777 def amount @amount end |
#cancel_at_period_end ⇒ Boolean (readonly)
Whether the subscription will be canceled at the end of the current period.
20819 20820 20821 |
# File 'lib/pago/v2026_04/models.rb', line 20819 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.
20823 20824 20825 |
# File 'lib/pago/v2026_04/models.rb', line 20823 def canceled_at @canceled_at end |
#checkout_id ⇒ String? (readonly)
20866 20867 20868 |
# File 'lib/pago/v2026_04/models.rb', line 20866 def checkout_id @checkout_id end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
20765 20766 20767 |
# File 'lib/pago/v2026_04/models.rb', line 20765 def created_at @created_at end |
#currency ⇒ String (readonly)
The currency of the subscription.
20781 20782 20783 |
# File 'lib/pago/v2026_04/models.rb', line 20781 def currency @currency end |
#current_meter_period_end ⇒ String? (readonly)
The end timestamp of the current meter period, if the product has a meter cycle set. This is when credits next renew.
20807 20808 20809 |
# File 'lib/pago/v2026_04/models.rb', line 20807 def current_meter_period_end @current_meter_period_end end |
#current_meter_period_start ⇒ String? (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.
20803 20804 20805 |
# File 'lib/pago/v2026_04/models.rb', line 20803 def current_meter_period_start @current_meter_period_start end |
#current_period_end ⇒ String (readonly)
The end timestamp of the current billing period.
20799 20800 20801 |
# File 'lib/pago/v2026_04/models.rb', line 20799 def current_period_end @current_period_end end |
#current_period_start ⇒ String (readonly)
The start timestamp of the current billing period.
20795 20796 20797 |
# File 'lib/pago/v2026_04/models.rb', line 20795 def current_period_start @current_period_start end |
#customer_cancellation_comment ⇒ String? (readonly)
20876 20877 20878 |
# File 'lib/pago/v2026_04/models.rb', line 20876 def customer_cancellation_comment @customer_cancellation_comment end |
#customer_cancellation_reason ⇒ String? (readonly)
20873 20874 20875 |
# File 'lib/pago/v2026_04/models.rb', line 20873 def customer_cancellation_reason @customer_cancellation_reason end |
#customer_id ⇒ String (readonly)
The ID of the subscribed customer.
20855 20856 20857 |
# File 'lib/pago/v2026_04/models.rb', line 20855 def customer_id @customer_id end |
#discount_id ⇒ String? (readonly)
The ID of the applied discount, if any.
20863 20864 20865 |
# File 'lib/pago/v2026_04/models.rb', line 20863 def discount_id @discount_id end |
#ended_at ⇒ String? (readonly)
The timestamp when the subscription ended.
20835 20836 20837 |
# File 'lib/pago/v2026_04/models.rb', line 20835 def ended_at @ended_at end |
#ends_at ⇒ String? (readonly)
The timestamp when the subscription will end.
20831 20832 20833 |
# File 'lib/pago/v2026_04/models.rb', line 20831 def ends_at @ends_at end |
#id ⇒ String (readonly)
The ID of the object.
20773 20774 20775 |
# File 'lib/pago/v2026_04/models.rb', line 20773 def id @id end |
#meters ⇒ Array<Models::CustomerSubscriptionMeter> (readonly)
List of meters associated with the subscription.
20887 20888 20889 |
# File 'lib/pago/v2026_04/models.rb', line 20887 def meters @meters end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
20769 20770 20771 |
# File 'lib/pago/v2026_04/models.rb', line 20769 def modified_at @modified_at end |
#past_due_at ⇒ String? (readonly)
The timestamp when the subscription entered past_due status.
20839 20840 20841 |
# File 'lib/pago/v2026_04/models.rb', line 20839 def past_due_at @past_due_at end |
#pause_at_period_end ⇒ Boolean (readonly)
Whether the subscription will be paused at the end of the current period.
20843 20844 20845 |
# File 'lib/pago/v2026_04/models.rb', line 20843 def pause_at_period_end @pause_at_period_end end |
#paused_at ⇒ String? (readonly)
The timestamp when the subscription was paused.
20847 20848 20849 |
# File 'lib/pago/v2026_04/models.rb', line 20847 def paused_at @paused_at end |
#pending_update ⇒ Models::PendingSubscriptionUpdate? (readonly)
Pending subscription update that will be applied at the beginning of the next period. If null, there is no pending update.
20891 20892 20893 |
# File 'lib/pago/v2026_04/models.rb', line 20891 def pending_update @pending_update end |
#prices ⇒ Array<Object> (readonly)
List of enabled prices for the subscription.
20883 20884 20885 |
# File 'lib/pago/v2026_04/models.rb', line 20883 def prices @prices end |
#product ⇒ Models::CustomerSubscriptionProduct (readonly)
20879 20880 20881 |
# File 'lib/pago/v2026_04/models.rb', line 20879 def product @product end |
#product_id ⇒ String (readonly)
The ID of the subscribed product.
20859 20860 20861 |
# File 'lib/pago/v2026_04/models.rb', line 20859 def product_id @product_id end |
#recurring_interval ⇒ String (readonly)
20784 20785 20786 |
# File 'lib/pago/v2026_04/models.rb', line 20784 def recurring_interval @recurring_interval end |
#recurring_interval_count ⇒ Integer (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.
20788 20789 20790 |
# File 'lib/pago/v2026_04/models.rb', line 20788 def recurring_interval_count @recurring_interval_count end |
#resumes_at ⇒ String? (readonly)
The timestamp when a paused subscription is scheduled to automatically resume, if set.
20851 20852 20853 |
# File 'lib/pago/v2026_04/models.rb', line 20851 def resumes_at @resumes_at end |
#seats ⇒ Integer? (readonly)
The number of seats for seat-based subscriptions. None for non-seat subscriptions.
20870 20871 20872 |
# File 'lib/pago/v2026_04/models.rb', line 20870 def seats @seats end |
#started_at ⇒ String? (readonly)
The timestamp when the subscription started.
20827 20828 20829 |
# File 'lib/pago/v2026_04/models.rb', line 20827 def started_at @started_at end |
#status ⇒ String (readonly)
20791 20792 20793 |
# File 'lib/pago/v2026_04/models.rb', line 20791 def status @status end |
#trial_end ⇒ String? (readonly)
The end timestamp of the trial period, if any.
20815 20816 20817 |
# File 'lib/pago/v2026_04/models.rb', line 20815 def trial_end @trial_end end |
#trial_start ⇒ String? (readonly)
The start timestamp of the trial period, if any.
20811 20812 20813 |
# File 'lib/pago/v2026_04/models.rb', line 20811 def trial_start @trial_start end |
Class Method Details
.from_json(data) ⇒ CustomerSubscription?
20968 20969 20970 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 |
# File 'lib/pago/v2026_04/models.rb', line 20968 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), product: (data.key?("product") ? Models::CustomerSubscriptionProduct.from_json(data["product"]) : ::Pago::UNSET), prices: (data.key?("prices") ? ::Pago::Serde.array(data["prices"]) { |item0| ::Pago::Serde.union(item0, variants: [Unions::LegacyRecurringProductPrice, Unions::ProductPrice]) } : ::Pago::UNSET), meters: (data.key?("meters") ? ::Pago::Serde.array(data["meters"]) { |item0| Models::CustomerSubscriptionMeter.from_json(item0) } : ::Pago::UNSET), pending_update: (data.key?("pending_update") ? Models::PendingSubscriptionUpdate.from_json(data["pending_update"]) : ::Pago::UNSET) ), data ) end |