New feature: added ability to access resources’ attributes with the
 notation. In other words, previously you could only write:
Now you can also write:
This feature was introduced so that all resources can play nicely with methods like
Lokalisemain module to
RubyLokaliseApiand changed the way you require the gem. You can use find-replace to fix all occurences. For example, if previously you wrote:
require 'ruby-lokalise-api' @client = Lokalise.client 'YOUR_TOKEN_HERE'
Now you should say:
require 'ruby_lokalise_api' @client = RubyLokaliseApi.client 'YOUR_TOKEN_HERE'
enable_compressionoption. Compression is now enabled for all requests (however the API might still send uncompressed data if the body is small) and the response will be decompressed automatically.
auth_client = RubyLokaliseApi.auth_client 'OAUTH2_CLIENT_ID', 'OAUTH2_CLIENT_SECRET' # Generate authentication URL: url = auth_client.auth scope: %w[read_projects write_tasks] # Generate a new token: response = auth_client.token 'secret code' access_token = response['access_token'] refresh_token = response['refresh_token'] # Refresh an expired token: response = auth_client.refresh('YOUR_REFRESH_TOKEN')['access_token'] # Use the access token to perform requests on the user's behalf: @client = RubyLokaliseApi.oauth2_client access_token @client.projects # list user's projects
client(issues with multithreading)
.oauth_clientmethod for the
Lokalisemodule. This method must be used when you’re initializing a new API client with a token obtained via OAuth 2 flow, not by copy-pasting the token from the “Personal profile” section on Lokalise website. So in this case instead of saying
RubyLokaliseApi.client, you should do the following:
@client = RubyLokaliseApi.oauth_client("TOKEN_OBTAINED_VIA_OAUTH2", params)
paramsare the same as for the
.reset_oauth_client!method for the
Lokalisemodule to reset the currently set
RubyLokaliseApi.reset_oauth_client! # effectively sets the `@oauth_client` to `nil`
client = RubyLokaliseApi.client('YOUR_TOKEN', enable_compression: true)
task_idattribute for the
auto_close_itemsattribute for the
queueparameter doesn’t have any effect anymore. Therefore, removed all code and docs related to sync uploading.
queued_process = @client.upload_file project_id, data: 'Base-64 encoded data... ZnI6DQogI...', filename: 'my_file.yml', lang_iso: 'en' queued_process.status # => 'queued' # ...after some time... queued_process = queued_process.reload_data queued_process.status # => 'finished'
reload_datamethod which fetches new data from the API
client.merge_branch project_id, branch_id, params
:open_timeoutoptions for the client to customize request timeouts
DELETErequests with bodies. It seems like Faraday team decided to abandon the idea of writing delete request one-liners, so we’ll stick with another approach
#deleteinterface methods to