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 users

Fetch team users

Doc

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

For example:

team_id = '1234'
params = {
  limit: 1,
  page: 3
}

users = @client.team_users team_id, params

users[0].user_id # => 5678

Fetch a single team user

Doc

@client.team_user(team_id, user_id) # Input:
                                    ## team_id (string, required)
                                    ## user_id (string, required)
                                    # Output:
                                    ## Team user

For example:

team_id = '1234'
user_id = '6789'

user = @client.team_user team_id, user_id

user.fullname # => 'John Doe'

Update team user

Doc

@client.update_team_user(team_id, user_id, params)  # Input:
                                                    ## team_id (string, required)
                                                    ## user_id (string, required)
                                                    ## params (hash, required):
                                                    ### :role (string, required) - :owner, :admin, or :member
                                                    # Output:
                                                    ## Updated team user

For example:

params = {
  role: 'admin'
}

user = @client.update_team_user team_id, team_user_id, params

user.role # => 'admin'

Alternatively:

user = @client.team_user team_id, user_id
user.update params

Delete team user

Doc

@client.destroy_team_user(team_id, user_id) # Input:
                                            ## team_id (string, required)
                                            ## user_id (string, required)
                                            # Output:
                                            ## Generic with "team_id" and "team_user_deleted" set to "true"

For example:

response = @client.destroy_team_user team_id, user_id
response.team_user_deleted # => true

Alternatively:

user = @client.team_user team_id, user_id
response = user.destroy