Class: DTK::Client::Execute::ExecuteContext::Proxy
- Inherits:
-
Object
- Object
- DTK::Client::Execute::ExecuteContext::Proxy
- Defined in:
- lib/execute/execute_context.rb
Overview
commands in the execute context
Instance Method Summary collapse
- #call(object_type__method, params = {}) ⇒ Object
-
#initialize ⇒ Proxy
constructor
A new instance of Proxy.
- #post_rest_call(path, body = {}) ⇒ Object
Constructor Details
#initialize ⇒ Proxy
Returns a new instance of Proxy.
48 49 50 |
# File 'lib/execute/execute_context.rb', line 48 def initialize() @result_store = ResultStore.new() end |
Instance Method Details
#call(object_type__method, params = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/execute/execute_context.rb', line 52 def call(object_type__method,params={}) object_type, method = split_object_type__method(object_type__method) api_command = Command::APICall.new(:object_type => object_type, :method => method, :params => params) result = nil api_command.raw_executable_commands() do |raw_command| last_result = @result_store.get_last_result?() command = raw_command.translate(params,:last_result => last_result) result = CommandProcessor.execute(command) @result_store.store(result) end [result, api_command] end |
#post_rest_call(path, body = {}) ⇒ Object
65 66 67 68 69 |
# File 'lib/execute/execute_context.rb', line 65 def post_rest_call(path,body={}) command = Command::RestCall::Post.new(:path => path, :body => body, :last_result => @last_result) result = CommandProcessor.execute(command) [result, command] end |