Module: Monkeylearn::WorkflowSteps

Extended by:
Requests
Defined in:
lib/monkeylearn/workflows.rb

Class Method Summary collapse

Methods included from Requests

get_connection, get_exception_class, raise_for_status, request, throttled?

Class Method Details

.build_endpoint(module_id, *args) ⇒ Object



62
63
64
# File 'lib/monkeylearn/workflows.rb', line 62

def build_endpoint(module_id, *args)
  File.join('workflows', module_id, 'steps', *args.collect { |x| x.to_s }) + '/'
end

.create(module_id, options = {}) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/monkeylearn/workflows.rb', line 66

def create(module_id, options = {})
  data = {
      name: options[:name],
      model_id: options[:step_model_id],
      input_step: options[:input_step],
      conditions: options[:conditions],
  }.delete_if { |k,v| v.nil? }
  request(:post, build_endpoint(module_id), data)
end