Class: Pago::V2026_04::Models::SubscriptionCreateCustomer
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Create a subscription for an existing customer.
Constant Summary collapse
- JSON_KEYS =
{ metadata: "metadata", product_id: "product_id", customer_id: "customer_id" }.freeze
- REQUIRED_KEYS =
["product_id", "customer_id"].freeze
Instance Attribute Summary collapse
-
#customer_id ⇒ String
readonly
The ID of the customer to create the subscription for.
-
#metadata ⇒ Hash{String => String, Integer, Float, Boolean}
readonly
Key-value object allowing you to store additional information.
-
#product_id ⇒ String
readonly
The ID of the recurring product to subscribe to.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata: ::Pago::UNSET, product_id:, customer_id:) ⇒ SubscriptionCreateCustomer
constructor
A new instance of SubscriptionCreateCustomer.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(metadata: ::Pago::UNSET, product_id:, customer_id:) ⇒ SubscriptionCreateCustomer
Returns a new instance of SubscriptionCreateCustomer.
40091 40092 40093 40094 40095 40096 40097 40098 40099 40100 |
# File 'lib/pago/v2026_04/models.rb', line 40091 def initialize( metadata: ::Pago::UNSET, product_id:, customer_id: ) super() assign(:metadata, ) assign(:product_id, product_id) assign(:customer_id, customer_id) end |
Instance Attribute Details
#customer_id ⇒ String (readonly)
The ID of the customer to create the subscription for.
40089 40090 40091 |
# File 'lib/pago/v2026_04/models.rb', line 40089 def customer_id @customer_id end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
Key-value object allowing you to store additional information.
The key must be a string with a maximum length of 40 characters. The value must be either:
- A string with a maximum length of 500 characters
- An integer
- A floating-point number
- A boolean
You can store up to 50 key-value pairs.
40081 40082 40083 |
# File 'lib/pago/v2026_04/models.rb', line 40081 def @metadata end |
#product_id ⇒ String (readonly)
The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.
40085 40086 40087 |
# File 'lib/pago/v2026_04/models.rb', line 40085 def product_id @product_id end |
Class Method Details
.from_json(data) ⇒ SubscriptionCreateCustomer?
40104 40105 40106 40107 40108 40109 40110 40111 40112 40113 40114 40115 40116 40117 |
# File 'lib/pago/v2026_04/models.rb', line 40104 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), product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET), customer_id: (data.key?("customer_id") ? data["customer_id"] : ::Pago::UNSET) ), data ) end |