/jargon-client

Jargon API Client

Primary LanguageRubyMIT LicenseMIT

jargon-client

Build Status

Ruby client library for Jargon's API. Inspired by cortex-client.

Constructor

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: 'user@name.com', password: '1234')

puts client.localizations(id).get
puts client.users(id).get

Localizations/Locales

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)

Result object

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

Supported Endpoints

  • Users - get, save
  • Localizations - query, get, save, delete
  • Locales - query, get, save, delete