Class: Pago::V2026_04::Models::Product
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
A product.
Constant Summary collapse
- JSON_KEYS =
{ id: "id", created_at: "created_at", modified_at: "modified_at", trial_interval: "trial_interval", trial_interval_count: "trial_interval_count", name: "name", description: "description", visibility: "visibility", recurring_interval: "recurring_interval", recurring_interval_count: "recurring_interval_count", meter_interval: "meter_interval", meter_interval_count: "meter_interval_count", is_recurring: "is_recurring", is_archived: "is_archived", organization_id: "organization_id", metadata: "metadata", prices: "prices", benefits: "benefits", medias: "medias", attached_custom_fields: "attached_custom_fields" }.freeze
- REQUIRED_KEYS =
["id", "created_at", "modified_at", "trial_interval", "trial_interval_count", "name", "description", "visibility", "recurring_interval", "recurring_interval_count", "meter_interval", "meter_interval_count", "is_recurring", "is_archived", "organization_id", "metadata", "prices", "benefits", "medias", "attached_custom_fields"].freeze
Instance Attribute Summary collapse
-
#attached_custom_fields ⇒ Array<Models::AttachedCustomField>
readonly
List of custom fields attached to the product.
-
#benefits ⇒ Array<Object>
readonly
List of benefits granted by the product.
-
#created_at ⇒ String
readonly
Creation timestamp of the object.
-
#description ⇒ String?
readonly
The description of the product.
-
#id ⇒ String
readonly
The ID of the object.
-
#is_archived ⇒ Boolean
readonly
Whether the product is archived and no longer available.
-
#is_recurring ⇒ Boolean
readonly
Whether the product is a subscription.
-
#medias ⇒ Array<Models::ProductMediaFileRead>
readonly
List of medias associated to the product.
- #metadata ⇒ Hash{String => String, Integer, Float, Boolean} readonly
-
#meter_interval ⇒ String?
readonly
The meter cycle of the product, independent of the billing interval.
-
#meter_interval_count ⇒ Integer?
readonly
Number of meter interval units.
-
#modified_at ⇒ String?
readonly
Last modification timestamp of the object.
-
#name ⇒ String
readonly
The name of the product.
-
#organization_id ⇒ String
readonly
The ID of the organization owning the product.
-
#prices ⇒ Array<Object>
readonly
List of prices for this product.
-
#recurring_interval ⇒ String?
readonly
The recurring interval of the product.
-
#recurring_interval_count ⇒ Integer?
readonly
Number of interval units of the subscription.
-
#trial_interval ⇒ String?
readonly
The interval unit for the trial period.
-
#trial_interval_count ⇒ Integer?
readonly
The number of interval units for the trial period.
- #visibility ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, created_at:, modified_at:, trial_interval:, trial_interval_count:, name:, description:, visibility:, recurring_interval:, recurring_interval_count:, meter_interval:, meter_interval_count:, is_recurring:, is_archived:, organization_id:, metadata:, prices:, benefits:, medias:, attached_custom_fields:) ⇒ Product
constructor
A new instance of Product.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(id:, created_at:, modified_at:, trial_interval:, trial_interval_count:, name:, description:, visibility:, recurring_interval:, recurring_interval_count:, meter_interval:, meter_interval_count:, is_recurring:, is_archived:, organization_id:, metadata:, prices:, benefits:, medias:, attached_custom_fields:) ⇒ Product
Returns a new instance of Product.
36097 36098 36099 36100 36101 36102 36103 36104 36105 36106 36107 36108 36109 36110 36111 36112 36113 36114 36115 36116 36117 36118 36119 36120 36121 36122 36123 36124 36125 36126 36127 36128 36129 36130 36131 36132 36133 36134 36135 36136 36137 36138 36139 36140 |
# File 'lib/pago/v2026_04/models.rb', line 36097 def initialize( id:, created_at:, modified_at:, trial_interval:, trial_interval_count:, name:, description:, visibility:, recurring_interval:, recurring_interval_count:, meter_interval:, meter_interval_count:, is_recurring:, is_archived:, organization_id:, metadata:, prices:, benefits:, medias:, attached_custom_fields: ) super() assign(:id, id) assign(:created_at, created_at) assign(:modified_at, modified_at) assign(:trial_interval, trial_interval) assign(:trial_interval_count, trial_interval_count) assign(:name, name) assign(:description, description) assign(:visibility, visibility) assign(:recurring_interval, recurring_interval) assign(:recurring_interval_count, recurring_interval_count) assign(:meter_interval, meter_interval) assign(:meter_interval_count, meter_interval_count) assign(:is_recurring, is_recurring) assign(:is_archived, is_archived) assign(:organization_id, organization_id) assign(:metadata, ) assign(:prices, prices) assign(:benefits, benefits) assign(:medias, medias) assign(:attached_custom_fields, attached_custom_fields) end |
Instance Attribute Details
#attached_custom_fields ⇒ Array<Models::AttachedCustomField> (readonly)
List of custom fields attached to the product.
36095 36096 36097 |
# File 'lib/pago/v2026_04/models.rb', line 36095 def attached_custom_fields @attached_custom_fields end |
#benefits ⇒ Array<Object> (readonly)
List of benefits granted by the product.
36087 36088 36089 |
# File 'lib/pago/v2026_04/models.rb', line 36087 def benefits @benefits end |
#created_at ⇒ String (readonly)
Creation timestamp of the object.
36025 36026 36027 |
# File 'lib/pago/v2026_04/models.rb', line 36025 def created_at @created_at end |
#description ⇒ String? (readonly)
The description of the product.
36045 36046 36047 |
# File 'lib/pago/v2026_04/models.rb', line 36045 def description @description end |
#id ⇒ String (readonly)
The ID of the object.
36021 36022 36023 |
# File 'lib/pago/v2026_04/models.rb', line 36021 def id @id end |
#is_archived ⇒ Boolean (readonly)
Whether the product is archived and no longer available.
36072 36073 36074 |
# File 'lib/pago/v2026_04/models.rb', line 36072 def is_archived @is_archived end |
#is_recurring ⇒ Boolean (readonly)
Whether the product is a subscription.
36068 36069 36070 |
# File 'lib/pago/v2026_04/models.rb', line 36068 def is_recurring @is_recurring end |
#medias ⇒ Array<Models::ProductMediaFileRead> (readonly)
List of medias associated to the product.
36091 36092 36093 |
# File 'lib/pago/v2026_04/models.rb', line 36091 def medias @medias end |
#metadata ⇒ Hash{String => String, Integer, Float, Boolean} (readonly)
36079 36080 36081 |
# File 'lib/pago/v2026_04/models.rb', line 36079 def @metadata end |
#meter_interval ⇒ String? (readonly)
The meter cycle of the product, independent of the billing interval. If None, metered concerns follow the billing interval.
36060 36061 36062 |
# File 'lib/pago/v2026_04/models.rb', line 36060 def meter_interval @meter_interval end |
#meter_interval_count ⇒ Integer? (readonly)
Number of meter interval units. None when no meter cycle is set.
36064 36065 36066 |
# File 'lib/pago/v2026_04/models.rb', line 36064 def meter_interval_count @meter_interval_count end |
#modified_at ⇒ String? (readonly)
Last modification timestamp of the object.
36029 36030 36031 |
# File 'lib/pago/v2026_04/models.rb', line 36029 def modified_at @modified_at end |
#name ⇒ String (readonly)
The name of the product.
36041 36042 36043 |
# File 'lib/pago/v2026_04/models.rb', line 36041 def name @name end |
#organization_id ⇒ String (readonly)
The ID of the organization owning the product.
36076 36077 36078 |
# File 'lib/pago/v2026_04/models.rb', line 36076 def organization_id @organization_id end |
#prices ⇒ Array<Object> (readonly)
List of prices for this product.
36083 36084 36085 |
# File 'lib/pago/v2026_04/models.rb', line 36083 def prices @prices end |
#recurring_interval ⇒ String? (readonly)
The recurring interval of the product. If None, the product is a one-time purchase.
36052 36053 36054 |
# File 'lib/pago/v2026_04/models.rb', line 36052 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. None for one-time products.
36056 36057 36058 |
# File 'lib/pago/v2026_04/models.rb', line 36056 def recurring_interval_count @recurring_interval_count end |
#trial_interval ⇒ String? (readonly)
The interval unit for the trial period.
36033 36034 36035 |
# File 'lib/pago/v2026_04/models.rb', line 36033 def trial_interval @trial_interval end |
#trial_interval_count ⇒ Integer? (readonly)
The number of interval units for the trial period.
36037 36038 36039 |
# File 'lib/pago/v2026_04/models.rb', line 36037 def trial_interval_count @trial_interval_count end |
#visibility ⇒ String (readonly)
36048 36049 36050 |
# File 'lib/pago/v2026_04/models.rb', line 36048 def visibility @visibility end |
Class Method Details
.from_json(data) ⇒ Product?
36144 36145 36146 36147 36148 36149 36150 36151 36152 36153 36154 36155 36156 36157 36158 36159 36160 36161 36162 36163 36164 36165 36166 36167 36168 36169 36170 36171 36172 36173 36174 |
# File 'lib/pago/v2026_04/models.rb', line 36144 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( id: (data.key?("id") ? data["id"] : ::Pago::UNSET), created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET), modified_at: (data.key?("modified_at") ? data["modified_at"] : ::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), visibility: (data.key?("visibility") ? data["visibility"] : ::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), meter_interval: (data.key?("meter_interval") ? data["meter_interval"] : ::Pago::UNSET), meter_interval_count: (data.key?("meter_interval_count") ? data["meter_interval_count"] : ::Pago::UNSET), is_recurring: (data.key?("is_recurring") ? data["is_recurring"] : ::Pago::UNSET), is_archived: (data.key?("is_archived") ? data["is_archived"] : ::Pago::UNSET), organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET), metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET), prices: (data.key?("prices") ? ::Pago::Serde.array(data["prices"]) { |item0| ::Pago::Serde.union(item0, variants: [Unions::LegacyRecurringProductPrice, Unions::ProductPrice]) } : ::Pago::UNSET), benefits: (data.key?("benefits") ? ::Pago::Serde.array(data["benefits"]) { |item0| Unions::Benefit.from_json(item0) } : ::Pago::UNSET), medias: (data.key?("medias") ? ::Pago::Serde.array(data["medias"]) { |item0| Models::ProductMediaFileRead.from_json(item0) } : ::Pago::UNSET), attached_custom_fields: (data.key?("attached_custom_fields") ? ::Pago::Serde.array(data["attached_custom_fields"]) { |item0| Models::AttachedCustomField.from_json(item0) } : ::Pago::UNSET) ), data ) end |