Class: Lokalise::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-lokalise-api/client.rb,
lib/ruby-lokalise-api/rest/keys.rb,
lib/ruby-lokalise-api/rest/files.rb,
lib/ruby-lokalise-api/rest/tasks.rb,
lib/ruby-lokalise-api/rest/teams.rb,
lib/ruby-lokalise-api/rest/orders.rb,
lib/ruby-lokalise-api/rest/branches.rb,
lib/ruby-lokalise-api/rest/comments.rb,
lib/ruby-lokalise-api/rest/projects.rb,
lib/ruby-lokalise-api/rest/webhooks.rb,
lib/ruby-lokalise-api/rest/languages.rb,
lib/ruby-lokalise-api/rest/snapshots.rb,
lib/ruby-lokalise-api/rest/team_users.rb,
lib/ruby-lokalise-api/rest/screenshots.rb,
lib/ruby-lokalise-api/rest/contributors.rb,
lib/ruby-lokalise-api/rest/translations.rb,
lib/ruby-lokalise-api/rest/payment_cards.rb,
lib/ruby-lokalise-api/rest/team_user_group.rb,
lib/ruby-lokalise-api/rest/queued_processes.rb,
lib/ruby-lokalise-api/rest/translation_providers.rb,
lib/ruby-lokalise-api/rest/custom_translation_statuses.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, params = {}) ⇒ Client

Returns a new instance of Client.



29
30
31
32
33
# 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)
end

Instance Attribute Details

#open_timeoutObject

Returns the value of attribute open_timeout.



27
28
29
# File 'lib/ruby-lokalise-api/client.rb', line 27

def open_timeout
  @open_timeout
end

#timeoutObject

Returns the value of attribute timeout.



27
28
29
# File 'lib/ruby-lokalise-api/client.rb', line 27

def timeout
  @timeout
end

#tokenObject (readonly)

Returns the value of attribute token.



26
27
28
# File 'lib/ruby-lokalise-api/client.rb', line 26

def token
  @token
end

Instance Method Details

#add_projects_to_group(team_id, group_id, project_ids) ⇒ Lokalise::Resources::TeamUserGroup

Adds projects to the given group

Parameters:

Returns:

See Also:



62
63
64
65
66
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Adds users to the given group

Parameters:

Returns:

See Also:



88
89
90
91
92
# 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) ⇒ Lokalise::Resources::Branch

Returns a single branch for the given project

Parameters:

Returns:

See Also:



31
32
33
# 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 = {}) ⇒ Lokalise::Collection::Branch<Lokalise::Resources::Branch>

Returns all branches for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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

#comment(project_id, key_id, comment_id) ⇒ Lokalise::Resources::Comment

Returns a single comment for the given key

Parameters:

Returns:

  • (Lokalise::Resources::Comment)

See Also:



12
13
14
# 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 = {}) ⇒ Lokalise::Collection::Comment<Lokalise::Resources::Comment>

Returns all comments for the given key inside the given project

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

  • (Lokalise::Collection::Comment<Lokalise::Resources::Comment>)

See Also:



33
34
35
# 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) ⇒ Object Also known as: c_r

rubocop:disable Metrics/ParameterLists Constructs request to perform the specified action

Parameters:

  • klass

    The actual class to call the method upon

  • method (Symbol)

    The method to call (:new, :update, :create etc)

  • endpoint_ids (Array, Hash)

    IDs that are used to generate the proper path to the endpoint

  • params (Array, Hash) (defaults to: {})

    Request parameters

  • object_key (String, Symbol) (defaults to: nil)

    Key that should be used to wrap parameters into

  • initial_ids (Array) (defaults to: nil)

    IDs that should be used to generate base endpoint path. The base path is used for method chaining



43
44
45
46
47
48
# File 'lib/ruby-lokalise-api/client.rb', line 43

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

#contributor(project_id, contributor_id) ⇒ Lokalise::Resources::Contributor

Returns a single contributor for the given project



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::Contributor<Lokalise::Resources::Contributor>

Returns all contributors for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Lokalise::Resources::Branch

Creates a new branch inside the given project



21
22
23
# 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) ⇒ Lokalise::Collection::Comment<Lokalise::Resources::Comment>

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

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • params (Hash, Array<Hash>)

Returns:

  • (Lokalise::Collection::Comment<Lokalise::Resources::Comment>)

See Also:



44
45
46
# 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) ⇒ Lokalise::Collection::Contributor<Lokalise::Resources::Contributor>

Creates one or more contributors inside the given project

Parameters:

  • project_id (String)
  • params (Hash, Array<Hash>)

Returns:

See Also:



31
32
33
# 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 = {}) ⇒ Lokalise::Collection::Key<Lokalise::Resources::Key>

Creates one or more translation keys for the given project

Parameters:

  • project_id (String)
  • params (Hash, Array<Hash>) (defaults to: {})

Returns:

See Also:



32
33
34
# 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) ⇒ Lokalise::Collection::ProjectLanguage<Lokalise::Resources::ProjectLanguage>

Creates one or more language for the given project

Parameters:

  • project_id (String)
  • params (Hash)

Returns:

See Also:



40
41
42
# 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) ⇒ Lokalise::Resources::Order

Creates an order for the given team



31
32
33
# 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) ⇒ Lokalise::Resources::PaymentCard

Creates a payment card



28
29
30
# 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) ⇒ Lokalise::Resources::Project

Creates project



28
29
30
# 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 = {}) ⇒ Lokalise::Collection::Screenshot<Lokalise::Resources::Screenshot>

Creates one or more screenshots for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



31
32
33
# 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 = {}) ⇒ Lokalise::Resources::Snapshot

Creates snapshot for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



21
22
23
# 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) ⇒ Lokalise::Resources::Task

Creates task for the given project



31
32
33
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Creates team user group



30
31
32
# 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) ⇒ Object

Creates translation status inside the given project

Parameters:

  • project_id (String)
  • params

    Hash

Returns:

  • Lokalise::Resources::CustomTranslationStatus

See Also:



31
32
33
# 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) ⇒ Lokalise::Resources::Webhook

Creates webhook for the given project



31
32
33
# 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) ⇒ Hash

Deletes branch inside the given project

Parameters:

Returns:

  • (Hash)

See Also:



52
53
54
# 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) ⇒ Hash

Deletes comment for the given key inside the given project

Parameters:

Returns:

  • (Hash)

See Also:



55
56
57
# 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) ⇒ Hash

Deletes contributor inside the given project

Parameters:

Returns:

  • (Hash)

See Also:



52
53
54
# 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) ⇒ Hash

Deletes translation key for the given project

Parameters:

Returns:

  • (Hash)

See Also:



63
64
65
# 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) ⇒ Hash

Deletes one or multiple translation keys for the given project

Parameters:

Returns:

  • (Hash)

See Also:



73
74
75
# 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) ⇒ Hash

Deletes language for the given project

Parameters:

Returns:

  • (Hash)

See Also:



61
62
63
# 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) ⇒ Hash

Deletes the payment card

Parameters:

Returns:

  • (Hash)

See Also:



37
38
39
# 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) ⇒ Hash

Deletes the project

Parameters:

  • project_id (String, Integer)

Returns:

  • (Hash)

See Also:



56
57
58
# 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) ⇒ Hash

Deletes screenshot

Parameters:

Returns:

  • (Hash)

See Also:



52
53
54
# 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) ⇒ Hash

Deletes snapshot

Parameters:

Returns:

  • (Hash)

See Also:



41
42
43
# 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) ⇒ Hash

Deletes task for the given project

Parameters:

Returns:

  • (Hash)

See Also:



52
53
54
# 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) ⇒ Lokalise::Resources::TeamUser

Deletes team user from the given team



42
43
44
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Deletes team user group from the given team



51
52
53
# 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) ⇒ Hash

Deletes translation status inside the given project

Parameters:

Returns:

  • (Hash)

See Also:



52
53
54
# 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) ⇒ Hash

Deletes webhook for the given project

Parameters:

Returns:

  • (Hash)

See Also:



52
53
54
# 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) ⇒ Hash

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

Parameters:

  • project_id (String)
  • params (Hash)

Returns:

  • (Hash)

See Also:



21
22
23
# 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) ⇒ Hash

Deletes all keys and translations from the project

Parameters:

  • project_id (String, Integer)

Returns:

  • (Hash)

See Also:



47
48
49
# 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 = {}) ⇒ Lokalise::Collection::File<Lokalise::Resources::File>

Returns all translation files for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Hash

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

Returns:

  • (Hash)


55
56
57
58
59
60
# File 'lib/ruby-lokalise-api/client.rb', line 55

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 = {}) ⇒ Lokalise::Resources::Key

Returns a single translation key for the given project

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



22
23
24
# 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 = {}) ⇒ Lokalise::Collection::Key<Lokalise::Resources::Key>

Returns all translation keys for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Lokalise::Resources::ProjectLanguage

Returns a single language for the given project



30
31
32
# 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 = {}) ⇒ Hash

Merges a branch in the project

Parameters:

  • project_id (String)
  • branch_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

  • (Hash)

See Also:



63
64
65
# 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) ⇒ Lokalise::Resources::Order

Returns a single order for the given team



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::Order<Lokalise::Resources::Order>

Returns all orders for the given team

Parameters:

  • team_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Lokalise::Resources::PaymentCard

Returns a single payment card



19
20
21
# 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 = {}) ⇒ Lokalise::Collection::PaymentCard<Lokalise::Resources::PaymentCard>

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

Parameters:

  • params (Hash) (defaults to: {})

Returns:

See Also:



10
11
12
# 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) ⇒ Lokalise::Resources::Project

Returns a single project



19
20
21
# 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 = {}) ⇒ Lokalise::Collection::Comment<Lokalise::Resources::Comment>

Returns all comments for all keys inside the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

  • (Lokalise::Collection::Comment<Lokalise::Resources::Comment>)

See Also:



22
23
24
# 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 = {}) ⇒ Lokalise::Collection::ProjectLanguage<Lokalise::Resources::ProjectLanguage>

Returns all languages for the given project

Parameters:

  • project_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



20
21
22
# 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 = {}) ⇒ Lokalise::Collection::Project<Lokalise::Resources::Project>

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

Parameters:

  • params (Hash) (defaults to: {})

Returns:

See Also:



10
11
12
# 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) ⇒ Lokalise::Resources::QueuedProcess

Returns a queued process for the given project



21
22
23
24
# 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 = {}) ⇒ Lokalise::Collection::QueuedProcess<Lokalise::Resources::QueuedProcess>

Returns all queued processes for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Hash

Regenerates secret for the given webhook

Parameters:

Returns:

  • (Hash)

See Also:



62
63
64
65
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Removes projects from the given group

Parameters:

Returns:

See Also:



75
76
77
78
79
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Removes users from the given group

Parameters:

Returns:

See Also:



101
102
103
104
105
# 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) ⇒ Lokalise::Resources::Project

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



31
32
33
# 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) ⇒ Lokalise::Resources::Screenshot

Returns a single screenshot for the given project



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::Screenshot<Lokalise::Resources::Screenshot>

Returns all screenshots for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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 = {}) ⇒ Lokalise::Collection::Snapshot<Lokalise::Resources::Snapshot>

Returns all snapshots for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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 = {}) ⇒ Lokalise::Collection::SystemLanguage<Lokalise::Resources::SystemLanguage>

Returns all languages supported by Lokalise

Parameters:

  • params (Hash) (defaults to: {})

Returns:

See Also:



10
11
12
# 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) ⇒ Lokalise::Resources::Task

Returns a single task for the given project



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::Task<Lokalise::Resources::Task>

Returns all tasks for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Lokalise::Resources::TeamUser

Returns team user from the given team



21
22
23
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Returns team user from the given team



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::TeamUserGroup<Lokalise::Resources::TeamUserGroup>

Returns all team user groups for the given team

Parameters:

  • team_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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 = {}) ⇒ Lokalise::Collection::TeamUser<Lokalise::Resources::TeamUser>

Returns all team users for the given team

Parameters:

  • team_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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 = {}) ⇒ Lokalise::Collection::Team<Lokalise::Resources::Team>

Returns all teams available to the user

Parameters:

  • params (Hash) (defaults to: {})

Returns:

See Also:



10
11
12
# 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 = {}) ⇒ Lokalise::Resources::Translation

Returns translation of the given project

Parameters:

  • project_id (String)
  • translation_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



22
23
24
# 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) ⇒ Lokalise::Resources::TranslationProvider

Returns a single translation provider for the given team



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::TranslationProvider<Lokalise::Resources::TranslationProvider>

Returns all translation providers for the given team

Parameters:

  • team_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Lokalise::Resources::CustomTranslationStatus

Returns a single translation status for the given project



21
22
23
# 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) ⇒ Array

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



61
62
63
# 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 = {}) ⇒ Lokalise::Collection::CustomTranslationStatus<Lokalise::Resources::CustomTranslationStatus>

Returns all translation statuses for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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 = {}) ⇒ Lokalise::Collection::Translation<Lokalise::Resources::Translation>

Returns all translations for the given project (ungrouped)

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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) ⇒ Lokalise::Resources::Branch

Updates the given branch inside the given project

Parameters:

  • project_id (String)
  • branch_id (String, Integer)
  • params (Hash)

Returns:

See Also:



42
43
44
# 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) ⇒ Lokalise::Resources::Contributor

Updates the given contributor inside the given project

Parameters:

  • project_id (String)
  • contributor_id (String, Integer)
  • params (Hash)

Returns:

See Also:



42
43
44
# 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 = {}) ⇒ Lokalise::Resources::Key

Updates translation key for the given project

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



43
44
45
# 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) ⇒ Lokalise::Collection::Key<Lokalise::Resources::Key>

Updates one or multiple translation keys for the given project

Parameters:

  • project_id (String)
  • params (Hash, Array<Hash>)

Returns:

See Also:



53
54
55
# 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) ⇒ Lokalise::Resources::ProjectLanguage

Updates language for the given project

Parameters:

  • project_id (String)
  • language_id (String, Integer)
  • params (Hash)

Returns:

See Also:



51
52
53
# 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) ⇒ Lokalise::Resources::Project

Updates project

Parameters:

  • project_id (String, Integer)
  • params (Hash)

Returns:

See Also:



38
39
40
# 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 = {}) ⇒ Lokalise::Resources::Screenshot

Updates screenshot

Parameters:

  • project_id (String)
  • screenshot_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



42
43
44
# 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 = {}) ⇒ Lokalise::Resources::Task

Updates task for the given project

Parameters:

  • project_id (String)
  • task_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



42
43
44
# 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) ⇒ Lokalise::Resources::TeamUser

Updates team user for the given team

Parameters:

Returns:

See Also:



32
33
34
# 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) ⇒ Lokalise::Resources::TeamUserGroup

Updates team user group for the given team

Parameters:

Returns:

See Also:



41
42
43
# 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) ⇒ Lokalise::Resources::Translation

Updates translation of the given project

Parameters:

  • project_id (String)
  • translation_id (String, Integer)
  • params (Hash)

Returns:

See Also:



33
34
35
# 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) ⇒ Lokalise::Resources::CustomTranslationStatus

Updates the given translation status inside the given project



42
43
44
# 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 = {}) ⇒ Lokalise::Resources::Webhook

Updates webhook for the given project

Parameters:

  • project_id (String)
  • webhook_id (String, Integer)
  • params (Hash) (defaults to: {})

Returns:

See Also:



42
43
44
# 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) ⇒ Hash

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

Parameters:

  • project_id (String)
  • params (Hash)

Returns:

  • (Hash)

See Also:



32
33
34
# 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) ⇒ Lokalise::Resources::Webhook

Returns a single webhook for the given project



21
22
23
# 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 = {}) ⇒ Lokalise::Collection::Webhook<Lokalise::Resources::Webhook>

Returns all webhooks for the given project

Parameters:

  • project_id (String)
  • params (Hash) (defaults to: {})

Returns:

See Also:



11
12
13
# 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