Lokalise APIv2 Ruby SDK

Ruby interface for the Lokalise APIv2 that represents returned data as Ruby objects.

View the Project on GitHub lokalise/ruby-lokalise-api




Translation orders

Fetch orders

Doc

@client.orders(team_id, params = {})  # Input:
                                      ## team_id (integer, string, required)
                                      ## params (hash)
                                      ### :page and :limit
                                      # Output:
                                      ## Collection of orders for the given team

For example:

team_id = '1234'

orders = @client.orders team_id, limit: 3, page: 1

orders[0].order_id # => '201903198B2'

Fetch a single order

Doc

@client.order(team_id, order_id)  # Input:
                                  ## team_id (string, integer, required)
                                  ## order_id (string, required)
                                  # Output:
                                  ## A single order

For example:

team_id = '1234'
order_id = '201903198B2'

order = @client.order team_id, order_id

order.status # => 'completed'

Create an order

Doc

@client.create_order(team_id, params)  # Input:
                                       ## team_id (string, integer, required)
                                       ## params (hash, required)
                                       ### project_id (string, required)
                                       ### card_id (integer, string, required) - card to process payment
                                       ### briefing (string, required)
                                       ### source_language_iso (string, required)
                                       ### target_language_isos (array of strings, required)
                                       ### keys (array of integers, required) - keys to include in the order
                                       ### provider_slug (string, required)
                                       ### translation_tier (integer, required)
                                       ### dry_run (boolean) - return the response without actually placing an order. Useful for price estimation. Default is `false`
                                       ### translation_style (string) - only for gengo provider. Available values are `formal`, `informal`, `business`, `friendly`. Defaults to `friendly`.
                                       # Output:
                                       ## A newly created order

For example:

params = {
  project_id: '963054665b7c313dd9b323.35886655',
  card_id: 1774,
  briefing: 'Some briefing',
  source_language_iso: 'en',
  target_language_isos: %w[fr],
  keys: [1234, 4567],
  provider_slug: 'gengo',
  translation_tier: 1,
  dry_run: true,
  translation_style: 'friendly'
}

order = @client.create_order team_id, params

order.provider_slug # => 'gengo'
order.total # => 123.45