Class: Pago::V2026_04::Models::CostMetadataInput

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

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  amount: "amount",
  currency: "currency"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["amount", "currency"].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(amount:, currency:) ⇒ CostMetadataInput

Returns a new instance of CostMetadataInput.

Parameters:

  • amount: (Object)
  • currency: (String)


13014
13015
13016
13017
13018
13019
13020
13021
# File 'lib/pago/v2026_04/models.rb', line 13014

def initialize(
  amount:,
  currency:
)
  super()
  assign(:amount, amount)
  assign(:currency, currency)
end

Instance Attribute Details

#amountFloat, String (readonly)

The amount in cents.

Returns:

  • (Float, String)


13008
13009
13010
# File 'lib/pago/v2026_04/models.rb', line 13008

def amount
  @amount
end

#currencyString (readonly)

The currency. Currently, only usd is supported.

Returns:

  • (String)


13012
13013
13014
# File 'lib/pago/v2026_04/models.rb', line 13012

def currency
  @currency
end

Class Method Details

.from_json(data) ⇒ CostMetadataInput?

Parameters:

  • data (Hash, String, nil)

Returns:



13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
# File 'lib/pago/v2026_04/models.rb', line 13025

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: (data.key?("amount") ? data["amount"] : ::Pago::UNSET),
      currency: (data.key?("currency") ? data["currency"] : ::Pago::UNSET)
    ),
    data
  )
end