Module: Monkeylearn::WorkflowCustomFields

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



82
83
84
# File 'lib/monkeylearn/workflows.rb', line 82

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

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



86
87
88
89
90
91
92
# File 'lib/monkeylearn/workflows.rb', line 86

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