Class: Textus::Write::Propose
- Inherits:
-
Object
- Object
- Textus::Write::Propose
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/write/propose.rb
Overview
Queue a proposal: resolve the acting role’s propose_zone, prefix the key, and write there via the Put verb. Was inlined in the MCP ‘propose` tool and the CLI propose verb; promoted to a first-class verb so all three transports share one implementation (ADR 0036, ADR 0039).
Instance Method Summary collapse
-
#call(key, meta: nil, body: nil, content: nil) ⇒ Object
if_etag is intentionally absent: a proposal is always a fresh queue write.
-
#initialize(container:, call:) ⇒ Propose
constructor
A new instance of Propose.
Methods included from Contract::DSL
arg, contract, contract?, response, summary, surfaces, verb
Constructor Details
#initialize(container:, call:) ⇒ Propose
Returns a new instance of Propose.
20 21 22 23 24 |
# File 'lib/textus/write/propose.rb', line 20 def initialize(container:, call:) @container = container @call = call @manifest = container.manifest end |
Instance Method Details
#call(key, meta: nil, body: nil, content: nil) ⇒ Object
if_etag is intentionally absent: a proposal is always a fresh queue write.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/textus/write/propose.rb', line 27 def call(key, meta: nil, body: nil, content: nil) zone = @manifest.policy.propose_zone_for(@call.role) unless zone raise Textus::Error.new( "propose_forbidden", "role '#{@call.role}' has no writable propose_zone", details: { "role" => @call.role }, hint: "the manifest must define a queue zone and '#{@call.role}' must hold the 'propose' capability", ) end Textus::Dispatcher.invoke( :put, container: @container, call: @call, args: ["#{zone}.#{key}"], kwargs: { meta: || {}, body: body, content: content } ) end |