Ruby interface for the Lokalise APIv2 that represents returned data as Ruby objects.
View the Project on GitHub lokalise/ruby-lokalise-api
@client.screenshots(project_id, params = {}) # Input:
## project_id (string, required)
## params (hash)
### :page and :limit
# Output:
## Collection of project screenshots
For example:
project_id = '123.abc'
params = {
limit: 3,
page: 1
}
screenshots = @client.screenshots project_id, params
screenshots[0].screenshot_id # => 1234
Alternatively:
project = @client.project project_id
screenshots = project.screenshots params
@client.screeshot(project_id, screeshot_id) # Input:
## project_id (string, required)
## screeshot_id (string, required)
# Output:
## A single screenshot
For example:
project_id = '123.abc'
screenshot_id = '1234'
screenshot = @client.screenshot project_id, screenshot_id
screenshot.keys[0]['key_id'] # => 6789
screenshot.width # => 572
Alternatively:
project = @client.project project_id
screenshot = project.screenshot screenshot_id
@client.create_screenshots(project_id, params) # Input:
## project_id (string, required)
## params (hash or array of hashes, required)
### :data (string, required) - the actual screenshot, base64-encoded (with leading image type "data:image/jpeg;base64,"). JPG and PNG formats are supported.
### :title (string)
### :description (string)
### :ocr (boolean) - recognize translations on the image and attach screenshot to all possible keys
### :key_ids (array) - attach the screenshot to key IDs specified
### :tags (array)
# Output:
## Collection of created screenshots
For example:
params = {
data: 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAA...',
title: 'My screen'
}
screenshots = @client.create_screenshots project_id, params
screenshots[0].title # => 'My screen'
Alternatively:
project = @client.project project_id
screenshots = project.create_screenshots params
@client.update_screenshot(project_id, screenshot_id, params = {}) # Input:
## project_id (string, required)
## screenshot_id (string, required)
## params (hash)
### :title (string)
### :description (string)
### :key_ids (array) - attach the screenshot to key IDs specified
### :tags (array)
# Output:
## Updated screenshot
For example:
params = {
tags: %w[demo sample],
description: 'Sample screen'
}
screenshot = @client.update_screenshot project_id, screenshot_id, params
screenshot.tags # => ['demo', 'sample']
Alternatively:
screenshot = @client.screenshot project_id, screenshot_id
screenshot.update params
# OR
project = @client.project project_id
screenshot = project.update_screenshot screenshot_id, params
@client.destroy_screenshot(project_id, screenshot_id) # Input:
## project_id (string, required)
## screenshot_id (string, required)
# Output:
## Generic with the project id and "screenshot_deleted" set to "true"
For example:
response = @client.destroy_screenshot project_id, screen_id
response.screenshot_deleted # => true
Alternatively:
screenshot = @client.screenshot project_id, screen_id
response = screenshot.destroy
# OR
project = @client.project project_id
response = project.destroy_screenshot screen_id