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
# File 'lib/monkeylearn/workflows.rb', line 31

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

.dataObject



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

def data
  return WorkflowData
end

.delete(module_id) ⇒ Object



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

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

.detail(module_id) ⇒ Object



45
46
47
# File 'lib/monkeylearn/workflows.rb', line 45

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

.metadataObject



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

def 
  return WorkflowMetadata
end

.stepsObject



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

def steps
  return WorkflowSteps
end