Module: RubyLokaliseApi::Rest::Tasks

Included in:
RubyLokaliseApi::Rest
Defined in:
lib/ruby_lokalise_api/rest/tasks.rb

Instance Method Summary collapse

Instance Method Details

#create_task(project_id, req_params) ⇒ RubyLokaliseApi::Resources::Task

Creates a new task

Parameters:

  • project_id (String)
  • req_params (Hash, Array)

Returns:

See Also:



42
43
44
45
46
47
48
# File 'lib/ruby_lokalise_api/rest/tasks.rb', line 42

def create_task(project_id, req_params)
  params = { query: project_id, req: req_params }

  data = endpoint(name: 'Tasks', params: params).do_post

  resource 'Task', data
end

#destroy_task(project_id, task_id) ⇒ RubyLokaliseApi::Generics::DeletedResource

Deletes a task

Parameters:

  • project_id (String)
  • task_id (String, Integer)

Returns:

See Also:



71
72
73
74
75
76
77
# File 'lib/ruby_lokalise_api/rest/tasks.rb', line 71

def destroy_task(project_id, task_id)
  params = { query: [project_id, task_id] }

  data = endpoint(name: 'Tasks', params: params).do_delete

  RubyLokaliseApi::Generics::DeletedResource.new data.content
end

#task(project_id, task_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Task

Returns a single task

Parameters:

  • project_id (String)
  • task_id (String, Integer)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



28
29
30
31
32
33
34
# File 'lib/ruby_lokalise_api/rest/tasks.rb', line 28

def task(project_id, task_id, req_params = {})
  params = { query: [project_id, task_id], req: req_params }

  data = endpoint(name: 'Tasks', params: params).do_get

  resource 'Task', data
end

#tasks(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Tasks

Returns project tasks

Parameters:

  • project_id (String)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



12
13
14
15
16
17
18
19
# File 'lib/ruby_lokalise_api/rest/tasks.rb', line 12

def tasks(project_id, req_params = {})
  name = 'Tasks'
  params = { query: project_id, req: req_params }

  data = endpoint(name: name, params: params).do_get

  collection name, data
end

#update_task(project_id, task_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Task

Updates a task

Parameters:

  • project_id (String)
  • task_id (String, Integer)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



57
58
59
60
61
62
63
# File 'lib/ruby_lokalise_api/rest/tasks.rb', line 57

def update_task(project_id, task_id, req_params = {})
  params = { query: [project_id, task_id], req: req_params }

  data = endpoint(name: 'Tasks', params: params).do_put

  resource 'Task', data
end