Module: RuleInterface::RuleExecutor

Included in:
RuleInterface
Defined in:
lib/rule-interface/rule_executor.rb

Instance Method Summary collapse

Instance Method Details

#execute!(data_hash:, container:, package:, namespace: nil, session: 'session') ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/rule-interface/rule_executor.rb', line 3

def execute!(data_hash:, container:, package:, namespace: nil, session: 'session')
  payload = Converter.hash_to_drool(data_hash: data_hash, namespace: namespace, package: package, session: session)
  response = parsed_connection!(container: container, method: "post", payload: payload)
  if response[:type] && response[:type] == "SUCCESS"
    Converter.drool_to_hash(
      response_data: response[:result][:'execution-results'][:results]
    )
  else
    raise Error::CommonError, response[:msg]
  end
end