Ruby interface for the Lokalise APIv2 that represents returned data as Ruby objects.
View the Project on GitHub lokalise/ruby-lokalise-api
@client.glossary_terms(project_id, params = {}) # Input:
## project_id (string, required)
## params (hash)
### :cursor and :limit
# Output:
## Collection of glossary terms in the given project
For example:
cursor_params = {
limit: 2,
cursor: '5319746'
}
glossary_terms = @client.glossary_terms project_id, cursor_params
glossary_terms.next_cursor # => 12345
glossary_term = glossary_terms[0]
glossary_term.term # => 'sample'
@client.glossary_term(project_id, term_id) # Input:
## project_id (string, required)
## term_id (string or number, required)
# Output:
## Glossary term resource
For example:
glossary_term = @client.glossary_term project_id, 1234
glossary_term.term # => 'router'
glossary_term.description # => 'A network device'
@client.create_glossary_terms(project_id, params) # Input:
## project_id (string, required)
## params (array of hashes or hash, required)
# Output:
## Collection of newly created terms
For example:
terms_data = [
{
term: 'term 1',
description: 'my term',
caseSensitive: false,
translatable: false,
forbidden: false
},
{
term: 'term 2',
description: 'my term 2',
caseSensitive: true,
translatable: true,
forbidden: false
}
]
glossary_terms = @client.create_glossary_terms project_id, terms_data
term = glossary_terms[0]
expect(term.description).to eq('my term')
@client.update_glossary_terms(project_id, params) # Input:
## project_id (string, required)
## params (hash or array of hashes, required)
# Output:
## Collection of updated keys
For example:
terms_data = [
{
id: 5_517_075,
term: 'updated term'
},
{
id: 5_517_076,
description: 'updated desc'
}
]
glossary_terms = @client.update_glossary_terms project_id, terms_data
glossary_term = glossary_terms[0]
expect(glossary_term.term).to eq('updated term')
@client.destroy_glossary_terms(project_id, term_ids) # Input:
## project_id (string, required)
## term_ids (array, required)
# Output:
## Generic with deletion information
For example:
term_ids = %w[5517075 5517076]
resp = @client.destroy_glossary_terms project_id, term_ids
resp.data['deleted']['count'] # => 2