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




Projects

Fetch projects

Doc

@client.projects(params = {})   # Input:
                                ## params (hash)
                                ### :filter_team_id (string) - load projects only for the given team
                                ### :page and :limit
                                # Output:
                                ## Collection of projects under the `projects` attribute

For example:

@client.projects limit: 1, page: 2

Fetch a single project

Doc

@client.project(project_id)     # Input:
                                ## project_id (string, required)
                                # Output:
                                ## A single project

Create a project

Doc

@client.create_project(params)  # Input:
                                ## params (hash, required)
                                ### name (string, required)
                                ### description (string)
                                ### team_id (integer) - you must be an admin of the chosen team. When omitted, defaults to the current team of the token's owner
                                # Output:
                                ## A newly created project

For example:

@client.create_project name: 'Demo project', description: 'My first project'

Update a project

Doc

@client.update_project(project_id, params)  # Input:
                                            ## project_id (string, required)
                                            ## params (hash, required)
                                            ### name (string, required)
                                            ### description (string)
                                            # Output:
                                            ## An updated project

Alternatively:

project = @client.project('project_id')
project.update(params)

For example:

@client.update_project new_project_id,
                       name: 'Updated project name',
                       description: 'Updated project desc'

Empty a project

Doc

Deletes all keys and translations from the project.

@client.empty_project(project_id)   # Input:
                                    ## project_id (string, required)
                                    # Output:
                                    ## A project containing its id and a `keys_deleted => true` attribute

Alternatively:

project = @client.project('project_id')
project.empty

Delete a project

Doc

@client.destroy_project(project_id)   # Input:
                                      ## project_id (string, required)
                                      # Output:
                                      ## A project containing its id and a `project_deleted => true` attribute

Alternatively:

project = @client.project('project_id')
project.destroy