Lokalise APIv2 Ruby SDK

Ruby interface for the Lokalise APIv2 that represents returned data as Ruby objects.

View the Project on GitHub lokalise/ruby-lokalise-api




Tasks

Task attributes

Fetch tasks

Doc

@client.tasks(project_id, params = {})  # Input:
                                        ## project_id (string, required)
                                        ## params (hash)
                                        ### :filter_title (string) - set title filter for the list
                                        ### :page and :limit
                                        # Output:
                                        ## Collection of tasks for the project

For example:

@client.tasks project_id, limit: 2, page: 2

Fetch a single task

Doc

@client.task(project_id, task_id)  # Input:
                                   ## project_id (string, required)
                                   ## task_id (string, required)
                                   # Output:
                                   ## Single task for the project

Create task

Doc

@client.create_task(project_id, params)  # Input:
                                         ## project_id (string, required)
                                         ## params (hash, required)
                                         ### title (string, required)
                                         ### keys (array) - translation key ids. Required if "parent_task_id" is not specified
                                         ### languages (array of hashes, required)
                                         #### language_iso (string)
                                         #### users (array) - list of users identifiers, assigned to work on the language
                                         ### Find other supported options at https://app.lokalise.com/api2docs/curl/#transition-create-a-task-post
                                         # Output:
                                         ## A newly created task

For example:

@client.create_task project_id, title: 'My first task',
                                keys: [1234, 5678],
                                languages: [
                                  {
                                    language_iso: 'ru',
                                    users: ['20181']
                                  }
                                ]

Update task

Doc

@client.update_task(project_id, task_id, params = {})  # Input:
                                                       ## project_id (string, required)
                                                       ## task_id (string or integer, required)
                                                       ## params (hash)
                                                       ### Find supported params at https://app.lokalise.com/api2docs/curl/#transition-update-a-task-put
                                                       # Output:
                                                       ## An updated task

Alternatively:

task = @client.task('project_id', 'task_id')
task.update(params)

For example:

@client.update_task project_id, task_id, description: 'Updated task', auto_close_task: true

Delete task

Doc

@client.destroy_task(project_id, task_id)  # Input:
                                           ## project_id (string, required)
                                           ## task_id (string, required)
                                           # Output:
                                           ## Hash with the project id and "task_deleted" set to "true"

Alternatively:

task = @client.task('project_id', 'task_id')
task.destroy