Module: Treaty::Action::Context::Callable
- Defined in:
- lib/treaty/action/context/callable.rb
Overview
Class methods for calling treaty actions.
Purpose
Provides the public call! class method that serves as the entry
point for treaty execution. Handles instance creation and delegates
to instance methods.
Usage
Extended into:
- Treaty classes (via Context::DSL)
Called by:
- Controller integration
- Direct treaty invocation in tests
Call Pattern
# Public API:
result = Posts::CreateTreaty.call!(
version: "1",
params: { post: { title: "Hello" } },
context: controller, # optional
inventory: inventory # optional
)
result.data # => validated response hash
result.status # => HTTP status code
result.version # => resolved version
Implementation
Creates a new treaty instance and delegates to _call! which
passes through to Workspace, then to Versions::Workspace for
actual execution.
Instance Method Summary collapse
-
#call!(version:, params:, context: nil, inventory: nil) ⇒ Treaty::Action::Result
Executes treaty with given parameters.
Instance Method Details
#call!(version:, params:, context: nil, inventory: nil) ⇒ Treaty::Action::Result
Executes treaty with given parameters
Main entry point for treaty execution. Creates instance and delegates to instance methods for actual work.
58 59 60 61 62 |
# File 'lib/treaty/action/context/callable.rb', line 58 def call!(version:, params:, context: nil, inventory: nil) treaty_instance = send(:new) _call!(treaty_instance, context:, inventory:, version:, params:) end |