Class: Voicearchive::TaskClient

Inherits:
Client
  • Object
show all
Defined in:
lib/voicearchive/task_client.rb

Instance Attribute Summary

Attributes inherited from Client

#api_key, #version

Instance Method Summary collapse

Methods inherited from Client

#call, #initialize, #set_simple_endpoint_default_values

Constructor Details

This class inherits a constructor from Voicearchive::Client

Instance Method Details

#count_tasks(options = {}) ⇒ Object



43
44
45
46
47
48
# File 'lib/voicearchive/task_client.rb', line 43

def count_tasks(options = {})
  options[:count] = true
  response = call("task", options, 'get')

  JSON.parse(response.body)["count"].to_i
end

#create_retake(task_id, reason_id, params = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/voicearchive/task_client.rb', line 14

def create_retake(task_id, reason_id, params = {})
  response = call("task/#{task_id}/create-retake", params.merge({
    reasonId: reason_id
  }), 'put');

  JSON.parse(response.body)
end

#get_task(task_id) ⇒ Object



22
23
24
25
# File 'lib/voicearchive/task_client.rb', line 22

def get_task(task_id)
  response = call("ordertask/#{task_id}")
  JSON.parse(response.body)
end

#get_tasks(search_options, options) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/voicearchive/task_client.rb', line 27

def get_tasks(search_options, options)
  response = call('ordertask', options.merge({
    search: search_options,
  }), 'get')

  JSON.parse(response.body)
end

#search_tasks(search_options, options) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/voicearchive/task_client.rb', line 35

def search_tasks(search_options, options)
  response = call('ordertask/search', options.merge({
    search: search_options,
  }), 'post')

  JSON.parse(response.body)
end

#set_supplier_on_task(task_id, supplier_id) ⇒ Object



4
5
6
7
# File 'lib/voicearchive/task_client.rb', line 4

def set_supplier_on_task(task_id, supplier_id)
  response = call("task/#{task_id}/SetSupplier", {:supplierId=>supplier_id}, 'put')
  JSON.parse(response.body)
end

#set_task_data(task_id, supplier_id, comments, script) ⇒ Object



9
10
11
12
# File 'lib/voicearchive/task_client.rb', line 9

def set_task_data(task_id, supplier_id, comments, script)
  response = call("task/#{task_id}/SetTaskData", {:supplierId=>supplier_id, :comments=>comments, :script=>script}, 'put')
  JSON.parse(response.body)
end