Class: Crowdkit::Client::Jobs
- Inherits:
-
API
- Object
- API
- Crowdkit::Client::Jobs
show all
- Defined in:
- lib/crowdkit/client/jobs.rb
Instance Attribute Summary
Attributes inherited from API
#auto_pagination, #client, #config, #stored_params
Instance Method Summary
collapse
Methods inherited from API
#arguments, extract_class_name, #id_key, #initialize, namespace, #set, #with
#agent, #method
Constructor Details
This class inherits a constructor from Crowdkit::API
Instance Method Details
#copy(*args) ⇒ Object
35
36
37
38
39
|
# File 'lib/crowdkit/client/jobs.rb', line 35
def copy(*args)
arguments(args, required: [:job_id])
do_post("jobs/#{job_id}/copy", query: arguments.params)
end
|
#create(*args) ⇒ Object
3
4
5
6
7
|
# File 'lib/crowdkit/client/jobs.rb', line 3
def create(*args)
arguments(args, required: [:title])
do_post("jobs", {title: title}.merge(arguments.params))
end
|
#get(*args) ⇒ Object
Also known as:
find
9
10
11
12
13
|
# File 'lib/crowdkit/client/jobs.rb', line 9
def get(*args)
arguments(args, required: [:job_id])
do_get("jobs/#{job_id}")
end
|
#order(*args) ⇒ Object
41
42
43
44
45
|
# File 'lib/crowdkit/client/jobs.rb', line 41
def order(*args)
arguments(args, required: [:job_id])
do_post("jobs/#{job_id}/order", query: arguments.params)
end
|
#search(*args) ⇒ Object
Also known as:
list, all
16
17
18
19
20
21
22
23
24
|
# File 'lib/crowdkit/client/jobs.rb', line 16
def search(*args)
arguments(args)
params = arguments.params
params[:query] = args.first if args.first.is_a?(String)
response = do_get("jobs", query: arguments.params)
return response unless block_given?
response.each { |el| yield el }
end
|
#upload(*args) ⇒ Object
47
48
49
50
51
52
|
# File 'lib/crowdkit/client/jobs.rb', line 47
def upload(*args)
arguments(args, required: [:job_id]) do
@params = args.last.read if args.last.is_a?(File)
end
do_put("jobs/#{job_id}/upload", arguments.params, headers: {'Content-Type' => 'text/csv'})
end
|