Module: Pago::V2026_04::Unions::CustomFieldUpdate

Defined in:
lib/pago/v2026_04/unions.rb,
sig/pago/v2026_04/generated.rbs

Overview

Variants: Models::CustomFieldUpdateText, Models::CustomFieldUpdateNumber, Models::CustomFieldUpdateDate, Models::CustomFieldUpdateCheckbox, Models::CustomFieldUpdateSelect.

Constant Summary collapse

DISCRIMINATOR =

Returns:

  • (String, nil)
"type"

Class Method Summary collapse

Class Method Details

.from_json(data) ⇒ Object?

Returns the resolved variant, or the raw payload.

Parameters:

  • data (Hash, String, nil)

Returns:

  • (Object, nil)

    the resolved variant, or the raw payload.



213
214
215
216
# File 'lib/pago/v2026_04/unions.rb', line 213

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  ::Pago::Serde.union(data, discriminator: DISCRIMINATOR, mapping: mapping, variants: variants)
end

.mappingHash{String => Class}

Returns discriminator value to model class.

Returns:

  • (Hash{String => Class})

    discriminator value to model class.



196
197
198
199
200
201
202
203
204
# File 'lib/pago/v2026_04/unions.rb', line 196

def self.mapping
  @mapping ||= {
    "checkbox" => Models::CustomFieldUpdateCheckbox,
    "date" => Models::CustomFieldUpdateDate,
    "number" => Models::CustomFieldUpdateNumber,
    "select" => Models::CustomFieldUpdateSelect,
    "text" => Models::CustomFieldUpdateText
  }.freeze
end

.variantsArray<Class>

Returns every model this union can resolve to.

Returns:

  • (Array<Class>)

    every model this union can resolve to.



207
208
209
# File 'lib/pago/v2026_04/unions.rb', line 207

def self.variants
  @variants ||= [Models::CustomFieldUpdateText, Models::CustomFieldUpdateNumber, Models::CustomFieldUpdateDate, Models::CustomFieldUpdateCheckbox, Models::CustomFieldUpdateSelect].freeze
end