Class: Igniter::Store::Protocol::Handlers::StoreHandler
- Inherits:
-
Object
- Object
- Igniter::Store::Protocol::Handlers::StoreHandler
- Defined in:
- lib/igniter/store/protocol/handlers/store_handler.rb
Constant Summary collapse
- REQUIRED =
%i[name key].freeze
Instance Method Summary collapse
- #call(descriptor) ⇒ Object
-
#initialize(store) ⇒ StoreHandler
constructor
A new instance of StoreHandler.
Constructor Details
#initialize(store) ⇒ StoreHandler
Returns a new instance of StoreHandler.
10 |
# File 'lib/igniter/store/protocol/handlers/store_handler.rb', line 10 def initialize(store) = @store = store |
Instance Method Details
#call(descriptor) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/igniter/store/protocol/handlers/store_handler.rb', line 12 def call(descriptor) missing = REQUIRED.select { |f| descriptor[f].nil? } return Receipt.rejection("Missing required fields: #{missing.join(", ")}", kind: :store) if missing.any? name = descriptor[:name].to_sym @store.schema_graph.register_store_descriptor(descriptor.merge(name: name)) Receipt.accepted(kind: :store, name: name) end |