Class: ForestAdminRpcAgent::Routes::NativeQuery
- Defined in:
- lib/forest_admin_rpc_agent/routes/native_query.rb
Instance Method Summary collapse
- #handle_request(args) ⇒ Object
-
#initialize ⇒ NativeQuery
constructor
A new instance of NativeQuery.
Methods inherited from BaseRoute
#build_rails_response, #register_rails, #register_sinatra, #registered
Constructor Details
#initialize ⇒ NativeQuery
Returns a new instance of NativeQuery.
6 7 8 |
# File 'lib/forest_admin_rpc_agent/routes/native_query.rb', line 6 def initialize super('rpc-native-query', 'post', 'rpc_native_query') end |
Instance Method Details
#handle_request(args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/forest_admin_rpc_agent/routes/native_query.rb', line 10 def handle_request(args) return {} unless args[:params]['connection_name'] && args[:params]['query'] connection_name = args[:params]['connection_name'] query = args[:params]['query'] binds = args[:params]['binds'] || [] datasource = ForestAdminRpcAgent::Facades::Container.datasource datasource.execute_native_query(connection_name, query, binds) end |