Class: Textus::Action::Put
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/action/put.rb
Constant Summary collapse
- BURN =
:sync
Instance Method Summary collapse
- #call(container:, call:) ⇒ Object
-
#initialize(key:, meta: nil, body: nil, content: nil, if_etag: nil) ⇒ Put
constructor
A new instance of Put.
Methods included from Contract::DSL
arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view
Methods inherited from Base
Constructor Details
#initialize(key:, meta: nil, body: nil, content: nil, if_etag: nil) ⇒ Put
Returns a new instance of Put.
25 26 27 28 29 30 31 32 |
# File 'lib/textus/action/put.rb', line 25 def initialize(key:, meta: nil, body: nil, content: nil, if_etag: nil) super() @key = key @meta = @body = body @content = content @if_etag = if_etag end |
Instance Method Details
#call(container:, call:) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/textus/action/put.rb', line 34 def call(container:, call:) run_with_cascade(@key, container:, call:) do Textus::Manifest::Data.validate_key!(@key) mentry = container.manifest.resolver.resolve(@key).entry auth(container).check_action!(action: :put, actor: call.role, key: @key, extra: { if_etag: @if_etag }) envelope = writer(container, call).put( @key, mentry: mentry, payload: Textus::Envelope::IO::Writer::Payload.new( meta: @meta, body: @body, content: @content, ), if_etag: @if_etag, ) container.steps.publish( :entry_written, ctx: Textus::Step::Context.for(container: container, call: call), key: @key, envelope: envelope, ) envelope end end |