Module: Monkeylearn::Workflows

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(*args) ⇒ Object



27
28
29
# File 'lib/monkeylearn/workflows.rb', line 27

def build_endpoint(*args)
  File.join('workflows', *args) + '/'
end

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



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/monkeylearn/workflows.rb', line 31

def create(name, options = {})
  if options[:db_name]
    warn 'Note: db_name parameter is ignored by the API and will be removed soon'
  end

  data = {
      name: name,
      description: options[:description],
      webhook_url: options[:webhook_url],
      steps: options[:steps],
      custom_fields: options[:custom_fields],
      sources: options[:sources],
      actions: options[:actions],
  }.delete_if { |k,v| v.nil? }
  request(:post, build_endpoint, data)
end

.custom_fieldsObject



23
24
25
# File 'lib/monkeylearn/workflows.rb', line 23

def custom_fields
  return WorkflowCustomFields
end

.dataObject



19
20
21
# File 'lib/monkeylearn/workflows.rb', line 19

def data
  return WorkflowData
end

.delete(module_id) ⇒ Object



52
53
54
# File 'lib/monkeylearn/workflows.rb', line 52

def delete(module_id)
  request(:delete, build_endpoint(module_id))
end

.detail(module_id) ⇒ Object



48
49
50
# File 'lib/monkeylearn/workflows.rb', line 48

def detail(module_id)
  request(:get, build_endpoint(module_id))
end

.stepsObject



15
16
17
# File 'lib/monkeylearn/workflows.rb', line 15

def steps
  return WorkflowSteps
end