class HecksApplication::Commands::CRUDHandler
Map resourceful methods to the domain
Attributes
application[R]
module_name[R]
validator[R]
Public Class Methods
new(module_name:, application:, validator:)
click to toggle source
# File lib/commands/crud_handler.rb, line 7 def initialize(module_name:, application:, validator:) @module_name = module_name @application = application @validator = validator end
Public Instance Methods
create(args)
click to toggle source
# File lib/commands/crud_handler.rb, line 13 def create(args) application.call( module_name: module_name, command_name: :create, args: args ) end
delete(id)
click to toggle source
# File lib/commands/crud_handler.rb, line 37 def delete(id) application.call( module_name: module_name, command_name: :delete, args: { id: id } ) end
read(id)
click to toggle source
# File lib/commands/crud_handler.rb, line 21 def read(id) application.query( module_name: module_name, query_name: :find_by_id, args: { id: id } ) end
update(attributes)
click to toggle source
# File lib/commands/crud_handler.rb, line 29 def update(attributes) application.call( module_name: module_name, command_name: :update, args: attributes ) end