Class: ForestAdminRpcAgent::Routes::ActionExecute
- Includes:
- ForestAdminAgent::Routes::QueryHandler, ForestAdminAgent::Utils, ForestAdminDatasourceToolkit::Components::Query
- Defined in:
- lib/forest_admin_rpc_agent/routes/action_execute.rb
Instance Method Summary collapse
- #handle_request(args) ⇒ Object
-
#initialize ⇒ ActionExecute
constructor
A new instance of ActionExecute.
Methods inherited from BaseRoute
#build_rails_response, #register_rails, #register_sinatra, #registered
Constructor Details
#initialize ⇒ ActionExecute
10 11 12 |
# File 'lib/forest_admin_rpc_agent/routes/action_execute.rb', line 10 def initialize super('rpc/:collection_name/action-execute', 'post', 'rpc_action_execute') end |
Instance Method Details
#handle_request(args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/forest_admin_rpc_agent/routes/action_execute.rb', line 14 def handle_request(args) return {} unless args[:params]['collection_name'] datasource = ForestAdminRpcAgent::Facades::Container.datasource collection = get_collection_safe(datasource, args[:params]['collection_name']) filter = FilterFactory.from_plain_object(args[:params]['filter']) data = args[:params]['data'] action = args[:params]['action'] collection.execute(args[:caller], action, data, filter) end |