Class: DatagroutConduit::FlowNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/datagrout_conduit/namespaces/flow.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ FlowNamespace

Returns a new instance of FlowNamespace.



5
6
7
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#details(execution_id:) ⇒ Object



49
50
51
52
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 49

def details(execution_id:)
  params = { "execution_id" => execution_id }
  dg_call("inspect.execution-details", "data-grout/inspect.execution-details", params)
end

#history(limit: 50, offset: 0, status: nil, refractions_only: false, **opts) ⇒ Object



43
44
45
46
47
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 43

def history(limit: 50, offset: 0, status: nil, refractions_only: false, **opts)
  params = { "limit" => limit, "offset" => offset, "refractions_only" => refractions_only }.merge(@client.send(:normalize_hash, opts))
  params["status"] = status if status
  dg_call("inspect.execution-history", "data-grout/inspect.execution-history", params)
end

#request_approval(action:, details: nil, reason: nil, context: nil, **opts) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 27

def request_approval(action:, details: nil, reason: nil, context: nil, **opts)
  params = { "action" => action }.merge(@client.send(:normalize_hash, opts))
  params["details"] = details if details
  params["reason"] = reason if reason
  params["context"] = context if context
  dg_call("flow.request-approval", "data-grout/flow.request-approval", params)
end

#request_feedback(missing_fields:, reason:, current_data: nil, suggestions: nil, context: nil, **opts) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 35

def request_feedback(missing_fields:, reason:, current_data: nil, suggestions: nil, context: nil, **opts)
  params = { "missing_fields" => missing_fields, "reason" => reason }.merge(@client.send(:normalize_hash, opts))
  params["current_data"] = current_data if current_data
  params["suggestions"] = suggestions if suggestions
  params["context"] = context if context
  dg_call("flow.request-feedback", "data-grout/flow.request-feedback", params)
end

#route(branches:, payload: nil, cache_ref: nil, else_target: nil, **opts) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 19

def route(branches:, payload: nil, cache_ref: nil, else_target: nil, **opts)
  params = { "branches" => branches }
  params["payload"] = payload if payload
  params["cache_ref"] = cache_ref if cache_ref
  params["else"] = else_target if else_target
  dg_call("flow.route", "data-grout/flow.route", @client.send(:normalize_hash, opts).merge(params))
end

#run(plan, validate_ctc: true, save_as_skill: false, input_data: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/datagrout_conduit/namespaces/flow.rb', line 9

def run(plan, validate_ctc: true, save_as_skill: false, input_data: nil)
  params = {
    "plan" => plan,
    "validate_ctc" => validate_ctc,
    "save_as_skill" => save_as_skill
  }
  params["input_data"] = input_data if input_data
  dg_call("flow.into", "data-grout/flow.into", params)
end