Class: Dodopayments::Models::CustomField

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/dodopayments/models/custom_field.rb

Defined Under Namespace

Modules: FieldType

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(field_type:, key:, label:, options: nil, placeholder: nil, required: nil) ⇒ Object

Definition of a custom field for checkout

Parameters:

  • field_type (Symbol, Dodopayments::Models::CustomField::FieldType)

    Type of field determining validation rules

  • key (String)

    Unique identifier for this field (used as key in responses)

  • label (String)

    Display label shown to customer

  • options (Array<String>, nil) (defaults to: nil)

    Options for dropdown type (required for dropdown, ignored for others)

  • placeholder (String, nil) (defaults to: nil)

    Placeholder text for the input

  • required (Boolean) (defaults to: nil)

    Whether this field is required



# File 'lib/dodopayments/models/custom_field.rb', line 42

Instance Attribute Details

#field_typeSymbol, Dodopayments::Models::CustomField::FieldType

Type of field determining validation rules



10
# File 'lib/dodopayments/models/custom_field.rb', line 10

required :field_type, enum: -> { Dodopayments::CustomField::FieldType }

#keyString

Unique identifier for this field (used as key in responses)

Returns:

  • (String)


16
# File 'lib/dodopayments/models/custom_field.rb', line 16

required :key, String

#labelString

Display label shown to customer

Returns:

  • (String)


22
# File 'lib/dodopayments/models/custom_field.rb', line 22

required :label, String

#optionsArray<String>?

Options for dropdown type (required for dropdown, ignored for others)

Returns:

  • (Array<String>, nil)


28
# File 'lib/dodopayments/models/custom_field.rb', line 28

optional :options, Dodopayments::Internal::Type::ArrayOf[String], nil?: true

#placeholderString?

Placeholder text for the input

Returns:

  • (String, nil)


34
# File 'lib/dodopayments/models/custom_field.rb', line 34

optional :placeholder, String, nil?: true

#requiredBoolean?

Whether this field is required

Returns:

  • (Boolean, nil)


40
# File 'lib/dodopayments/models/custom_field.rb', line 40

optional :required, Dodopayments::Internal::Type::Boolean