class DTK::Client::Execute::Command::APICall::Map
Public Class Methods
new(hash={})
click to toggle source
Calls superclass method
# File lib/execute/command/api_call/map.rb, line 21 def initialize(hash={}) super() replace(hash) end
Public Instance Methods
translate(api_params={},opts={})
click to toggle source
# File lib/execute/command/api_call/map.rb, line 26 def translate(api_params={},opts={}) if Rest::Post.matches?(type()) Command::RestCall::Post.new(:path => path(),:body => translate_to_rest_body(api_params,opts)) else raise "Type in following map is not defined not defined: #{self.inspect}" end end
Private Instance Methods
body()
click to toggle source
# File lib/execute/command/api_call/map.rb, line 54 def body() self[:body] end
path()
click to toggle source
# File lib/execute/command/api_call/map.rb, line 51 def path() self[:path] end
translate_to_rest_body(api_params,opts)
click to toggle source
# File lib/execute/command/api_call/map.rb, line 35 def translate_to_rest_body(api_params,opts) body().inject(Hash.new) do |h,(k,v)| # if TranslationTerm.matches is false then v is a constant processed_v = if TranslationTerm.matches?(v) v.instance_form().translate(k,api_params,opts) else v end h.merge(k => processed_v) end end
type()
click to toggle source
# File lib/execute/command/api_call/map.rb, line 48 def type() self[:type] end