Class: Textus::Application::Write::Put::Impl
- Inherits:
-
Object
- Object
- Textus::Application::Write::Put::Impl
- Defined in:
- lib/textus/application/write/put.rb
Instance Method Summary collapse
- #call(key, meta: nil, body: nil, content: nil, if_etag: nil) ⇒ Object
-
#initialize(ctx:, caps:, writer:, hook_context:) ⇒ Impl
constructor
A new instance of Impl.
Constructor Details
#initialize(ctx:, caps:, writer:, hook_context:) ⇒ Impl
Returns a new instance of Impl.
14 15 16 17 18 19 20 21 |
# File 'lib/textus/application/write/put.rb', line 14 def initialize(ctx:, caps:, writer:, hook_context:) @ctx = ctx @manifest = caps.manifest @events = caps.events @authorizer = caps. @writer = writer @hook_context = hook_context end |
Instance Method Details
#call(key, meta: nil, body: nil, content: nil, if_etag: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/textus/application/write/put.rb', line 23 def call(key, meta: nil, body: nil, content: nil, if_etag: nil) Textus::Manifest::Data.validate_key!(key) mentry = @manifest.resolver.resolve(key).entry @authorizer.(mentry, role: @ctx.role) envelope = @writer.put( key, mentry: mentry, payload: Textus::Application::Envelope::Writer::Payload.new(meta: , body: body, content: content), if_etag: if_etag, ) @events.publish(:entry_put, ctx: @hook_context, key: key, envelope: envelope) envelope end |