Class: Brief::Server::Handlers::Modify
- Inherits:
-
Object
- Object
- Brief::Server::Handlers::Modify
- Defined in:
- lib/brief/server/handlers/modify.rb
Defined Under Namespace
Classes: Writer
Class Method Summary collapse
Class Method Details
.handle(path_args, briefcase, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/brief/server/handlers/modify.rb', line 3 def self.handle(path_args, briefcase, ={}) action = .fetch(:action) request = .fetch(:request) writer = Writer.new(briefcase, path_args, request.params.symbolize_keys) headers = {"Content-Type"=>"application/json", "X-BRIEF-MODIFY-ACTION"=>action} response = writer.run(action) if writer.has_errors? [500, headers, {errors: writer.errors, path: path_args}] else [200, headers, response] end end |