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



59
60
61
# File 'lib/monkeylearn/workflows.rb', line 59

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

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



63
64
65
66
67
68
69
70
71
# File 'lib/monkeylearn/workflows.rb', line 63

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