Class: Pago::V2026_04::Models::ProductPriceCustom

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

Overview

A pay-what-you-want price for a product.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  created_at: "created_at",
  modified_at: "modified_at",
  id: "id",
  source: "source",
  amount_type: "amount_type",
  price_currency: "price_currency",
  tax_behavior: "tax_behavior",
  is_archived: "is_archived",
  product_id: "product_id",
  minimum_amount: "minimum_amount",
  maximum_amount: "maximum_amount",
  preset_amount: "preset_amount"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["created_at", "modified_at", "id", "source", "amount_type", "price_currency", "tax_behavior", "is_archived", "product_id", "minimum_amount", "maximum_amount", "preset_amount"].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(created_at:, modified_at:, id:, source:, amount_type:, price_currency:, tax_behavior:, is_archived:, product_id:, minimum_amount:, maximum_amount:, preset_amount:) ⇒ ProductPriceCustom

Returns a new instance of ProductPriceCustom.

Parameters:

  • created_at: (String)
  • modified_at: (String, nil)
  • id: (String)
  • source: (String)
  • amount_type: (String)
  • price_currency: (String)
  • tax_behavior: (String, nil)
  • is_archived: (Boolean)
  • product_id: (String)
  • minimum_amount: (Integer)
  • maximum_amount: (Integer, nil)
  • preset_amount: (Integer, nil)


36764
36765
36766
36767
36768
36769
36770
36771
36772
36773
36774
36775
36776
36777
36778
36779
36780
36781
36782
36783
36784
36785
36786
36787
36788
36789
36790
36791
# File 'lib/pago/v2026_04/models.rb', line 36764

def initialize(
  created_at:,
  modified_at:,
  id:,
  source:,
  amount_type:,
  price_currency:,
  tax_behavior:,
  is_archived:,
  product_id:,
  minimum_amount:,
  maximum_amount:,
  preset_amount:
)
  super()
  assign(:created_at, created_at)
  assign(:modified_at, modified_at)
  assign(:id, id)
  assign(:source, source)
  assign(:amount_type, amount_type)
  assign(:price_currency, price_currency)
  assign(:tax_behavior, tax_behavior)
  assign(:is_archived, is_archived)
  assign(:product_id, product_id)
  assign(:minimum_amount, minimum_amount)
  assign(:maximum_amount, maximum_amount)
  assign(:preset_amount, preset_amount)
end

Instance Attribute Details

#amount_typeString (readonly)

Returns:

  • (String)


36734
36735
36736
# File 'lib/pago/v2026_04/models.rb', line 36734

def amount_type
  @amount_type
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


36720
36721
36722
# File 'lib/pago/v2026_04/models.rb', line 36720

def created_at
  @created_at
end

#idString (readonly)

The ID of the price.

Returns:

  • (String)


36728
36729
36730
# File 'lib/pago/v2026_04/models.rb', line 36728

def id
  @id
end

#is_archivedBoolean (readonly)

Whether the price is archived and no longer available.

Returns:

  • (Boolean)


36746
36747
36748
# File 'lib/pago/v2026_04/models.rb', line 36746

def is_archived
  @is_archived
end

#maximum_amountInteger? (readonly)

The maximum amount the customer can pay.

Returns:

  • (Integer, nil)


36758
36759
36760
# File 'lib/pago/v2026_04/models.rb', line 36758

def maximum_amount
  @maximum_amount
end

#minimum_amountInteger (readonly)

The minimum amount the customer can pay. If 0, the price is 'free or pay what you want'.

Returns:

  • (Integer)


36754
36755
36756
# File 'lib/pago/v2026_04/models.rb', line 36754

def minimum_amount
  @minimum_amount
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


36724
36725
36726
# File 'lib/pago/v2026_04/models.rb', line 36724

def modified_at
  @modified_at
end

#preset_amountInteger? (readonly)

The initial amount shown to the customer.

Returns:

  • (Integer, nil)


36762
36763
36764
# File 'lib/pago/v2026_04/models.rb', line 36762

def preset_amount
  @preset_amount
end

#price_currencyString (readonly)

The currency in which the customer will be charged.

Returns:

  • (String)


36738
36739
36740
# File 'lib/pago/v2026_04/models.rb', line 36738

def price_currency
  @price_currency
end

#product_idString (readonly)

The ID of the product owning the price.

Returns:

  • (String)


36750
36751
36752
# File 'lib/pago/v2026_04/models.rb', line 36750

def product_id
  @product_id
end

#sourceString (readonly)

Returns:

  • (String)


36731
36732
36733
# File 'lib/pago/v2026_04/models.rb', line 36731

def source
  @source
end

#tax_behaviorString? (readonly)

The tax behavior of the price. If null, it defaults to the organization's default tax behavior.

Returns:

  • (String, nil)


36742
36743
36744
# File 'lib/pago/v2026_04/models.rb', line 36742

def tax_behavior
  @tax_behavior
end

Class Method Details

.from_json(data) ⇒ ProductPriceCustom?

Parameters:

  • data (Hash, String, nil)

Returns:



36795
36796
36797
36798
36799
36800
36801
36802
36803
36804
36805
36806
36807
36808
36809
36810
36811
36812
36813
36814
36815
36816
36817
# File 'lib/pago/v2026_04/models.rb', line 36795

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(
      created_at: (data.key?("created_at") ? data["created_at"] : ::Pago::UNSET),
      modified_at: (data.key?("modified_at") ? data["modified_at"] : ::Pago::UNSET),
      id: (data.key?("id") ? data["id"] : ::Pago::UNSET),
      source: (data.key?("source") ? data["source"] : ::Pago::UNSET),
      amount_type: (data.key?("amount_type") ? data["amount_type"] : ::Pago::UNSET),
      price_currency: (data.key?("price_currency") ? data["price_currency"] : ::Pago::UNSET),
      tax_behavior: (data.key?("tax_behavior") ? data["tax_behavior"] : ::Pago::UNSET),
      is_archived: (data.key?("is_archived") ? data["is_archived"] : ::Pago::UNSET),
      product_id: (data.key?("product_id") ? data["product_id"] : ::Pago::UNSET),
      minimum_amount: (data.key?("minimum_amount") ? data["minimum_amount"] : ::Pago::UNSET),
      maximum_amount: (data.key?("maximum_amount") ? data["maximum_amount"] : ::Pago::UNSET),
      preset_amount: (data.key?("preset_amount") ? data["preset_amount"] : ::Pago::UNSET)
    ),
    data
  )
end