Class: Pago::V2026_04::Models::ProductPriceMeteredUnitCreate
- Defined in:
- lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs
Overview
Schema to create a metered price with a fixed unit price.
Constant Summary collapse
- JSON_KEYS =
{ amount_type: "amount_type", price_currency: "price_currency", tax_behavior: "tax_behavior", meter_id: "meter_id", unit_amount: "unit_amount", cap_amount: "cap_amount" }.freeze
- REQUIRED_KEYS =
["amount_type", "meter_id", "unit_amount"].freeze
Instance Attribute Summary collapse
- #amount_type ⇒ String readonly
-
#cap_amount ⇒ Integer?
readonly
Optional maximum amount in cents that can be charged, regardless of the number of units consumed.
-
#meter_id ⇒ String
readonly
The ID of the meter associated to the price.
- #price_currency ⇒ String readonly
-
#tax_behavior ⇒ String?
readonly
The tax behavior of the price.
-
#unit_amount ⇒ Float, String
readonly
The price per unit in cents.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(amount_type:, price_currency: ::Pago::UNSET, tax_behavior: ::Pago::UNSET, meter_id:, unit_amount:, cap_amount: ::Pago::UNSET) ⇒ ProductPriceMeteredUnitCreate
constructor
A new instance of ProductPriceMeteredUnitCreate.
Methods inherited from Model
#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw
Constructor Details
#initialize(amount_type:, price_currency: ::Pago::UNSET, tax_behavior: ::Pago::UNSET, meter_id:, unit_amount:, cap_amount: ::Pago::UNSET) ⇒ ProductPriceMeteredUnitCreate
Returns a new instance of ProductPriceMeteredUnitCreate.
37676 37677 37678 37679 37680 37681 37682 37683 37684 37685 37686 37687 37688 37689 37690 37691 |
# File 'lib/pago/v2026_04/models.rb', line 37676 def initialize( amount_type:, price_currency: ::Pago::UNSET, tax_behavior: ::Pago::UNSET, meter_id:, unit_amount:, cap_amount: ::Pago::UNSET ) super() assign(:amount_type, amount_type) assign(:price_currency, price_currency) assign(:tax_behavior, tax_behavior) assign(:meter_id, meter_id) assign(:unit_amount, unit_amount) assign(:cap_amount, cap_amount) end |
Instance Attribute Details
#amount_type ⇒ String (readonly)
37655 37656 37657 |
# File 'lib/pago/v2026_04/models.rb', line 37655 def amount_type @amount_type end |
#cap_amount ⇒ Integer? (readonly)
Optional maximum amount in cents that can be charged, regardless of the number of units consumed.
37674 37675 37676 |
# File 'lib/pago/v2026_04/models.rb', line 37674 def cap_amount @cap_amount end |
#meter_id ⇒ String (readonly)
The ID of the meter associated to the price.
37666 37667 37668 |
# File 'lib/pago/v2026_04/models.rb', line 37666 def meter_id @meter_id end |
#price_currency ⇒ String (readonly)
37658 37659 37660 |
# File 'lib/pago/v2026_04/models.rb', line 37658 def price_currency @price_currency end |
#tax_behavior ⇒ String? (readonly)
The tax behavior of the price. If not set, it will default to the organization's default tax behavior.
37662 37663 37664 |
# File 'lib/pago/v2026_04/models.rb', line 37662 def tax_behavior @tax_behavior end |
#unit_amount ⇒ Float, String (readonly)
The price per unit in cents. Supports up to 12 decimal places.
37670 37671 37672 |
# File 'lib/pago/v2026_04/models.rb', line 37670 def unit_amount @unit_amount end |
Class Method Details
.from_json(data) ⇒ ProductPriceMeteredUnitCreate?
37695 37696 37697 37698 37699 37700 37701 37702 37703 37704 37705 37706 37707 37708 37709 37710 37711 |
# File 'lib/pago/v2026_04/models.rb', line 37695 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( 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), meter_id: (data.key?("meter_id") ? data["meter_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) ), data ) end |