Class: ActiveRpc::RpcController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ActiveRpc::RpcController
- Defined in:
- app/controllers/active_rpc/rpc_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/active_rpc/rpc_controller.rb', line 11 def create res = nil begin res = case body when Array then body.map(&method(:process_item)).map(&:to_hash) when Hash then process_item(body).to_hash end rescue JSON::ParserError => ex res = ActiveRpc::Response.new do |r| r.error = Errors::ParseError.new(message: ex.to_s) end.to_hash end render status: :ok, json: res end |