Class: Pago::V2026_04::Models::ProductPriceMeteredUnit

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

Overview

A metered, usage-based, price for a product, with a fixed unit price.

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",
  unit_amount: "unit_amount",
  cap_amount: "cap_amount",
  meter_id: "meter_id",
  meter: "meter"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["created_at", "modified_at", "id", "source", "amount_type", "price_currency", "tax_behavior", "is_archived", "product_id", "unit_amount", "cap_amount", "meter_id", "meter"].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:, unit_amount:, cap_amount:, meter_id:, meter:) ⇒ ProductPriceMeteredUnit

Returns a new instance of ProductPriceMeteredUnit.

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)
  • unit_amount: (String)
  • cap_amount: (Integer, nil)
  • meter_id: (String)
  • meter: (Models::ProductPriceMeter)


37583
37584
37585
37586
37587
37588
37589
37590
37591
37592
37593
37594
37595
37596
37597
37598
37599
37600
37601
37602
37603
37604
37605
37606
37607
37608
37609
37610
37611
37612
# File 'lib/pago/v2026_04/models.rb', line 37583

def initialize(
  created_at:,
  modified_at:,
  id:,
  source:,
  amount_type:,
  price_currency:,
  tax_behavior:,
  is_archived:,
  product_id:,
  unit_amount:,
  cap_amount:,
  meter_id:,
  meter:
)
  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(:unit_amount, unit_amount)
  assign(:cap_amount, cap_amount)
  assign(:meter_id, meter_id)
  assign(:meter, meter)
end

Instance Attribute Details

#amount_typeString (readonly)

Returns:

  • (String)


37550
37551
37552
# File 'lib/pago/v2026_04/models.rb', line 37550

def amount_type
  @amount_type
end

#cap_amountInteger? (readonly)

The maximum amount in cents that can be charged, regardless of the number of units consumed.

Returns:

  • (Integer, nil)


37574
37575
37576
# File 'lib/pago/v2026_04/models.rb', line 37574

def cap_amount
  @cap_amount
end

#created_atString (readonly)

Creation timestamp of the object.

Returns:

  • (String)


37536
37537
37538
# File 'lib/pago/v2026_04/models.rb', line 37536

def created_at
  @created_at
end

#idString (readonly)

The ID of the price.

Returns:

  • (String)


37544
37545
37546
# File 'lib/pago/v2026_04/models.rb', line 37544

def id
  @id
end

#is_archivedBoolean (readonly)

Whether the price is archived and no longer available.

Returns:

  • (Boolean)


37562
37563
37564
# File 'lib/pago/v2026_04/models.rb', line 37562

def is_archived
  @is_archived
end

#meterModels::ProductPriceMeter (readonly)



37581
37582
37583
# File 'lib/pago/v2026_04/models.rb', line 37581

def meter
  @meter
end

#meter_idString (readonly)

The ID of the meter associated to the price.

Returns:

  • (String)


37578
37579
37580
# File 'lib/pago/v2026_04/models.rb', line 37578

def meter_id
  @meter_id
end

#modified_atString? (readonly)

Last modification timestamp of the object.

Returns:

  • (String, nil)


37540
37541
37542
# File 'lib/pago/v2026_04/models.rb', line 37540

def modified_at
  @modified_at
end

#price_currencyString (readonly)

The currency in which the customer will be charged.

Returns:

  • (String)


37554
37555
37556
# File 'lib/pago/v2026_04/models.rb', line 37554

def price_currency
  @price_currency
end

#product_idString (readonly)

The ID of the product owning the price.

Returns:

  • (String)


37566
37567
37568
# File 'lib/pago/v2026_04/models.rb', line 37566

def product_id
  @product_id
end

#sourceString (readonly)

Returns:

  • (String)


37547
37548
37549
# File 'lib/pago/v2026_04/models.rb', line 37547

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)


37558
37559
37560
# File 'lib/pago/v2026_04/models.rb', line 37558

def tax_behavior
  @tax_behavior
end

#unit_amountString (readonly)

The price per unit in cents.

Returns:

  • (String)


37570
37571
37572
# File 'lib/pago/v2026_04/models.rb', line 37570

def unit_amount
  @unit_amount
end

Class Method Details

.from_json(data) ⇒ ProductPriceMeteredUnit?

Parameters:

  • data (Hash, String, nil)

Returns:



37616
37617
37618
37619
37620
37621
37622
37623
37624
37625
37626
37627
37628
37629
37630
37631
37632
37633
37634
37635
37636
37637
37638
37639
# File 'lib/pago/v2026_04/models.rb', line 37616

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),
      unit_amount: (data.key?("unit_amount") ? data["unit_amount"] : ::Pago::UNSET),
      cap_amount: (data.key?("cap_amount") ? data["cap_amount"] : ::Pago::UNSET),
      meter_id: (data.key?("meter_id") ? data["meter_id"] : ::Pago::UNSET),
      meter: (data.key?("meter") ? Models::ProductPriceMeter.from_json(data["meter"]) : ::Pago::UNSET)
    ),
    data
  )
end