Class: Crowdkit::Client::Units

Inherits:
API
  • Object
show all
Defined in:
lib/crowdkit/client/units.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, #initialize, namespace, #set, #with

Methods included from API::RequestMethods

#agent, #method

Constructor Details

This class inherits a constructor from Crowdkit::API

Instance Method Details

#copy(*args) ⇒ Object



30
31
32
33
34
# File 'lib/crowdkit/client/units.rb', line 30

def copy(*args)
  arguments(args, required: [:unit_id, :destination_job_id])

  do_post("units/#{unit_id}/copy", query: {destination_job_id: destination_job_id})
end

#create(*args) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/crowdkit/client/units.rb', line 22

def create(*args)
  arguments(args, required: [:job_id]) do
    @params = args.last if args.last.is_a?(Array)
  end

  do_post("jobs/#{job_id}/units", arguments.params)
end

#delete(*args) ⇒ Object



36
37
38
39
# File 'lib/crowdkit/client/units.rb', line 36

def delete(*args)
  arguments(args, required: [:unit_id])
  do_delete("units/#{unit_id}")
end

#get(*args) ⇒ Object Also known as: find, show



7
8
9
10
11
# File 'lib/crowdkit/client/units.rb', line 7

def get(*args)
  arguments(args, required: [:unit_id])

  do_get("units/#{unit_id}")
end

#id_keyObject



3
4
5
# File 'lib/crowdkit/client/units.rb', line 3

def id_key
  :unit_id
end

#judgments(*args) ⇒ Object



41
42
43
44
# File 'lib/crowdkit/client/units.rb', line 41

def judgments(*args)
  arguments(args, required: [:unit_id])
  do_get("units/#{unit_id}/judgments", query: arguments.params)
end

#list(*args) ⇒ Object Also known as: all



15
16
17
18
19
# File 'lib/crowdkit/client/units.rb', line 15

def list(*args)
  arguments(args, required: [:job_id])

  do_get("jobs/#{job_id}/units", arguments.params)
end