Class: Moonbase::Models::Form

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/moonbase/models/form.rb

Overview

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(id:, business_email_required:, collection:, created_at:, name:, pages_enabled:, updated_at:, pages_url: nil, redirect_url: nil, type: :form) ⇒ Object

Some parameter documentations has been truncated, see Moonbase::Models::Form for more details.

A Form provides a way to create ‘Items` in a `Collection`, often via a public URL for external users. Each form submission creates a new item.

Parameters:

  • id (String)

    Unique identifier for the object.

  • business_email_required (Boolean)

    ‘true` if submissions require a business email address, blocking free and dispos

  • collection (Moonbase::Models::Collection)

    The ‘Collection` that submissions to this form are saved to.

  • created_at (Time)

    Time at which the object was created, as an ISO 8601 timestamp in UTC.

  • name (String)

    The name of the form, used as the title on its public page.

  • pages_enabled (Boolean)

    If ‘true`, a Moonbase Pages hosted page is enabled for this form, providing a st

  • updated_at (Time)

    Time at which the object was last updated, as an ISO 8601 timestamp in UTC.

  • pages_url (String) (defaults to: nil)

    The public URL for the form, if ‘pages_enabled` is `true`.

  • redirect_url (String) (defaults to: nil)

    Optional URL the user is redirected to after a successful submission. When unset

  • type (Symbol, :form) (defaults to: :form)

    String representing the object’s type. Always ‘form` for this object.



# File 'lib/moonbase/models/form.rb', line 76

Instance Attribute Details

#business_email_requiredBoolean

‘true` if submissions require a business email address, blocking free and disposable providers.

Returns:

  • (Boolean)


18
# File 'lib/moonbase/models/form.rb', line 18

required :business_email_required, Moonbase::Internal::Type::Boolean

#collectionMoonbase::Models::Collection

The ‘Collection` that submissions to this form are saved to.



24
# File 'lib/moonbase/models/form.rb', line 24

required :collection, -> { Moonbase::Collection }

#created_atTime

Time at which the object was created, as an ISO 8601 timestamp in UTC.

Returns:

  • (Time)


30
# File 'lib/moonbase/models/form.rb', line 30

required :created_at, Time

#idString

Unique identifier for the object.

Returns:

  • (String)


11
# File 'lib/moonbase/models/form.rb', line 11

required :id, String

#nameString

The name of the form, used as the title on its public page.

Returns:

  • (String)


36
# File 'lib/moonbase/models/form.rb', line 36

required :name, String

#pages_enabledBoolean

If ‘true`, a Moonbase Pages hosted page is enabled for this form, providing a standalone public URL for sharing.

Returns:

  • (Boolean)


43
# File 'lib/moonbase/models/form.rb', line 43

required :pages_enabled, Moonbase::Internal::Type::Boolean

#pages_urlString?

The public URL for the form, if ‘pages_enabled` is `true`.

Returns:

  • (String, nil)


61
# File 'lib/moonbase/models/form.rb', line 61

optional :pages_url, String

#redirect_urlString?

Optional URL the user is redirected to after a successful submission. When unset, no redirect occurs. Stored as a Liquid template; rendered at submission time with form field values under ‘submission.<key>` (keyed by the field’s ‘key`) plus UTM params (`utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`) automatically appended. Use the `uri_encode` filter for URL-safe values, e.g. `example.com/thanks?email=submission.email | uri_encode }`. The rendered URL must parse as a valid URL or the submission errors.

Returns:

  • (String, nil)


74
# File 'lib/moonbase/models/form.rb', line 74

optional :redirect_url, String

#typeSymbol, :form

String representing the object’s type. Always ‘form` for this object.

Returns:

  • (Symbol, :form)


49
# File 'lib/moonbase/models/form.rb', line 49

required :type, const: :form

#updated_atTime

Time at which the object was last updated, as an ISO 8601 timestamp in UTC.

Returns:

  • (Time)


55
# File 'lib/moonbase/models/form.rb', line 55

required :updated_at, Time