class Lokalise::Client

Attributes

enable_compression[RW]
open_timeout[RW]
timeout[RW]
token[R]

Public Class Methods

new(token, params = {}) click to toggle source
# File lib/ruby-lokalise-api/client.rb, line 29
def initialize(token, params = {})
  @token = token
  @timeout = params.fetch(:timeout, nil)
  @open_timeout = params.fetch(:open_timeout, nil)
  @enable_compression = params.fetch(:enable_compression, false)
end

Public Instance Methods

add_projects_to_group(team_id, group_id, project_ids) click to toggle source

Adds projects to the given group

@see lokalise.co/api2docs/curl/#transition-add-projects-to-group-put @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer] @param project_ids [String, Integer, Array<String>, Array<Integer>]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 62
def add_projects_to_group(team_id, group_id, project_ids)
  c_r Lokalise::Resources::TeamUserGroup, :update,
      [team_id, group_id, 'projects', 'add'],
      project_ids, :projects, [team_id, group_id]
end
add_users_to_group(team_id, group_id, users_ids) click to toggle source

Adds users to the given group

@see lokalise.co/api2docs/curl/#transition-add-members-to-group-put @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer] @param users_ids [String, Integer, Array<String>, Array<Integer>]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 88
def add_users_to_group(team_id, group_id, users_ids)
  c_r Lokalise::Resources::TeamUserGroup, :update,
      [team_id, group_id, 'members', 'add'],
      users_ids, :users, [team_id, group_id]
end
branch(project_id, branch_id) click to toggle source

Returns a single branch for the given project

@see lokalise.com/api2docs/curl/#transition-retrieve-a-branch-get @return [Lokalise::Resources::Branch] @param project_id [String] @param branch_id [String, Integer]

# File lib/ruby-lokalise-api/rest/branches.rb, line 31
def branch(project_id, branch_id)
  c_r Lokalise::Resources::Branch, :find, [project_id, branch_id]
end
branches(project_id, params = {}) click to toggle source

Returns all branches for the given project

@see lokalise.com/api2docs/curl/#transition-list-all-branches-get @return [Lokalise::Collection::Branch<Lokalise::Resources::Branch>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/branches.rb, line 11
def branches(project_id, params = {})
  c_r Lokalise::Collections::Branch, :all, project_id, params
end
c_r(klass, method, endpoint_ids, params = {}, object_key = nil, initial_ids = nil)
Alias for: construct_request
comment(project_id, key_id, comment_id) click to toggle source

Returns a single comment for the given key

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-comment-get @return [Lokalise::Resources::Comment] @param project_id [String] @param key_id [String, Integer] @param comment_id [String, Integer]

# File lib/ruby-lokalise-api/rest/comments.rb, line 12
def comment(project_id, key_id, comment_id)
  c_r Lokalise::Resources::KeyComment, :find, [project_id, key_id, comment_id]
end
comments(project_id, key_id, params = {}) click to toggle source

Returns all comments for the given key inside the given project

@see app.lokalise.com/api2docs/curl/#transition-list-key-comments-get @return [Lokalise::Collection::Comment<Lokalise::Resources::Comment>] @param project_id [String] @param key_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/comments.rb, line 33
def comments(project_id, key_id, params = {})
  c_r Lokalise::Collections::KeyComment, :all, [project_id, key_id], params
end
construct_request(klass, method, endpoint_ids, params = {}, object_key = nil, initial_ids = nil) click to toggle source

rubocop:disable Metrics/ParameterLists Constructs request to perform the specified action @param klass The actual class to call the method upon @param method [Symbol] The method to call (:new, :update, :create etc) @param endpoint_ids [Array, Hash] IDs that are used to generate the proper path to the endpoint @param params [Array, Hash] Request parameters @param object_key [String, Symbol] Key that should be used to wrap parameters into @param initial_ids [Array] IDs that should be used to generate base endpoint path. The base path is used for method chaining

# File lib/ruby-lokalise-api/client.rb, line 44
def construct_request(klass, method, endpoint_ids, params = {}, object_key = nil, initial_ids = nil)
  path = klass.endpoint(*endpoint_ids)
  formatted_params = format_params(params, object_key)
  formatted_params[:_initial_path] = klass.endpoint(*initial_ids) if initial_ids
  klass.send method, self, path, formatted_params
end
Also aliased as: c_r
contributor(project_id, contributor_id) click to toggle source

Returns a single contributor for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-contributor-get @return [Lokalise::Resources::Contributor] @param project_id [String] @param contributor_id [String, Integer]

# File lib/ruby-lokalise-api/rest/contributors.rb, line 21
def contributor(project_id, contributor_id)
  c_r Lokalise::Resources::Contributor, :find, [project_id, contributor_id]
end
contributors(project_id, params = {}) click to toggle source

Returns all contributors for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-contributors-get @return [Lokalise::Collection::Contributor<Lokalise::Resources::Contributor>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/contributors.rb, line 11
def contributors(project_id, params = {})
  c_r Lokalise::Collections::Contributor, :all, project_id, params
end
create_branch(project_id, params) click to toggle source

Creates a new branch inside the given project

@see lokalise.com/api2docs/curl/#transition-create-a-branch-post @return [Lokalise::Resources::Branch] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/branches.rb, line 21
def create_branch(project_id, params)
  c_r Lokalise::Resources::Branch, :create, project_id, params
end
create_comments(project_id, key_id, params) click to toggle source

Creates one or more comments for the given key inside the given project

@see app.lokalise.com/api2docs/curl/#transition-create-comments-post @return [Lokalise::Collection::Comment<Lokalise::Resources::Comment>] @param project_id [String] @param key_id [String, Integer] @param params [Hash, Array<Hash>]

# File lib/ruby-lokalise-api/rest/comments.rb, line 44
def create_comments(project_id, key_id, params)
  c_r Lokalise::Resources::KeyComment, :create, [project_id, key_id], params, :comments
end
create_contributors(project_id, params) click to toggle source

Creates one or more contributors inside the given project

@see app.lokalise.com/api2docs/curl/#transition-create-contributors-post @return [Lokalise::Collection::Contributor<Lokalise::Resources::Contributor>] @param project_id [String] @param params [Hash, Array<Hash>]

# File lib/ruby-lokalise-api/rest/contributors.rb, line 31
def create_contributors(project_id, params)
  c_r Lokalise::Resources::Contributor, :create, project_id, params, :contributors
end
create_keys(project_id, params = {}) click to toggle source

Creates one or more translation keys for the given project

@see app.lokalise.com/api2docs/curl/#transition-create-keys-post @return [Lokalise::Collection::Key<Lokalise::Resources::Key>] @param project_id [String] @param params [Hash, Array<Hash>]

# File lib/ruby-lokalise-api/rest/keys.rb, line 32
def create_keys(project_id, params = {})
  c_r Lokalise::Resources::Key, :create, project_id, params, :keys
end
create_languages(project_id, params) click to toggle source

Creates one or more language for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-language-get @return [Lokalise::Collection::ProjectLanguage<Lokalise::Resources::ProjectLanguage>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/languages.rb, line 40
def create_languages(project_id, params)
  c_r Lokalise::Resources::ProjectLanguage, :create, project_id, params, :languages
end
create_order(team_id, params) click to toggle source

Creates an order for the given team

@see lokalise.co/api2docs/curl/#transition-create-an-order-post @return [Lokalise::Resources::Order] @param team_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/orders.rb, line 31
def create_order(team_id, params)
  c_r Lokalise::Resources::Order, :create, team_id, params
end
create_payment_card(params) click to toggle source

Creates a payment card

@see lokalise.co/api2docs/curl/#transition-create-a-card-post @return [Lokalise::Resources::PaymentCard] @param params [Hash]

# File lib/ruby-lokalise-api/rest/payment_cards.rb, line 28
def create_payment_card(params)
  c_r Lokalise::Resources::PaymentCard, :create, nil, params
end
create_project(params) click to toggle source

Creates project

@see app.lokalise.com/api2docs/curl/#transition-create-a-project-post @return [Lokalise::Resources::Project] @param params [Hash]

# File lib/ruby-lokalise-api/rest/projects.rb, line 28
def create_project(params)
  c_r Lokalise::Resources::Project, :create, nil, params
end
create_screenshots(project_id, params = {}) click to toggle source

Creates one or more screenshots for the given project

@see app.lokalise.com/api2docs/curl/#transition-create-screenshots-post @return [Lokalise::Collection::Screenshot<Lokalise::Resources::Screenshot>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/screenshots.rb, line 31
def create_screenshots(project_id, params = {})
  c_r Lokalise::Resources::Screenshot, :create, project_id, params, :screenshots
end
create_snapshot(project_id, params = {}) click to toggle source

Creates snapshot for the given project

@see app.lokalise.com/api2docs/curl/#transition-create-a-snapshot-post @return [Lokalise::Resources::Snapshot] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/snapshots.rb, line 21
def create_snapshot(project_id, params = {})
  c_r Lokalise::Resources::Snapshot, :create, project_id, params
end
create_task(project_id, params) click to toggle source

Creates task for the given project

@see app.lokalise.com/api2docs/curl/#transition-create-a-task-post @return [Lokalise::Resources::Task] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/tasks.rb, line 31
def create_task(project_id, params)
  c_r Lokalise::Resources::Task, :create, project_id, params
end
create_team_user_group(team_id, params) click to toggle source

Creates team user group

@see lokalise.co/api2docs/curl/#resource-team-user-groups @return [Lokalise::Resources::TeamUserGroup] @param params [Hash]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 30
def create_team_user_group(team_id, params)
  c_r Lokalise::Resources::TeamUserGroup, :create, team_id, params
end
create_translation_status(project_id, params) click to toggle source

Creates translation status inside the given project

@see app.lokalise.com/api2docs/curl/#transition-create-a-custom-translation-status-post @return Lokalise::Resources::CustomTranslationStatus @param project_id [String] @param params Hash

# File lib/ruby-lokalise-api/rest/custom_translation_statuses.rb, line 31
def create_translation_status(project_id, params)
  c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params
end
create_webhook(project_id, params) click to toggle source

Creates webhook for the given project

@see app.lokalise.com/api2docs/curl/#transition-create-a-webhook-post @return [Lokalise::Resources::Webhook] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/webhooks.rb, line 31
def create_webhook(project_id, params)
  c_r Lokalise::Resources::Webhook, :create, project_id, params
end
destroy_branch(project_id, branch_id) click to toggle source

Deletes branch inside the given project

@see lokalise.com/api2docs/curl/#transition-delete-a-branch-delete @return [Hash] @param project_id [String] @param branch_id [String, Integer]

# File lib/ruby-lokalise-api/rest/branches.rb, line 52
def destroy_branch(project_id, branch_id)
  c_r Lokalise::Resources::Branch, :destroy, [project_id, branch_id]
end
destroy_comment(project_id, key_id, comment_id) click to toggle source

Deletes comment for the given key inside the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-comment-delete @return [Hash] @param project_id [String] @param key_id [String, Integer] @param comment_id [String, Integer]

# File lib/ruby-lokalise-api/rest/comments.rb, line 55
def destroy_comment(project_id, key_id, comment_id)
  c_r Lokalise::Resources::KeyComment, :destroy, [project_id, key_id, comment_id]
end
destroy_contributor(project_id, contributor_id) click to toggle source

Deletes contributor inside the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-contributor-delete @return [Hash] @param project_id [String] @param contributor_id [String, Integer]

# File lib/ruby-lokalise-api/rest/contributors.rb, line 52
def destroy_contributor(project_id, contributor_id)
  c_r Lokalise::Resources::Contributor, :destroy, [project_id, contributor_id]
end
destroy_key(project_id, key_id) click to toggle source

Deletes translation key for the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-key-delete @return [Hash] @param project_id [String] @param key_id [String, Integer]

# File lib/ruby-lokalise-api/rest/keys.rb, line 63
def destroy_key(project_id, key_id)
  c_r Lokalise::Resources::Key, :destroy, [project_id, key_id]
end
destroy_keys(project_id, key_ids) click to toggle source

Deletes one or multiple translation keys for the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-multiple-keys-delete @return [Hash] @param project_id [String] @param key_ids [String, Integer, Array<String>, Array<Integer>]

# File lib/ruby-lokalise-api/rest/keys.rb, line 73
def destroy_keys(project_id, key_ids)
  c_r Lokalise::Resources::Key, :destroy, project_id, key_ids, :keys
end
destroy_language(project_id, language_id) click to toggle source

Deletes language for the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-language-delete @return [Hash] @param project_id [String] @param language_id [String, Integer]

# File lib/ruby-lokalise-api/rest/languages.rb, line 61
def destroy_language(project_id, language_id)
  c_r Lokalise::Resources::ProjectLanguage, :destroy, [project_id, language_id]
end
destroy_payment_card(card_id) click to toggle source

Deletes the payment card

@see app.lokalise.com/api2docs/curl/#transition-delete-a-card-delete @return [Hash] @param card_id [String, Integer]

# File lib/ruby-lokalise-api/rest/payment_cards.rb, line 37
def destroy_payment_card(card_id)
  c_r Lokalise::Resources::PaymentCard, :destroy, card_id
end
destroy_project(project_id) click to toggle source

Deletes the project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-project-delete @return [Hash] @param project_id [String, Integer]

# File lib/ruby-lokalise-api/rest/projects.rb, line 56
def destroy_project(project_id)
  c_r Lokalise::Resources::Project, :destroy, project_id
end
destroy_screenshot(project_id, screenshot_id) click to toggle source

Deletes screenshot

@see app.lokalise.com/api2docs/curl/#transition-delete-a-screenshot-delete @return [Hash] @param project_id [String] @param screenshot_id [String, Integer]

# File lib/ruby-lokalise-api/rest/screenshots.rb, line 52
def destroy_screenshot(project_id, screenshot_id)
  c_r Lokalise::Resources::Screenshot, :destroy, [project_id, screenshot_id]
end
destroy_snapshot(project_id, snapshot_id) click to toggle source

Deletes snapshot

@see app.lokalise.com/api2docs/curl/#transition-delete-a-snapshot-delete @return [Hash] @param project_id [String] @param snapshot_id [String, Integer]

# File lib/ruby-lokalise-api/rest/snapshots.rb, line 41
def destroy_snapshot(project_id, snapshot_id)
  c_r Lokalise::Resources::Snapshot, :destroy, [project_id, snapshot_id]
end
destroy_task(project_id, task_id) click to toggle source

Deletes task for the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-task-delete @return [Hash] @param project_id [String] @param task_id [String, Integer]

# File lib/ruby-lokalise-api/rest/tasks.rb, line 52
def destroy_task(project_id, task_id)
  c_r Lokalise::Resources::Task, :destroy, [project_id, task_id]
end
destroy_team_user(team_id, user_id) click to toggle source

Deletes team user from the given team

@see app.lokalise.com/api2docs/curl/#transition-delete-a-team-user-delete @return [Lokalise::Resources::TeamUser] @param team_id [String] @param user_id [String, Integer]

# File lib/ruby-lokalise-api/rest/team_users.rb, line 42
def destroy_team_user(team_id, user_id)
  c_r Lokalise::Resources::TeamUser, :destroy, [team_id, user_id]
end
destroy_team_user_group(team_id, group_id) click to toggle source

Deletes team user group from the given team

@see lokalise.co/api2docs/curl/#transition-delete-a-group-delete @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 51
def destroy_team_user_group(team_id, group_id)
  c_r Lokalise::Resources::TeamUserGroup, :destroy, [team_id, group_id]
end
destroy_translation_status(project_id, status_id) click to toggle source

Deletes translation status inside the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-custom-translation-status-delete @return [Hash] @param project_id [String] @param status_id [String, Integer]

# File lib/ruby-lokalise-api/rest/custom_translation_statuses.rb, line 52
def destroy_translation_status(project_id, status_id)
  c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]
end
destroy_webhook(project_id, webhook_id) click to toggle source

Deletes webhook for the given project

@see app.lokalise.com/api2docs/curl/#transition-delete-a-webhook-delete @return [Hash] @param project_id [String] @param webhook_id [String, Integer]

# File lib/ruby-lokalise-api/rest/webhooks.rb, line 52
def destroy_webhook(project_id, webhook_id)
  c_r Lokalise::Resources::Webhook, :destroy, [project_id, webhook_id]
end
download_files(project_id, params) click to toggle source

Exports translation files as .zip bundle, uploads them to Amazon S3 and returns a URL to the generated bundle. The URL is valid for a year

@see app.lokalise.com/api2docs/curl/#transition-download-files-post @return [Hash] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/files.rb, line 21
def download_files(project_id, params)
  c_r Lokalise::Resources::File, :download, [project_id, 'download'], params
end
empty_project(project_id) click to toggle source

Deletes all keys and translations from the project

@see app.lokalise.com/api2docs/curl/#transition-empty-a-project-put @return [Hash] @param project_id [String, Integer]

# File lib/ruby-lokalise-api/rest/projects.rb, line 47
def empty_project(project_id)
  c_r Lokalise::Resources::Project, :empty, [project_id, 'empty']
end
files(project_id, params = {}) click to toggle source

Returns all translation files for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-files-get @return [Lokalise::Collection::File<Lokalise::Resources::File>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/files.rb, line 11
def files(project_id, params = {})
  c_r Lokalise::Collections::File, :all, project_id, params
end
format_params(params, object_key) click to toggle source

Converts `params` to hash with arrays under the `object_key` key. Used in bulk operations

@return [Hash]

# File lib/ruby-lokalise-api/client.rb, line 56
def format_params(params, object_key)
  return params unless object_key

  params = [params] unless params.is_a?(Array)
  {object_key => params}
end
key(project_id, key_id, params = {}) click to toggle source

Returns a single translation key for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-key-get @return [Lokalise::Resources::Key] @param project_id [String] @param key_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/keys.rb, line 22
def key(project_id, key_id, params = {})
  c_r Lokalise::Resources::Key, :find, [project_id, key_id], params
end
keys(project_id, params = {}) click to toggle source

Returns all translation keys for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-keys-get @return [Lokalise::Collection::Key<Lokalise::Resources::Key>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/keys.rb, line 11
def keys(project_id, params = {})
  c_r Lokalise::Collections::Key, :all, project_id, params
end
language(project_id, language_id) click to toggle source

Returns a single language for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-language-get @return [Lokalise::Resources::ProjectLanguage] @param project_id [String] @param language_id [String, Integer]

# File lib/ruby-lokalise-api/rest/languages.rb, line 30
def language(project_id, language_id)
  c_r Lokalise::Resources::ProjectLanguage, :find, [project_id, language_id]
end
merge_branch(project_id, branch_id, params = {}) click to toggle source

Merges a branch in the project

@see lokalise.com/api2docs/curl/#transition-merge-a-branch-post @return [Hash] @param project_id [String] @param branch_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/branches.rb, line 63
def merge_branch(project_id, branch_id, params = {})
  c_r Lokalise::Resources::Branch, :merge, [project_id, branch_id, :merge], params
end
order(team_id, order_id) click to toggle source

Returns a single order for the given team

@see lokalise.co/api2docs/curl/#transition-retrieve-an-order-get @return [Lokalise::Resources::Order] @param team_id [String] @param order_id [String, Integer]

# File lib/ruby-lokalise-api/rest/orders.rb, line 21
def order(team_id, order_id)
  c_r Lokalise::Resources::Order, :find, [team_id, order_id]
end
orders(team_id, params = {}) click to toggle source

Returns all orders for the given team

@see lokalise.co/api2docs/curl/#transition-list-all-orders-get @return [Lokalise::Collection::Order<Lokalise::Resources::Order>] @param team_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/orders.rb, line 11
def orders(team_id, params = {})
  c_r Lokalise::Collections::Order, :all, team_id, params
end
payment_card(card_id) click to toggle source

Returns a single payment card

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-card-get @return [Lokalise::Resources::PaymentCard] @param card_id [String, Integer]

# File lib/ruby-lokalise-api/rest/payment_cards.rb, line 19
def payment_card(card_id)
  c_r Lokalise::Resources::PaymentCard, :find, card_id
end
payment_cards(params = {}) click to toggle source

Returns all payment cards available to the user authorized with the API token

@see app.lokalise.com/api2docs/curl/#transition-list-all-cards-get @return [Lokalise::Collection::PaymentCard<Lokalise::Resources::PaymentCard>] @param params [Hash]

# File lib/ruby-lokalise-api/rest/payment_cards.rb, line 10
def payment_cards(params = {})
  c_r Lokalise::Collections::PaymentCard, :all, nil, params
end
project(project_id) click to toggle source

Returns a single project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-project-get @return [Lokalise::Resources::Project] @param project_id [String, Integer]

# File lib/ruby-lokalise-api/rest/projects.rb, line 19
def project(project_id)
  c_r Lokalise::Resources::Project, :find, project_id
end
project_comments(project_id, params = {}) click to toggle source

Returns all comments for all keys inside the given project

@see app.lokalise.com/api2docs/curl/#transition-list-project-comments-get @return [Lokalise::Collection::Comment<Lokalise::Resources::Comment>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/comments.rb, line 22
def project_comments(project_id, params = {})
  c_r Lokalise::Collections::ProjectComment, :all, project_id, params
end
project_languages(project_id, params = {}) click to toggle source

Returns all languages for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-project-languages-get @return [Lokalise::Collection::ProjectLanguage<Lokalise::Resources::ProjectLanguage>] @param project_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/languages.rb, line 20
def project_languages(project_id, params = {})
  c_r Lokalise::Collections::ProjectLanguage, :all, project_id, params
end
projects(params = {}) click to toggle source

Returns all projects available to the user authorized with the API token

@see app.lokalise.com/api2docs/curl/#transition-list-all-projects-get @return [Lokalise::Collection::Project<Lokalise::Resources::Project>] @param params [Hash]

# File lib/ruby-lokalise-api/rest/projects.rb, line 10
def projects(params = {})
  c_r Lokalise::Collections::Project, :all, nil, params
end
queued_process(project_id, process_id) click to toggle source

Returns a queued process for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-process-get @return [Lokalise::Resources::QueuedProcess] @param project_id [String] @param process_id [String]

# File lib/ruby-lokalise-api/rest/queued_processes.rb, line 21
def queued_process(project_id, process_id)
  c_r Lokalise::Resources::QueuedProcess, :find,
      [project_id, process_id]
end
queued_processes(project_id, params = {}) click to toggle source

Returns all queued processes for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-processes-get @return [Lokalise::Collection::QueuedProcess<Lokalise::Resources::QueuedProcess>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/queued_processes.rb, line 11
def queued_processes(project_id, params = {})
  c_r Lokalise::Collections::QueuedProcess, :all, project_id, params
end
regenerate_webhook_secret(project_id, webhook_id) click to toggle source

Regenerates secret for the given webhook

@see lokalise.com/api2docs/curl/#transition-regenerate-a-webhook-secret-patch @return [Hash] @param project_id [String] @param webhook_id [String, Integer]

# File lib/ruby-lokalise-api/rest/webhooks.rb, line 62
def regenerate_webhook_secret(project_id, webhook_id)
  c_r Lokalise::Resources::Webhook, :regenerate_secret,
      [project_id, webhook_id, 'secret', 'regenerate']
end
remove_projects_from_group(team_id, group_id, project_ids) click to toggle source

Removes projects from the given group

@see lokalise.co/api2docs/curl/#transition-remove-projects-from-group-put @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer] @param project_ids [String, Integer, Array<String>, Array<Integer>]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 75
def remove_projects_from_group(team_id, group_id, project_ids)
  c_r Lokalise::Resources::TeamUserGroup, :update,
      [team_id, group_id, 'projects', 'remove'],
      project_ids, :projects, [team_id, group_id]
end
remove_users_from_group(team_id, group_id, users_ids) click to toggle source

Removes users from the given group

@see lokalise.co/api2docs/curl/#transition-remove-members-from-group-put @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer] @param users_ids [String, Integer, Array<String>, Array<Integer>]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 101
def remove_users_from_group(team_id, group_id, users_ids)
  c_r Lokalise::Resources::TeamUserGroup, :update,
      [team_id, group_id, 'members', 'remove'],
      users_ids, :users, [team_id, group_id]
end
restore_snapshot(project_id, snapshot_id) click to toggle source

Restore project from the given snapshot by producing project's copy

@see app.lokalise.com/api2docs/curl/#transition-restore-a-snapshot-post @return [Lokalise::Resources::Project] @param project_id [String] @param snapshot_id [String, Integer]

# File lib/ruby-lokalise-api/rest/snapshots.rb, line 31
def restore_snapshot(project_id, snapshot_id)
  c_r Lokalise::Resources::Snapshot, :restore, [project_id, snapshot_id]
end
screenshot(project_id, screenshot_id) click to toggle source

Returns a single screenshot for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-screenshot-get @return [Lokalise::Resources::Screenshot] @param project_id [String] @param screenshot_id [String, Integer]

# File lib/ruby-lokalise-api/rest/screenshots.rb, line 21
def screenshot(project_id, screenshot_id)
  c_r Lokalise::Resources::Screenshot, :find, [project_id, screenshot_id]
end
screenshots(project_id, params = {}) click to toggle source

Returns all screenshots for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-screenshots-get @return [Lokalise::Collection::Screenshot<Lokalise::Resources::Screenshot>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/screenshots.rb, line 11
def screenshots(project_id, params = {})
  c_r Lokalise::Collections::Screenshot, :all, project_id, params
end
snapshots(project_id, params = {}) click to toggle source

Returns all snapshots for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-snapshots-get @return [Lokalise::Collection::Snapshot<Lokalise::Resources::Snapshot>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/snapshots.rb, line 11
def snapshots(project_id, params = {})
  c_r Lokalise::Collections::Snapshot, :all, project_id, params
end
system_languages(params = {}) click to toggle source

Returns all languages supported by Lokalise

@see app.lokalise.com/api2docs/curl/#transition-list-system-languages-get @return [Lokalise::Collection::SystemLanguage<Lokalise::Resources::SystemLanguage>] @param params [Hash]

# File lib/ruby-lokalise-api/rest/languages.rb, line 10
def system_languages(params = {})
  c_r Lokalise::Collections::SystemLanguage, :all, nil, params
end
task(project_id, task_id) click to toggle source

Returns a single task for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-task-get @return [Lokalise::Resources::Task] @param project_id [String] @param task_id [String, Integer]

# File lib/ruby-lokalise-api/rest/tasks.rb, line 21
def task(project_id, task_id)
  c_r Lokalise::Resources::Task, :find, [project_id, task_id]
end
tasks(project_id, params = {}) click to toggle source

Returns all tasks for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-tasks-get @return [Lokalise::Collection::Task<Lokalise::Resources::Task>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/tasks.rb, line 11
def tasks(project_id, params = {})
  c_r Lokalise::Collections::Task, :all, project_id, params
end
team_user(team_id, user_id) click to toggle source

Returns team user from the given team

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-team-user-get @return [Lokalise::Resources::TeamUser] @param team_id [String] @param user_id [String, Integer]

# File lib/ruby-lokalise-api/rest/team_users.rb, line 21
def team_user(team_id, user_id)
  c_r Lokalise::Resources::TeamUser, :find, [team_id, user_id]
end
team_user_group(team_id, group_id) click to toggle source

Returns team user from the given team

@see lokalise.co/api2docs/curl/#transition-retrieve-a-group-get @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 21
def team_user_group(team_id, group_id)
  c_r Lokalise::Resources::TeamUserGroup, :find, [team_id, group_id]
end
team_user_groups(team_id, params = {}) click to toggle source

Returns all team user groups for the given team

@see lokalise.co/api2docs/curl/#transition-list-all-groups-get @return [Lokalise::Collection::TeamUserGroup<Lokalise::Resources::TeamUserGroup>] @param team_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 11
def team_user_groups(team_id, params = {})
  c_r Lokalise::Collections::TeamUserGroup, :all, team_id, params
end
team_users(team_id, params = {}) click to toggle source

Returns all team users for the given team

@see app.lokalise.com/api2docs/curl/#transition-list-all-team-users-get @return [Lokalise::Collection::TeamUser<Lokalise::Resources::TeamUser>] @param team_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/team_users.rb, line 11
def team_users(team_id, params = {})
  c_r Lokalise::Collections::TeamUser, :all, team_id, params
end
teams(params = {}) click to toggle source

Returns all teams available to the user

@see app.lokalise.com/api2docs/curl/#transition-list-all-teams-get @return [Lokalise::Collection::Team<Lokalise::Resources::Team>] @param params [Hash]

# File lib/ruby-lokalise-api/rest/teams.rb, line 10
def teams(params = {})
  c_r Lokalise::Collections::Team, :all, nil, params
end
translation(project_id, translation_id, params = {}) click to toggle source

Returns translation of the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-translation-get @return [Lokalise::Resources::Translation] @param project_id [String] @param translation_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/translations.rb, line 22
def translation(project_id, translation_id, params = {})
  c_r Lokalise::Resources::Translation, :find, [project_id, translation_id], params
end
translation_provider(team_id, provider_id) click to toggle source

Returns a single translation provider for the given team

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-provider-get @return [Lokalise::Resources::TranslationProvider] @param team_id [String] @param provider_id [String, Integer]

# File lib/ruby-lokalise-api/rest/translation_providers.rb, line 21
def translation_provider(team_id, provider_id)
  c_r Lokalise::Resources::TranslationProvider, :find, [team_id, provider_id]
end
translation_providers(team_id, params = {}) click to toggle source

Returns all translation providers for the given team

@see app.lokalise.com/api2docs/curl/#transition-list-all-providers-get @return [Lokalise::Collection::TranslationProvider<Lokalise::Resources::TranslationProvider>] @param team_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/translation_providers.rb, line 11
def translation_providers(team_id, params = {})
  c_r Lokalise::Collections::TranslationProvider, :all, team_id, params
end
translation_status(project_id, status_id) click to toggle source

Returns a single translation status for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-custom-translation-status-get @return [Lokalise::Resources::CustomTranslationStatus] @param project_id [String] @param status_id [String, Integer]

# File lib/ruby-lokalise-api/rest/custom_translation_statuses.rb, line 21
def translation_status(project_id, status_id)
  c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]
end
translation_status_colors(project_id) click to toggle source

Returns an array of available colors that can be assigned to custom translation statuses

@see app.lokalise.com/api2docs/curl/#transition-retrieve-available-colors-for-custom-translation-statuses-get @return [Array] @param project_id [String]

# File lib/ruby-lokalise-api/rest/custom_translation_statuses.rb, line 61
def translation_status_colors(project_id)
  c_r Lokalise::Resources::CustomTranslationStatus, :colors, [project_id, 'colors']
end
translation_statuses(project_id, params = {}) click to toggle source

Returns all translation statuses for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-custom-translation-statuses-get @return [Lokalise::Collection::CustomTranslationStatus<Lokalise::Resources::CustomTranslationStatus>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/custom_translation_statuses.rb, line 11
def translation_statuses(project_id, params = {})
  c_r Lokalise::Collections::CustomTranslationStatus, :all, project_id, params
end
translations(project_id, params = {}) click to toggle source

Returns all translations for the given project (ungrouped)

@see app.lokalise.com/api2docs/curl/#transition-list-all-translations-get @return [Lokalise::Collection::Translation<Lokalise::Resources::Translation>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/translations.rb, line 11
def translations(project_id, params = {})
  c_r Lokalise::Collections::Translation, :all, project_id, params
end
update_branch(project_id, branch_id, params) click to toggle source

Updates the given branch inside the given project

@see lokalise.com/api2docs/curl/#transition-update-a-branch-put @return [Lokalise::Resources::Branch] @param project_id [String] @param branch_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/branches.rb, line 42
def update_branch(project_id, branch_id, params)
  c_r Lokalise::Resources::Branch, :update, [project_id, branch_id], params
end
update_contributor(project_id, contributor_id, params) click to toggle source

Updates the given contributor inside the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-contributor-put @return [Lokalise::Resources::Contributor] @param project_id [String] @param contributor_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/contributors.rb, line 42
def update_contributor(project_id, contributor_id, params)
  c_r Lokalise::Resources::Contributor, :update, [project_id, contributor_id], params
end
update_key(project_id, key_id, params = {}) click to toggle source

Updates translation key for the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-key-put @return [Lokalise::Resources::Key] @param project_id [String] @param key_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/keys.rb, line 43
def update_key(project_id, key_id, params = {})
  c_r Lokalise::Resources::Key, :update, [project_id, key_id], params
end
update_keys(project_id, params) click to toggle source

Updates one or multiple translation keys for the given project

@see app.lokalise.com/api2docs/curl/#transition-bulk-update-put @return [Lokalise::Collection::Key<Lokalise::Resources::Key>] @param project_id [String] @param params [Hash, Array<Hash>]

# File lib/ruby-lokalise-api/rest/keys.rb, line 53
def update_keys(project_id, params)
  c_r Lokalise::Resources::Key, :update, project_id, params, :keys
end
update_language(project_id, language_id, params) click to toggle source

Updates language for the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-language-put @return [Lokalise::Resources::ProjectLanguage] @param project_id [String] @param language_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/languages.rb, line 51
def update_language(project_id, language_id, params)
  c_r Lokalise::Resources::ProjectLanguage, :update, [project_id, language_id], params
end
update_project(project_id, params) click to toggle source

Updates project

@see app.lokalise.com/api2docs/curl/#transition-update-a-project-put @return [Lokalise::Resources::Project] @param project_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/projects.rb, line 38
def update_project(project_id, params)
  c_r Lokalise::Resources::Project, :update, project_id, params
end
update_screenshot(project_id, screenshot_id, params = {}) click to toggle source

Updates screenshot

@see app.lokalise.com/api2docs/curl/#transition-update-a-screenshot-put @return [Lokalise::Resources::Screenshot] @param project_id [String] @param screenshot_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/screenshots.rb, line 42
def update_screenshot(project_id, screenshot_id, params = {})
  c_r Lokalise::Resources::Screenshot, :update, [project_id, screenshot_id], params
end
update_task(project_id, task_id, params = {}) click to toggle source

Updates task for the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-task-put @return [Lokalise::Resources::Task] @param project_id [String] @param task_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/tasks.rb, line 42
def update_task(project_id, task_id, params = {})
  c_r Lokalise::Resources::Task, :update, [project_id, task_id], params
end
update_team_user(team_id, user_id, params) click to toggle source

Updates team user for the given team

@see app.lokalise.com/api2docs/curl/#transition-update-a-team-user-put @return [Lokalise::Resources::TeamUser] @param team_id [String] @param user_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/team_users.rb, line 32
def update_team_user(team_id, user_id, params)
  c_r Lokalise::Resources::TeamUser, :update, [team_id, user_id], params
end
update_team_user_group(team_id, group_id, params) click to toggle source

Updates team user group for the given team

@see lokalise.co/api2docs/curl/#transition-update-a-group-put @return [Lokalise::Resources::TeamUserGroup] @param team_id [String] @param group_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/team_user_group.rb, line 41
def update_team_user_group(team_id, group_id, params)
  c_r Lokalise::Resources::TeamUserGroup, :update, [team_id, group_id], params
end
update_translation(project_id, translation_id, params) click to toggle source

Updates translation of the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-translation-put @return [Lokalise::Resources::Translation] @param project_id [String] @param translation_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/translations.rb, line 33
def update_translation(project_id, translation_id, params)
  c_r Lokalise::Resources::Translation, :update, [project_id, translation_id], params
end
update_translation_status(project_id, status_id, params) click to toggle source

Updates the given translation status inside the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-custom-translation-status-put @return [Lokalise::Resources::CustomTranslationStatus] @param project_id [String] @param status_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/custom_translation_statuses.rb, line 42
def update_translation_status(project_id, status_id, params)
  c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params
end
update_webhook(project_id, webhook_id, params = {}) click to toggle source

Updates webhook for the given project

@see app.lokalise.com/api2docs/curl/#transition-update-a-webhook-put @return [Lokalise::Resources::Webhook] @param project_id [String] @param webhook_id [String, Integer] @param params [Hash]

# File lib/ruby-lokalise-api/rest/webhooks.rb, line 42
def update_webhook(project_id, webhook_id, params = {})
  c_r Lokalise::Resources::Webhook, :update, [project_id, webhook_id], params
end
upload_file(project_id, params) click to toggle source

Imports translation file to the given project. File data must base64-encoded. To encode your data in Base64, use `Base64.strict_encode64()` method.

@see app.lokalise.com/api2docs/curl/#transition-upload-a-file-post @return [Hash] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/files.rb, line 32
def upload_file(project_id, params)
  c_r Lokalise::Resources::File, :upload, [project_id, 'upload'], params
end
webhook(project_id, webhook_id) click to toggle source

Returns a single webhook for the given project

@see app.lokalise.com/api2docs/curl/#transition-retrieve-a-webhook-get @return [Lokalise::Resources::Webhook] @param project_id [String] @param webhook_id [String, Integer]

# File lib/ruby-lokalise-api/rest/webhooks.rb, line 21
def webhook(project_id, webhook_id)
  c_r Lokalise::Resources::Webhook, :find, [project_id, webhook_id]
end
webhooks(project_id, params = {}) click to toggle source

Returns all webhooks for the given project

@see app.lokalise.com/api2docs/curl/#transition-list-all-webhooks-get @return [Lokalise::Collection::Webhook<Lokalise::Resources::Webhook>] @param project_id [String] @param params [Hash]

# File lib/ruby-lokalise-api/rest/webhooks.rb, line 11
def webhooks(project_id, params = {})
  c_r Lokalise::Collections::Webhook, :all, project_id, params
end