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, #config, #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



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

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



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

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



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

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

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



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



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

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



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

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

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