Ruby interface for the Lokalise APIv2 that represents returned data as Ruby objects.
View the Project on GitHub lokalise/ruby-lokalise-api
@client.keys(project_id, params = {}) # Input:
## project_id (string, required)
## params (hash)
### :page and :limit
# Output:
## Collection of keys available in the given project
For example:
@client.keys project_id, limit: 2, page: 3
@client.key(project_id, key_id, params = {}) # Input:
## project_id (string, required)
## key_id (string, required)
## params (hash)
### :disable_references (string) - possible values are "1" and "0".
# Output:
## Project key
For example:
@client.key project_id, 44_596_066, disable_references: 0
@client.create_keys(project_id, params) # Input:
## project_id (string, required)
## params (array of hashes or hash, required)
### :key_name (string or hash, required) - for projects with enabled per-platform key names, pass hash with "ios", "android", "web" and "other" params.
### :platforms (array) - supported values are "ios", "android", "web" and "other"
### Find all other supported attributes at https://developers.lokalise.com/reference/create-keys
# Output:
## Collection of newly created keys
For example:
@client.create_keys project_id, [{key_name: 'first_key', platforms: %w[ios]},
{
key_name: 'second_key',
platforms: %w[web],
translations: [{
"language_iso": "en",
"translation": "Welcome"
}]
}
]
@client.update_key(project_id, key_id, params = {}) # Input:
## project_id (string, required)
## key_id (string, required)
## params (hash)
### Find a list of supported attributes at https://developers.lokalise.com/reference/update-a-key
# Output:
## Updated key
Alternatively:
key = @client.key('project_id', 'key_id')
key.update(params)
For example:
@client.update_key project_id, key_id, key_name: 'updated_key_name', description: 'Demo description'
@client.update_keys(project_id, params) # Input:
## project_id (string, required)
## params (hash or array of hashes, required)
### :key_id (string, required)
### Find all other supported attributes at https://developers.lokalise.com/reference/bulk-update
# Output:
## Collection of updated keys
For example:
client.update_keys '123.abc', [
{
key_id: 456,
description: 'bulk updated'
},
{
key_id: 769,
tags: %w[bulk update]
}
]
@client.destroy_key(project_id, key_id) # Input:
## project_id (string, required)
## key_id (string, required)
# Output:
## Hash with project_id and "key_removed" set to "true"
Alternatively:
key = @client.key('project_id', 'key_id')
key.destroy
@client.destroy_keys(project_id, key_ids) # Input:
## project_id (string, required)
## key_ids (array, required)
# Output:
## Hash with project_id and "keys_removed" set to "true"
Alternatively:
keys = @client.keys('project_id')
keys.destroy_all # => will effectively destroy all keys in the project
For example:
@client.destroy_keys project_id, [1234, 5678]