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




Contributors

Fetch contributors

Doc

@client.contributors(project_id, params = {})   # Input:
                                                ## project_id (string, required)
                                                ## params (hash)
                                                ### :page and :limit
                                                # Output:
                                                ## Collection of contributors in the given project

For example:

@client.contributors project_id, limit: 1, page: 2

Fetch a single contributor

Doc

@client.contributor(project_id, contributor_id)   # Input:
                                                  ## project_id (string, required)
                                                  ## contributor_id (string, required) - named as "user_id" in the response
                                                  # Output:
                                                  ## Contributor in the given project

Create contributors

Doc

@client.create_contributors(project_id, params)  # Input:
                                                 ## project_id (string, required)
                                                 ## params (array of hashes or hash, required) - parameters for the newly created contributors. Pass array of hashes to create multiple contributors, or a hash to create a single contributor
                                                 ### :email (string, required)
                                                 ### :fullname (string)
                                                 ### :is_admin (boolean)
                                                 ### :is_reviewer (boolean)
                                                 ### :languages (array of hashes, required if "is_admin" set to false) - possible languages attributes:
                                                 #### :lang_iso (string, required)
                                                 #### :is_writable (boolean)
                                                 ### :admin_rights (array)
                                                 # Output:
                                                 ## Collection of newly created contributors

For example:

@client.create_contributors project_id,
                            email: 'rspec@test.com',
                            fullname: 'Rspec test',
                            languages: [{
                              lang_iso: 'en'
                            },
                            {
                              lang_iso: 'ru'
                            }]

Update contributor

Doc

@client.update_contributor(project_id, contributor_id, params)   # Input:
                                                                 ## project_id (string, required)
                                                                 ## contributor_id (string, required)
                                                                 ## params (hash, required)
                                                                 ### :is_admin (boolean)
                                                                 ### :is_reviewer (boolean)
                                                                 ### :languages (array of hashes) - possible languages attributes:
                                                                 #### :lang_iso (string, required)
                                                                 #### :is_writable (boolean)
                                                                 ### :admin_rights (array)
                                                                 # Output:
                                                                 ## Updated contributor

Alternatively:

contributor = @client.contributor('project_id', 'contributor_id')
contributor.update(params)

For example:

@client.update_contributor project_id, contributor_id, languages: [{lang_iso: 'en'}]

Delete contributor

Doc

@client.destroy_contributor(project_id, contributor_id)    # Input:
                                                           ## project_id (string, required)
                                                           ## contributor_id (string, required)
                                                           # Output:
                                                           ## Hash with the project's id and "contributor_deleted"=>true

Alternatively:

contributor = @client.contributor('project_id', 'id')
contributor.destroy