Class: Pago::V2026_04::Models::AttachedCustomField

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

Overview

Schema of a custom field attached to a resource.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  custom_field_id: "custom_field_id",
  custom_field: "custom_field",
  order: "order",
  required: "required"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["custom_field_id", "custom_field", "order", "required"].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(custom_field_id:, custom_field:, order:, required:) ⇒ AttachedCustomField

Returns a new instance of AttachedCustomField.

Parameters:

  • custom_field_id: (String)
  • custom_field: (Object)
  • order: (Integer)
  • required: (Boolean)


353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/pago/v2026_04/models.rb', line 353

def initialize(
  custom_field_id:,
  custom_field:,
  order:,
  required:
)
  super()
  assign(:custom_field_id, custom_field_id)
  assign(:custom_field, custom_field)
  assign(:order, order)
  assign(:required, required)
end

Instance Attribute Details

#custom_fieldObject (readonly)

Returns:

  • (Object)


343
344
345
# File 'lib/pago/v2026_04/models.rb', line 343

def custom_field
  @custom_field
end

#custom_field_idString (readonly)

ID of the custom field.

Returns:

  • (String)


340
341
342
# File 'lib/pago/v2026_04/models.rb', line 340

def custom_field_id
  @custom_field_id
end

#orderInteger (readonly)

Order of the custom field in the resource.

Returns:

  • (Integer)


347
348
349
# File 'lib/pago/v2026_04/models.rb', line 347

def order
  @order
end

#requiredBoolean (readonly)

Whether the value is required for this custom field.

Returns:

  • (Boolean)


351
352
353
# File 'lib/pago/v2026_04/models.rb', line 351

def required
  @required
end

Class Method Details

.from_json(data) ⇒ AttachedCustomField?

Parameters:

  • data (Hash, String, nil)

Returns:



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/pago/v2026_04/models.rb', line 368

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(
      custom_field_id: (data.key?("custom_field_id") ? data["custom_field_id"] : ::Pago::UNSET),
      custom_field: (data.key?("custom_field") ? Unions::CustomField.from_json(data["custom_field"]) : ::Pago::UNSET),
      order: (data.key?("order") ? data["order"] : ::Pago::UNSET),
      required: (data.key?("required") ? data["required"] : ::Pago::UNSET)
    ),
    data
  )
end