Class: Pago::V2026_04::Models::ProductUpdate

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Overview

Schema to update a product.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  metadata: "metadata",
  trial_interval: "trial_interval",
  trial_interval_count: "trial_interval_count",
  name: "name",
  description: "description",
  recurring_interval: "recurring_interval",
  recurring_interval_count: "recurring_interval_count",
  is_archived: "is_archived",
  visibility: "visibility",
  prices: "prices",
  medias: "medias",
  attached_custom_fields: "attached_custom_fields"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
[].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, trial_interval: ::Pago::UNSET, trial_interval_count: ::Pago::UNSET, name: ::Pago::UNSET, description: ::Pago::UNSET, recurring_interval: ::Pago::UNSET, recurring_interval_count: ::Pago::UNSET, is_archived: ::Pago::UNSET, visibility: ::Pago::UNSET, prices: ::Pago::UNSET, medias: ::Pago::UNSET, attached_custom_fields: ::Pago::UNSET) ⇒ ProductUpdate

Returns a new instance of ProductUpdate.

Parameters:

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


38102
38103
38104
38105
38106
38107
38108
38109
38110
38111
38112
38113
38114
38115
38116
38117
38118
38119
38120
38121
38122
38123
38124
38125
38126
38127
38128
38129
# File 'lib/pago/v2026_04/models.rb', line 38102

def initialize(
  metadata: ::Pago::UNSET,
  trial_interval: ::Pago::UNSET,
  trial_interval_count: ::Pago::UNSET,
  name: ::Pago::UNSET,
  description: ::Pago::UNSET,
  recurring_interval: ::Pago::UNSET,
  recurring_interval_count: ::Pago::UNSET,
  is_archived: ::Pago::UNSET,
  visibility: ::Pago::UNSET,
  prices: ::Pago::UNSET,
  medias: ::Pago::UNSET,
  attached_custom_fields: ::Pago::UNSET
)
  super()
  assign(:metadata, )
  assign(:trial_interval, trial_interval)
  assign(:trial_interval_count, trial_interval_count)
  assign(:name, name)
  assign(:description, description)
  assign(:recurring_interval, recurring_interval)
  assign(:recurring_interval_count, recurring_interval_count)
  assign(:is_archived, is_archived)
  assign(:visibility, visibility)
  assign(:prices, prices)
  assign(:medias, medias)
  assign(:attached_custom_fields, attached_custom_fields)
end

Instance Attribute Details

#attached_custom_fieldsArray<Models::AttachedCustomFieldCreate>? (readonly)

Returns:



38100
38101
38102
# File 'lib/pago/v2026_04/models.rb', line 38100

def attached_custom_fields
  @attached_custom_fields
end

#descriptionString? (readonly)

The description of the product.

Returns:

  • (String, nil)


38073
38074
38075
# File 'lib/pago/v2026_04/models.rb', line 38073

def description
  @description
end

#is_archivedBoolean? (readonly)

Whether the product is archived. If true, the product won't be available for purchase anymore. Existing customers will still have access to their benefits, and subscriptions will continue normally.

Returns:

  • (Boolean, nil)


38085
38086
38087
# File 'lib/pago/v2026_04/models.rb', line 38085

def is_archived
  @is_archived
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)


38097
38098
38099
# File 'lib/pago/v2026_04/models.rb', line 38097

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})


38058
38059
38060
# File 'lib/pago/v2026_04/models.rb', line 38058

def 
  @metadata
end

#nameString? (readonly)

Returns:

  • (String, nil)


38069
38070
38071
# File 'lib/pago/v2026_04/models.rb', line 38069

def name
  @name
end

#pricesArray<Models::ExistingProductPrice, Models::ProductPriceFixedCreate, Models::ProductPriceCustomCreate, Models::ProductPriceSeatBasedCreate, Models::ProductPriceMeteredUnitCreate>? (readonly)

List of available prices for this product. If you want to keep existing prices, include them in the list as an ExistingProductPrice object.



38093
38094
38095
# File 'lib/pago/v2026_04/models.rb', line 38093

def prices
  @prices
end

#recurring_intervalString? (readonly)

The recurring interval of the product. If None, the product is a one-time purchase. Can only be set on legacy recurring products. Once set, it can't be changed.

Returns:

  • (String, nil)


38077
38078
38079
# File 'lib/pago/v2026_04/models.rb', line 38077

def recurring_interval
  @recurring_interval
end

#recurring_interval_countInteger? (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. Once set, it can't be changed.**

Returns:

  • (Integer, nil)


38081
38082
38083
# File 'lib/pago/v2026_04/models.rb', line 38081

def recurring_interval_count
  @recurring_interval_count
end

#trial_intervalString? (readonly)

The interval unit for the trial period.

Returns:

  • (String, nil)


38062
38063
38064
# File 'lib/pago/v2026_04/models.rb', line 38062

def trial_interval
  @trial_interval
end

#trial_interval_countInteger? (readonly)

The number of interval units for the trial period.

Returns:

  • (Integer, nil)


38066
38067
38068
# File 'lib/pago/v2026_04/models.rb', line 38066

def trial_interval_count
  @trial_interval_count
end

#visibilityString? (readonly)

The visibility of the product.

Returns:

  • (String, nil)


38089
38090
38091
# File 'lib/pago/v2026_04/models.rb', line 38089

def visibility
  @visibility
end

Class Method Details

.from_json(data) ⇒ ProductUpdate?

Parameters:

  • data (Hash, String, nil)

Returns:



38133
38134
38135
38136
38137
38138
38139
38140
38141
38142
38143
38144
38145
38146
38147
38148
38149
38150
38151
38152
38153
38154
38155
# File 'lib/pago/v2026_04/models.rb', line 38133

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),
      trial_interval: (data.key?("trial_interval") ? data["trial_interval"] : ::Pago::UNSET),
      trial_interval_count: (data.key?("trial_interval_count") ? data["trial_interval_count"] : ::Pago::UNSET),
      name: (data.key?("name") ? data["name"] : ::Pago::UNSET),
      description: (data.key?("description") ? data["description"] : ::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),
      is_archived: (data.key?("is_archived") ? data["is_archived"] : ::Pago::UNSET),
      visibility: (data.key?("visibility") ? data["visibility"] : ::Pago::UNSET),
      prices: (data.key?("prices") ? ::Pago::Serde.array(data["prices"]) { |item0| ::Pago::Serde.union(item0, variants: [Models::ExistingProductPrice]) } : ::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)
    ),
    data
  )
end