Class: Pago::V2026_04::Models::CustomFieldCreateCheckbox

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

Overview

Schema to create a custom field of type checkbox.

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  metadata: "metadata",
  type: "type",
  slug: "slug",
  name: "name",
  organization_id: "organization_id",
  properties: "properties"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["type", "slug", "name", "properties"].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(metadata: ::Pago::UNSET, type:, slug:, name:, organization_id: ::Pago::UNSET, properties:) ⇒ CustomFieldCreateCheckbox

Returns a new instance of CustomFieldCreateCheckbox.

Parameters:

  • metadata: (Hash[String, untyped], nil) (defaults to: ::Pago::UNSET)
  • type: (String)
  • slug: (String)
  • name: (String)
  • organization_id: (String, nil) (defaults to: ::Pago::UNSET)
  • properties: (Models::CustomFieldCheckboxProperties)


13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
# File 'lib/pago/v2026_04/models.rb', line 13330

def initialize(
  metadata: ::Pago::UNSET,
  type:,
  slug:,
  name:,
  organization_id: ::Pago::UNSET,
  properties:
)
  super()
  assign(:metadata, )
  assign(:type, type)
  assign(:slug, slug)
  assign(:name, name)
  assign(:organization_id, organization_id)
  assign(:properties, properties)
end

Instance Attribute Details

#metadataHash{String => String, Integer, Float, Boolean} (readonly)

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Returns:

  • (Hash{String => String, Integer, Float, Boolean})


13310
13311
13312
# File 'lib/pago/v2026_04/models.rb', line 13310

def 
  @metadata
end

#nameString (readonly)

Name of the custom field.

Returns:

  • (String)


13321
13322
13323
# File 'lib/pago/v2026_04/models.rb', line 13321

def name
  @name
end

#organization_idString? (readonly)

The ID of the organization owning the custom field. Required unless you use an organization token.

Returns:

  • (String, nil)


13325
13326
13327
# File 'lib/pago/v2026_04/models.rb', line 13325

def organization_id
  @organization_id
end

#propertiesModels::CustomFieldCheckboxProperties (readonly)



13328
13329
13330
# File 'lib/pago/v2026_04/models.rb', line 13328

def properties
  @properties
end

#slugString (readonly)

Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens.

Returns:

  • (String)


13317
13318
13319
# File 'lib/pago/v2026_04/models.rb', line 13317

def slug
  @slug
end

#typeString (readonly)

Returns:

  • (String)


13313
13314
13315
# File 'lib/pago/v2026_04/models.rb', line 13313

def type
  @type
end

Class Method Details

.from_json(data) ⇒ CustomFieldCreateCheckbox?

Parameters:

  • data (Hash, String, nil)

Returns:



13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
# File 'lib/pago/v2026_04/models.rb', line 13349

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(
      metadata: (data.key?("metadata") ? data["metadata"] : ::Pago::UNSET),
      type: (data.key?("type") ? data["type"] : ::Pago::UNSET),
      slug: (data.key?("slug") ? data["slug"] : ::Pago::UNSET),
      name: (data.key?("name") ? data["name"] : ::Pago::UNSET),
      organization_id: (data.key?("organization_id") ? data["organization_id"] : ::Pago::UNSET),
      properties: (data.key?("properties") ? Models::CustomFieldCheckboxProperties.from_json(data["properties"]) : ::Pago::UNSET)
    ),
    data
  )
end