Class: Treaty::Action::Response::Attribute::Builder

Inherits:
Entity::Attribute::Builder::Base show all
Defined in:
lib/treaty/action/response/attribute/builder.rb

Overview

DSL builder for defining response attributes.

Purpose

Provides Response-specific implementation of the attribute builder. Creates Response::Attribute::Attribute instances instead of generic ones.

Inheritance

Extends Treaty::Entity::Attribute::Builder::Base which provides:

  • DSL interface (string, integer, object, array, etc.)
  • method_missing magic for type-based method calls
  • Helper support (:required, :optional)
  • Entity reuse via use_entity

Usage

Used internally by:

  • Response::Attribute::Attribute (when processing nested object/array blocks)

DSL Example

response 201 do
object :post do
  string :id
  string :title
  datetime :created_at
end
end

Methods

Implements abstract methods from base class:

  • create_attribute - Creates Response::Attribute::Attribute
  • deep_copy_attribute - Deep copies attribute for use_entity support

Instance Attribute Summary

Attributes inherited from Entity::Attribute::Builder::Base

#collection_of_attributes, #nesting_level

Method Summary

Methods inherited from Entity::Attribute::Builder::Base

#attribute, #initialize, #method_missing, #respond_to_missing?, #use_entity

Constructor Details

This class inherits a constructor from Treaty::Entity::Attribute::Builder::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Treaty::Entity::Attribute::Builder::Base