Class: Pago::V2026_04::Models::ProductCreateOneTime
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Constant Summary collapse
- JSON_KEYS =
{ metadata: "metadata", name: "name", description: "description", visibility: "visibility", prices: "prices", medias: "medias", attached_custom_fields: "attached_custom_fields", organization_id: "organization_id", recurring_interval: "recurring_interval", recurring_interval_count: "recurring_interval_count" }.freeze
- REQUIRED_KEYS =
["name", "prices"].freeze
Instance Attribute Summary collapse
-
#attached_custom_fields ⇒ Array<Models::AttachedCustomFieldCreate>
readonly
List of custom fields to attach.
-
#description ⇒ String?
readonly
The description of the product.
-
#medias ⇒ Array<String>?
readonly
List of file IDs.
-
#metadata ⇒ Hash{String => String, Integer, Float, Boolean}
readonly
Key-value object allowing you to store additional information.
-
#name ⇒ String
readonly
The name of the product.
-
#organization_id ⇒ String?
readonly
The ID of the organization owning the product.
-
#prices ⇒ Array<Models::ProductPriceFixedCreate, Models::ProductPriceCustomCreate, Models::ProductPriceSeatBasedCreate, Models::ProductPriceMeteredUnitCreate>
readonly
List of available prices for this product.
-
#recurring_interval ⇒ nil
readonly
States that the product is a one-time purchase.
-
#recurring_interval_count ⇒ nil
readonly
One-time products don't have a recurring interval count.
- #visibility ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata: ::Pago::UNSET, name:, description: ::Pago::UNSET, visibility: ::Pago::UNSET, prices:, medias: ::Pago::UNSET, attached_custom_fields: ::Pago::UNSET, organization_id: ::Pago::UNSET, recurring_interval: ::Pago::UNSET, recurring_interval_count: ::Pago::UNSET) ⇒ ProductCreateOneTime
constructor
A new instance of ProductCreateOneTime.
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, name:, description: ::Pago::UNSET, visibility: ::Pago::UNSET, prices:, medias: ::Pago::UNSET, attached_custom_fields: ::Pago::UNSET, organization_id: ::Pago::UNSET, recurring_interval: ::Pago::UNSET, recurring_interval_count: ::Pago::UNSET) ⇒ ProductCreateOneTime
Returns a new instance of ProductCreateOneTime.
36275 36276 36277 36278 36279 36280 36281 36282 36283 36284 36285 36286 36287 36288 36289 36290 36291 36292 36293 36294 36295 36296 36297 36298 |
# File 'lib/pago/v2026_04/models.rb', line 36275 def initialize( metadata: ::Pago::UNSET, name:, description: ::Pago::UNSET, visibility: ::Pago::UNSET, prices:, medias: ::Pago::UNSET, attached_custom_fields: ::Pago::UNSET, organization_id: ::Pago::UNSET, recurring_interval: ::Pago::UNSET, recurring_interval_count: ::Pago::UNSET ) super() assign(:metadata, ) assign(:name, name) assign(:description, description) assign(:visibility, visibility) assign(:prices, prices) assign(:medias, medias) assign(:attached_custom_fields, attached_custom_fields) assign(:organization_id, organization_id) assign(:recurring_interval, recurring_interval) assign(:recurring_interval_count, recurring_interval_count) end |
Instance Attribute Details
#attached_custom_fields ⇒ Array<Models::AttachedCustomFieldCreate> (readonly)
List of custom fields to attach.
36261 36262 36263 |
# File 'lib/pago/v2026_04/models.rb', line 36261 def attached_custom_fields @attached_custom_fields end |
#description ⇒ String? (readonly)
The description of the product.
36246 36247 36248 |
# File 'lib/pago/v2026_04/models.rb', line 36246 def description @description end |
#medias ⇒ Array<String>? (readonly)
List of file IDs. Each one must be on the same organization as the product, of type product_media and correctly uploaded.
36257 36258 36259 |
# File 'lib/pago/v2026_04/models.rb', line 36257 def medias @medias 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.
36238 36239 36240 |
# File 'lib/pago/v2026_04/models.rb', line 36238 def @metadata end |
#name ⇒ String (readonly)
The name of the product.
36242 36243 36244 |
# File 'lib/pago/v2026_04/models.rb', line 36242 def name @name end |
#organization_id ⇒ String? (readonly)
The ID of the organization owning the product. Required unless you use an organization token.
36265 36266 36267 |
# File 'lib/pago/v2026_04/models.rb', line 36265 def organization_id @organization_id end |
#prices ⇒ Array<Models::ProductPriceFixedCreate, Models::ProductPriceCustomCreate, Models::ProductPriceSeatBasedCreate, Models::ProductPriceMeteredUnitCreate> (readonly)
List of available prices for this product. It may combine at most one fixed price with one seat-based price (billed as fixed + seat_charge), or contain a single custom or free price, plus any number of metered prices. A free price cannot be combined with other prices, and a custom price cannot be combined with a fixed or seat-based price. Metered prices are not supported on one-time purchase products.
36253 36254 36255 |
# File 'lib/pago/v2026_04/models.rb', line 36253 def prices @prices end |
#recurring_interval ⇒ nil (readonly)
States that the product is a one-time purchase.
36269 36270 36271 |
# File 'lib/pago/v2026_04/models.rb', line 36269 def recurring_interval @recurring_interval end |
#recurring_interval_count ⇒ nil (readonly)
One-time products don't have a recurring interval count.
36273 36274 36275 |
# File 'lib/pago/v2026_04/models.rb', line 36273 def recurring_interval_count @recurring_interval_count end |
#visibility ⇒ String (readonly)
36249 36250 36251 |
# File 'lib/pago/v2026_04/models.rb', line 36249 def visibility @visibility end |
Class Method Details
.from_json(data) ⇒ ProductCreateOneTime?
36302 36303 36304 36305 36306 36307 36308 36309 36310 36311 36312 36313 36314 36315 36316 36317 36318 36319 36320 36321 36322 |
# File 'lib/pago/v2026_04/models.rb', line 36302 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), name: (data.key?("name") ? data["name"] : ::Pago::UNSET), description: (data.key?("description") ? data["description"] : ::Pago::UNSET), visibility: (data.key?("visibility") ? data["visibility"] : ::Pago::UNSET), prices: (data.key?("prices") ? ::Pago::Serde.array(data["prices"]) { |item0| ::Pago::Serde.union(item0, discriminator: "amount_type", mapping: { "custom" => Models::ProductPriceCustomCreate, "fixed" => Models::ProductPriceFixedCreate, "metered_unit" => Models::ProductPriceMeteredUnitCreate, "seat_based" => Models::ProductPriceSeatBasedCreate }, variants: [Models::ProductPriceFixedCreate, Models::ProductPriceCustomCreate, Models::ProductPriceSeatBasedCreate, Models::ProductPriceMeteredUnitCreate]) } : ::Pago::UNSET), medias: (data.key?("medias") ? data["medias"] : ::Pago::UNSET), attached_custom_fields: (data.key?("attached_custom_fields") ? ::Pago::Serde.array(data["attached_custom_fields"]) { |item0| Models::AttachedCustomFieldCreate.from_json(item0) } : ::Pago::UNSET), organization_id: (data.key?("organization_id") ? data["organization_id"] : ::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) ), data ) end |