Ruby client library for Jargon's API. Inspired by cortex-client.
require 'jargon-client'
client = Jargon::Client.new(access_token: 'access_token')
client.localizations.query.each do |localization|
puts localization
end
Alternatively, jargon-client will handle OAuth2 authentication (Password Credentials flow) for you:
require 'jargon-client'
client = Jargon::Client.new(key: 'my-app-id', secret: 'secrey-key-ssh', base_url: 'base_url', username: '[email protected]', password: '1234')
puts client.localizations(id).get
puts client.users(id).get
The Locale
resource does not work quite like the Localization
resource. In order to work with Locale, utilize the Locales
methods mixed into the Localization
class, so long as you have provided a Localization ID. Example:
client.localizations(id).query_locales
client.localizations(id).get_locale(locale_id)
Jargon::Client will return a Jargon::Result object. The following methods are available:
- contents
- is_error?
- errors
- page
- per_page
- total_items
- range
- range_start
- range_end
- raw_headers
- Users - get, save
- Localizations - query, get, save, delete
- Locales - query, get, save, delete