Class: Pago::V2026_04::Models::ProductCreateOneTime

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])
{
  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 =

Returns:

  • (Array[String])
["name", "prices"].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(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.

Parameters:

  • metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • name: (String)
  • description: (String, nil) (defaults to: ::Pago::UNSET)
  • visibility: (String, nil) (defaults to: ::Pago::UNSET)
  • prices: (Array[untyped])
  • medias: (Array[String], nil) (defaults to: ::Pago::UNSET)
  • attached_custom_fields: (Array[Models::AttachedCustomFieldCreate], nil) (defaults to: ::Pago::UNSET)
  • organization_id: (String, nil) (defaults to: ::Pago::UNSET)
  • recurring_interval: (nil) (defaults to: ::Pago::UNSET)
  • recurring_interval_count: (nil) (defaults to: ::Pago::UNSET)


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

#descriptionString? (readonly)

The description of the product.

Returns:

  • (String, nil)


36246
36247
36248
# File 'lib/pago/v2026_04/models.rb', line 36246

def description
  @description
end

#mediasArray<String>? (readonly)

List of file IDs. Each one must be on the same organization as the product, of type product_media and correctly uploaded.

Returns:

  • (Array<String>, nil)


36257
36258
36259
# File 'lib/pago/v2026_04/models.rb', line 36257

def medias
  @medias
end

#metadataHash{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.

Returns:

  • (Hash{String => String, Integer, Float, Boolean})


36238
36239
36240
# File 'lib/pago/v2026_04/models.rb', line 36238

def 
  @metadata
end

#nameString (readonly)

The name of the product.

Returns:

  • (String)


36242
36243
36244
# File 'lib/pago/v2026_04/models.rb', line 36242

def name
  @name
end

#organization_idString? (readonly)

The ID of the organization owning the product. Required unless you use an organization token.

Returns:

  • (String, nil)


36265
36266
36267
# File 'lib/pago/v2026_04/models.rb', line 36265

def organization_id
  @organization_id
end

#pricesArray<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_intervalnil (readonly)

States that the product is a one-time purchase.

Returns:

  • (nil)


36269
36270
36271
# File 'lib/pago/v2026_04/models.rb', line 36269

def recurring_interval
  @recurring_interval
end

#recurring_interval_countnil (readonly)

One-time products don't have a recurring interval count.

Returns:

  • (nil)


36273
36274
36275
# File 'lib/pago/v2026_04/models.rb', line 36273

def recurring_interval_count
  @recurring_interval_count
end

#visibilityString (readonly)

Returns:

  • (String)


36249
36250
36251
# File 'lib/pago/v2026_04/models.rb', line 36249

def visibility
  @visibility
end

Class Method Details

.from_json(data) ⇒ ProductCreateOneTime?

Parameters:

  • data (Hash, String, nil)

Returns:



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