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




Team user groups

Team user group attributes

Fetch team user groups

Doc

@client.team_user_groups(team_id, params = {})  # Input:
                                                ## team_id (string, required)
                                                ## params (hash)
                                                ### :page and :limit
                                                # Output:
                                                ## Collection of team user groups

For example:

@client.team_user_groups team_id, limit: 1, page: 2

Fetch a single group

Doc

@client.team_user_group(team_id, group_id)  # Input:
                                            ## team_id (string, required)
                                            ## group_id (string, required)
                                            # Output:
                                            ## Group

Create group

Doc

@client.create_team_user_group(team_id, params) # Input:
                                                ## team_id (string, required)
                                                ## params (hash, required):
                                                ### :name (string, required)
                                                ### :is_reviewer (boolean, required)
                                                ### :is_admin (boolean, required)
                                                ### :admin_rights (array) - required only if is_admin is true
                                                ### :languages (array of hashes) - required if is_admin is false
                                                # Output:
                                                ## Updated group

For example:

@client.create_team_user_group team_id, name: 'My group',
                                        is_reviewer: false,
                                        is_admin: false,
                                        languages: {
                                          reference: [123],
                                          contributable: [640]
                                        }

Update group

Doc

@client.update_team_user_group(team_id, group_id, params) # Input:
                                                          ## team_id (string, required)
                                                          ## group_id (string, required)
                                                          ## params (hash, required):
                                                          ### :name (string, required)
                                                          ### :is_reviewer (boolean, required)
                                                          ### :is_admin (boolean, required)
                                                          ### :admin_rights (array) - required only if is_admin is true
                                                          ### :languages (array of hashes) - required if is_admin is false
                                                          # Output:
                                                          ## Updated group

Alternatively:

group = @client.team_user_group('team_id', 'group_id')
group.update(params)

For example:

@client.update_team_user_group team_id, second_group_id,
                               name: 'Updated group',
                               is_admin: true,
                               is_reviewer: true

Add projects to group

Doc

@client.add_projects_to_group(team_id, group_id, project_ids) # Input:
                                                              ## team_id (string, required)
                                                              ## group_id (string, required)
                                                              ## project_ids (string or array, required) - project ids that you would like to add to this group

Alternatively:

group = @client.team_user_group('team_id', 'group_id')
group.add_projects projects: [project_id1, project_id2]

Remove projects from group

Doc

@client.remove_projects_from_group(team_id, group_id, project_ids)  # Input:
                                                                    ## team_id (string, required)
                                                                    ## group_id (string, required)
                                                                    ## project_ids (string or array, required) - project ids that you would like to remove from this group

Alternatively:

group = @client.team_user_group('team_id', 'group_id')
group.remove_projects projects: [project_id1, project_id2]

Add users to group

Doc

@client.add_users_to_group(team_id, group_id, user_ids) # Input:
                                                        ## team_id (string, required)
                                                        ## group_id (string, required)
                                                        ## user_ids (string or array, required) - user ids that you would like to add to this group

Alternatively:

group = @client.team_user_group('team_id', 'group_id')
group.add_users users: [user_id1, user_id2]

Remove users from group

Doc

@client.remove_users_from_group(team_id, group_id, user_ids)  # Input:
                                                              ## team_id (string, required)
                                                              ## group_id (string, required)
                                                              ## user_ids (string or array, required) - user ids that you would like to add to this group

Alternatively:

group = @client.team_user_group('team_id', 'group_id')
group.remove_users users: [user_id1, user_id2]

Destroy group

Doc

@client.destroy_team_user_group(team_id, group_id)  # Input:
                                                    ## team_id (string, required)
                                                    ## group_id (string, required)
                                                    # Output:
                                                    ## Hash with "team_id" and "group_deleted" set to "true"

Alternatively:

group = @client.team_user_group('team_id', 'group_id')
group.destroy