Shape
Base class for wrapper shapes.
Subclass to define response type structure for record or collection wrappers. The block is evaluated via instance_exec, providing access to type DSL methods and helpers like root_key and #metadata_type_names.
Example: Custom shape class
class MyShape < Wrapper::Shape
def apply
reference(:invoice)
object?(:meta)
metadata_type_names.each { |type_name| merge(type_name) }
end
endExample: Inline shape block
shape do
reference(root_key.singular.to_sym)
object?(:meta)
metadata_type_names.each { |type_name| merge(type_name) }
endInstance Methods
#array
#array(name, **options, &block)
See also
#array?
#array?(name, **options, &block)
See also
#binary
#binary(name, **options)
See also
#binary?
#binary?(name, **options)
See also
#boolean
#boolean(name, **options)
See also
#boolean?
#boolean?(name, **options)
See also
#data_type
#data_type
The data type for this shape.
Returns
Symbol, nil
#date
#date(name, **options)
See also
#date?
#date?(name, **options)
See also
#datetime
#datetime(name, **options)
See also
#datetime?
#datetime?(name, **options)
See also
#decimal
#decimal(name, **options)
See also
#decimal?
#decimal?(name, **options)
See also
#extends
#extends(type)
See also
#integer
#integer(name, **options)
See also
#integer?
#integer?(name, **options)
See also
#literal
#literal(name, value:, **options)
See also
#merge
#merge(other)
See also
#metadata_type_names
#metadata_type_names
The metadata type names for this shape.
Auto-generated type names from capability Adapter::Capability::Operation::Base.metadata_shape definitions. Use with #merge to include capability metadata fields in the shape.
Returns
Array<Symbol>
#number
#number(name, **options)
See also
#number?
#number?(name, **options)
See also
#object
#object(name, **options, &block)
See also
#object?
#object?(name, **options, &block)
See also
#reference
#reference(name, **options)
See also
#reference?
#reference?(name, **options)
See also
#string
#string(name, **options)
See also
#string?
#string?(name, **options)
See also
#time
#time(name, **options)
See also
#time?
#time?(name, **options)
See also
#union
#union(name, **options, &block)
See also
#union?
#union?(name, **options, &block)
See also
#uuid
#uuid(name, **options)
See also
#uuid?
#uuid?(name, **options)
See also