Module: Monkeylearn::WorkflowData
- 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
97
98
99
|
# File 'lib/monkeylearn/workflows.rb', line 97
def build_endpoint(module_id, *args)
File.join('workflows', module_id, 'data', *args.collect { |x| x.to_s }) + '/'
end
|
.create(module_id, options = {}) ⇒ Object
101
102
103
104
105
106
|
# File 'lib/monkeylearn/workflows.rb', line 101
def create(module_id, options = {})
data = {
data: options[:data],
}.delete_if { |k,v| v.nil? }
request(:post, build_endpoint(module_id), data)
end
|
.list(module_id, options = {}) ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/monkeylearn/workflows.rb', line 108
def list(module_id, options = {})
query_params = {
batch_id: options[:batch_id],
is_processed: options[:is_processed],
sent_to_process_date_from: options[:sent_to_process_date_from],
sent_to_process_date_to: options[:sent_to_process_date_to],
page: options[:page],
per_page: options[:per_page],
}.delete_if { |k,v| v.nil? }
request(:get, build_endpoint(module_id), nil, query_params)
end
|