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, #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
42
43
44
45
46
|
# File 'lib/crowdkit/client/jobs.rb', line 42
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, show
15
16
17
18
19
|
# File 'lib/crowdkit/client/jobs.rb', line 15
def get(*args)
arguments(args, required: [:job_id])
do_get("jobs/#{job_id}")
end
|
#order(*args) ⇒ Object
48
49
50
51
52
|
# File 'lib/crowdkit/client/jobs.rb', line 48
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
23
24
25
26
27
28
29
30
31
|
# File 'lib/crowdkit/client/jobs.rb', line 23
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
|
#update(*args) ⇒ Object
9
10
11
12
13
|
# File 'lib/crowdkit/client/jobs.rb', line 9
def update(*args)
arguments(args, required: [:job_id])
do_patch("jobs/#{job_id}", arguments.params)
end
|
#upload(*args) ⇒ Object
54
55
56
57
58
59
|
# File 'lib/crowdkit/client/jobs.rb', line 54
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
|