class DTK::Client::Execute::Command::APICall::PreviousResponse
Public Class Methods
new(response_key)
click to toggle source
# File lib/execute/command/api_call/translation_term.rb, line 104 def initialize(response_key) @response_key = response_key end
Public Instance Methods
translate(key,api_params,opts={})
click to toggle source
# File lib/execute/command/api_call/translation_term.rb, line 107 def translate(key,api_params,opts={}) unless last_result = opts[:last_result] raise ErrorUsage.new("PreviousResponse used before results computed") end match = nil unless matching_key = [@response_key.to_s,@response_key.to_sym].find{|k|last_result.has_key?(k)} raise ErrorUsage.new("Key #{@response_key} in PreviousResponse not found in last results (#{last_result.inspect})") end last_result[matching_key] end