ruby-lokalise-api 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/base_request.rb +4 -4
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/client.rb +24 -24
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/base.rb +10 -10
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/branch.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/contributor.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/custom_translation_status.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/file.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/key.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/key_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/order.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/payment_card.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/project.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/project_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/project_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/queued_process.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/screenshot.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/segment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/snapshot.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/system_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/task.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/team.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/team_user.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/team_user_group.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/translation.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/translation_provider.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/webhook.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/connection.rb +2 -2
- data/lib/ruby_lokalise_api/data/attributes.yml +235 -0
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/error.rb +14 -14
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/json_handler.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/auth.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/connection.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/request.rb +3 -3
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2_client.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/request.rb +3 -3
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/base.rb +8 -8
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/branch.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/contributor.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/custom_translation_status.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/file.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/key.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/key_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/order.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/payment_card.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/project.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/project_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/project_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/queued_process.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/screenshot.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/segment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/snapshot.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/system_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/task.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team_user.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team_user_billing_details.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team_user_group.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/translation.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/translation_provider.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/webhook.rb +1 -1
- data/lib/ruby_lokalise_api/rest/branches.rb +69 -0
- data/lib/ruby_lokalise_api/rest/comments.rb +61 -0
- data/lib/ruby_lokalise_api/rest/contributors.rb +58 -0
- data/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb +67 -0
- data/lib/ruby_lokalise_api/rest/files.rb +38 -0
- data/lib/ruby_lokalise_api/rest/keys.rb +79 -0
- data/lib/ruby_lokalise_api/rest/languages.rb +67 -0
- data/lib/ruby_lokalise_api/rest/orders.rb +37 -0
- data/lib/ruby_lokalise_api/rest/payment_cards.rb +43 -0
- data/lib/ruby_lokalise_api/rest/projects.rb +62 -0
- data/lib/ruby_lokalise_api/rest/queued_processes.rb +28 -0
- data/lib/ruby_lokalise_api/rest/screenshots.rb +58 -0
- data/lib/ruby_lokalise_api/rest/segments.rb +45 -0
- data/lib/ruby_lokalise_api/rest/snapshots.rb +47 -0
- data/lib/ruby_lokalise_api/rest/tasks.rb +58 -0
- data/lib/ruby_lokalise_api/rest/team_user_billing_details.rb +36 -0
- data/lib/ruby_lokalise_api/rest/team_user_groups.rb +109 -0
- data/lib/ruby_lokalise_api/rest/team_users.rb +48 -0
- data/lib/ruby_lokalise_api/rest/teams.rb +16 -0
- data/lib/ruby_lokalise_api/rest/translation_providers.rb +27 -0
- data/lib/ruby_lokalise_api/rest/translations.rb +39 -0
- data/lib/ruby_lokalise_api/rest/webhooks.rb +69 -0
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/utils/attribute_helpers.rb +7 -7
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/utils/endpoint_helpers.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/utils/string_utils.rb +1 -1
- data/lib/ruby_lokalise_api/version.rb +5 -0
- data/lib/ruby_lokalise_api.rb +50 -0
- data/ruby-lokalise-api.gemspec +6 -5
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/branches_spec.rb +5 -5
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/comments_spec.rb +7 -7
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/contributors_spec.rb +9 -9
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/custom_translation_statuses_spec.rb +7 -7
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/files_spec.rb +2 -2
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/keys_spec.rb +14 -14
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/languages_spec.rb +4 -4
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/orders_spec.rb +1 -1
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/payment_cards_spec.rb +7 -7
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/projects_spec.rb +10 -10
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/queued_processes_spec.rb +1 -1
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/screenshots_spec.rb +3 -3
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/segments_spec.rb +4 -4
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/snapshots_spec.rb +8 -8
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/tasks_spec.rb +12 -12
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/team_user_billing_details_spec.rb +1 -1
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/team_user_groups_spec.rb +7 -7
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/team_users_spec.rb +3 -3
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/teams_spec.rb +1 -1
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/translation_providers_spec.rb +2 -2
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/translations_spec.rb +10 -10
- data/spec/lib/{ruby-lokalise-api/rest → ruby_lokalise_api/client}/webhooks_spec.rb +2 -2
- data/spec/lib/{ruby-lokalise-api → ruby_lokalise_api}/connection_spec.rb +8 -8
- data/spec/lib/{ruby-lokalise-api → ruby_lokalise_api}/custom_json_parser_spec.rb +3 -3
- data/spec/lib/{ruby-lokalise-api → ruby_lokalise_api}/error_spec.rb +10 -10
- data/spec/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/auth_spec.rb +3 -3
- data/spec/lib/{ruby-lokalise-api_spec.rb → ruby_lokalise_api_spec.rb} +5 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/support/test_client.rb +3 -3
- metadata +163 -149
- data/lib/ruby-lokalise-api/data/attributes.json +0 -259
- data/lib/ruby-lokalise-api/rest/branches.rb +0 -67
- data/lib/ruby-lokalise-api/rest/comments.rb +0 -59
- data/lib/ruby-lokalise-api/rest/contributors.rb +0 -56
- data/lib/ruby-lokalise-api/rest/custom_translation_statuses.rb +0 -65
- data/lib/ruby-lokalise-api/rest/files.rb +0 -36
- data/lib/ruby-lokalise-api/rest/keys.rb +0 -77
- data/lib/ruby-lokalise-api/rest/languages.rb +0 -65
- data/lib/ruby-lokalise-api/rest/orders.rb +0 -35
- data/lib/ruby-lokalise-api/rest/payment_cards.rb +0 -41
- data/lib/ruby-lokalise-api/rest/projects.rb +0 -60
- data/lib/ruby-lokalise-api/rest/queued_processes.rb +0 -26
- data/lib/ruby-lokalise-api/rest/screenshots.rb +0 -56
- data/lib/ruby-lokalise-api/rest/segments.rb +0 -43
- data/lib/ruby-lokalise-api/rest/snapshots.rb +0 -45
- data/lib/ruby-lokalise-api/rest/tasks.rb +0 -56
- data/lib/ruby-lokalise-api/rest/team_user_billing_details.rb +0 -34
- data/lib/ruby-lokalise-api/rest/team_user_group.rb +0 -107
- data/lib/ruby-lokalise-api/rest/team_users.rb +0 -46
- data/lib/ruby-lokalise-api/rest/teams.rb +0 -14
- data/lib/ruby-lokalise-api/rest/translation_providers.rb +0 -25
- data/lib/ruby-lokalise-api/rest/translations.rb +0 -37
- data/lib/ruby-lokalise-api/rest/webhooks.rb +0 -67
- data/lib/ruby-lokalise-api/version.rb +0 -5
- data/lib/ruby-lokalise-api.rb +0 -111
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module OAuth2
|
5
5
|
module Connection
|
6
6
|
BASE_URL = URI('https://app.lokalise.com/oauth2/')
|
@@ -15,7 +15,7 @@ module Lokalise
|
|
15
15
|
{
|
16
16
|
headers: {
|
17
17
|
accept: 'application/json',
|
18
|
-
user_agent: "ruby-lokalise-api gem/#{
|
18
|
+
user_agent: "ruby-lokalise-api gem/#{RubyLokaliseApi::VERSION}"
|
19
19
|
},
|
20
20
|
url: BASE_URL.to_s
|
21
21
|
}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module OAuth2
|
5
5
|
module Request
|
6
|
-
include
|
7
|
-
include
|
6
|
+
include RubyLokaliseApi::BaseRequest
|
7
|
+
include RubyLokaliseApi::OAuth2::Connection
|
8
8
|
|
9
9
|
def post(path, params = {})
|
10
10
|
respond_with connection.post(prepare(path), custom_dump(params))
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module Request
|
5
|
-
include
|
6
|
-
include
|
5
|
+
include RubyLokaliseApi::BaseRequest
|
6
|
+
include RubyLokaliseApi::Connection
|
7
7
|
|
8
8
|
# Lokalise returns pagination info in special headers
|
9
9
|
PAGINATION_HEADERS = %w[x-pagination-total-count x-pagination-page-count x-pagination-limit x-pagination-page].freeze
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module Resources
|
5
5
|
class Base
|
6
|
-
using
|
6
|
+
using RubyLokaliseApi::Utils::StringUtils
|
7
7
|
|
8
|
-
extend
|
9
|
-
extend
|
10
|
-
include
|
11
|
-
extend
|
8
|
+
extend RubyLokaliseApi::Request
|
9
|
+
extend RubyLokaliseApi::Utils::AttributeHelpers
|
10
|
+
include RubyLokaliseApi::Utils::AttributeHelpers
|
11
|
+
extend RubyLokaliseApi::Utils::EndpointHelpers
|
12
12
|
|
13
13
|
attr_reader :raw_data, :project_id, :client, :path, :branch, :user_id, :team_id, :key_id
|
14
14
|
|
@@ -19,7 +19,7 @@ module Lokalise
|
|
19
19
|
#
|
20
20
|
# @param response [Hash]
|
21
21
|
# @param endpoint_generator [Proc] Generate proper paths for certain resources
|
22
|
-
# @return [
|
22
|
+
# @return [RubyLokaliseApi::Resources::Base]
|
23
23
|
def initialize(response, endpoint_generator = nil)
|
24
24
|
populate_attributes_for response['content']
|
25
25
|
extract_common_attributes_for response['content']
|
@@ -120,7 +120,7 @@ module Lokalise
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def produce_collection(model_class, response, params)
|
123
|
-
Module.const_get("
|
123
|
+
Module.const_get("RubyLokaliseApi::Collections::#{model_class}").new(response, params)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module Resources
|
5
5
|
class File < Base
|
6
6
|
class << self
|
@@ -9,7 +9,7 @@ module Lokalise
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def upload(client, path, params)
|
12
|
-
klass =
|
12
|
+
klass = RubyLokaliseApi::Resources::QueuedProcess
|
13
13
|
klass.new post(path, client, params),
|
14
14
|
->(project_id, id) { klass.endpoint(project_id, id) }
|
15
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module Resources
|
5
5
|
class Snapshot < Base
|
6
6
|
ID_KEY = 'snapshot_id'
|
@@ -12,7 +12,7 @@ module Lokalise
|
|
12
12
|
|
13
13
|
class << self
|
14
14
|
def restore(client, path, *_args)
|
15
|
-
klass =
|
15
|
+
klass = RubyLokaliseApi::Resources::Project
|
16
16
|
klass.new post(path, client),
|
17
17
|
->(project_id, *_ids) { klass.endpoint(project_id) }
|
18
18
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Branches
|
6
|
+
# Returns all branches for the given project
|
7
|
+
#
|
8
|
+
# @see https://lokalise.com/api2docs/curl/#transition-list-all-branches-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::Branch<RubyLokaliseApi::Resources::Branch>]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def branches(project_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::Branch, :all, project_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Creates a new branch inside the given project
|
17
|
+
#
|
18
|
+
# @see https://lokalise.com/api2docs/curl/#transition-create-a-branch-post
|
19
|
+
# @return [RubyLokaliseApi::Resources::Branch]
|
20
|
+
# @param project_id [String]
|
21
|
+
# @param params [Hash]
|
22
|
+
def create_branch(project_id, params)
|
23
|
+
c_r RubyLokaliseApi::Resources::Branch, :create, project_id, params
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a single branch for the given project
|
27
|
+
#
|
28
|
+
# @see https://lokalise.com/api2docs/curl/#transition-retrieve-a-branch-get
|
29
|
+
# @return [RubyLokaliseApi::Resources::Branch]
|
30
|
+
# @param project_id [String]
|
31
|
+
# @param branch_id [String, Integer]
|
32
|
+
def branch(project_id, branch_id)
|
33
|
+
c_r RubyLokaliseApi::Resources::Branch, :find, [project_id, branch_id]
|
34
|
+
end
|
35
|
+
|
36
|
+
# Updates the given branch inside the given project
|
37
|
+
#
|
38
|
+
# @see https://lokalise.com/api2docs/curl/#transition-update-a-branch-put
|
39
|
+
# @return [RubyLokaliseApi::Resources::Branch]
|
40
|
+
# @param project_id [String]
|
41
|
+
# @param branch_id [String, Integer]
|
42
|
+
# @param params [Hash]
|
43
|
+
def update_branch(project_id, branch_id, params)
|
44
|
+
c_r RubyLokaliseApi::Resources::Branch, :update, [project_id, branch_id], params
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deletes branch inside the given project
|
48
|
+
#
|
49
|
+
# @see https://lokalise.com/api2docs/curl/#transition-delete-a-branch-delete
|
50
|
+
# @return [Hash]
|
51
|
+
# @param project_id [String]
|
52
|
+
# @param branch_id [String, Integer]
|
53
|
+
def destroy_branch(project_id, branch_id)
|
54
|
+
c_r RubyLokaliseApi::Resources::Branch, :destroy, [project_id, branch_id]
|
55
|
+
end
|
56
|
+
|
57
|
+
# Merges a branch in the project
|
58
|
+
#
|
59
|
+
# @see https://lokalise.com/api2docs/curl/#transition-merge-a-branch-post
|
60
|
+
# @return [Hash]
|
61
|
+
# @param project_id [String]
|
62
|
+
# @param branch_id [String, Integer]
|
63
|
+
# @param params [Hash]
|
64
|
+
def merge_branch(project_id, branch_id, params = {})
|
65
|
+
c_r RubyLokaliseApi::Resources::Branch, :merge, [project_id, branch_id, :merge], params
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Comments
|
6
|
+
# Returns a single comment for the given key
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-comment-get
|
9
|
+
# @return [RubyLokaliseApi::Resources::Comment]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param key_id [String, Integer]
|
12
|
+
# @param comment_id [String, Integer]
|
13
|
+
def comment(project_id, key_id, comment_id)
|
14
|
+
c_r RubyLokaliseApi::Resources::KeyComment, :find, [project_id, key_id, comment_id]
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns all comments for all keys inside the given project
|
18
|
+
#
|
19
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-project-comments-get
|
20
|
+
# @return [RubyLokaliseApi::Collection::Comment<RubyLokaliseApi::Resources::Comment>]
|
21
|
+
# @param project_id [String]
|
22
|
+
# @param params [Hash]
|
23
|
+
def project_comments(project_id, params = {})
|
24
|
+
c_r RubyLokaliseApi::Collections::ProjectComment, :all, project_id, params
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all comments for the given key inside the given project
|
28
|
+
#
|
29
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-key-comments-get
|
30
|
+
# @return [RubyLokaliseApi::Collection::Comment<RubyLokaliseApi::Resources::Comment>]
|
31
|
+
# @param project_id [String]
|
32
|
+
# @param key_id [String, Integer]
|
33
|
+
# @param params [Hash]
|
34
|
+
def comments(project_id, key_id, params = {})
|
35
|
+
c_r RubyLokaliseApi::Collections::KeyComment, :all, [project_id, key_id], params
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates one or more comments for the given key inside the given project
|
39
|
+
#
|
40
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-comments-post
|
41
|
+
# @return [RubyLokaliseApi::Collection::Comment<RubyLokaliseApi::Resources::Comment>]
|
42
|
+
# @param project_id [String]
|
43
|
+
# @param key_id [String, Integer]
|
44
|
+
# @param params [Hash, Array<Hash>]
|
45
|
+
def create_comments(project_id, key_id, params)
|
46
|
+
c_r RubyLokaliseApi::Resources::KeyComment, :create, [project_id, key_id], params, :comments
|
47
|
+
end
|
48
|
+
|
49
|
+
# Deletes comment for the given key inside the given project
|
50
|
+
#
|
51
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-comment-delete
|
52
|
+
# @return [Hash]
|
53
|
+
# @param project_id [String]
|
54
|
+
# @param key_id [String, Integer]
|
55
|
+
# @param comment_id [String, Integer]
|
56
|
+
def destroy_comment(project_id, key_id, comment_id)
|
57
|
+
c_r RubyLokaliseApi::Resources::KeyComment, :destroy, [project_id, key_id, comment_id]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Contributors
|
6
|
+
# Returns all contributors for the given project
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-contributors-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::Contributor<RubyLokaliseApi::Resources::Contributor>]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def contributors(project_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::Contributor, :all, project_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns a single contributor for the given project
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-contributor-get
|
19
|
+
# @return [RubyLokaliseApi::Resources::Contributor]
|
20
|
+
# @param project_id [String]
|
21
|
+
# @param contributor_id [String, Integer]
|
22
|
+
def contributor(project_id, contributor_id)
|
23
|
+
c_r RubyLokaliseApi::Resources::Contributor, :find, [project_id, contributor_id]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates one or more contributors inside the given project
|
27
|
+
#
|
28
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-contributors-post
|
29
|
+
# @return [RubyLokaliseApi::Collection::Contributor<RubyLokaliseApi::Resources::Contributor>]
|
30
|
+
# @param project_id [String]
|
31
|
+
# @param params [Hash, Array<Hash>]
|
32
|
+
def create_contributors(project_id, params)
|
33
|
+
c_r RubyLokaliseApi::Resources::Contributor, :create, project_id, params, :contributors
|
34
|
+
end
|
35
|
+
|
36
|
+
# Updates the given contributor inside the given project
|
37
|
+
#
|
38
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-contributor-put
|
39
|
+
# @return [RubyLokaliseApi::Resources::Contributor]
|
40
|
+
# @param project_id [String]
|
41
|
+
# @param contributor_id [String, Integer]
|
42
|
+
# @param params [Hash]
|
43
|
+
def update_contributor(project_id, contributor_id, params)
|
44
|
+
c_r RubyLokaliseApi::Resources::Contributor, :update, [project_id, contributor_id], params
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deletes contributor inside the given project
|
48
|
+
#
|
49
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-contributor-delete
|
50
|
+
# @return [Hash]
|
51
|
+
# @param project_id [String]
|
52
|
+
# @param contributor_id [String, Integer]
|
53
|
+
def destroy_contributor(project_id, contributor_id)
|
54
|
+
c_r RubyLokaliseApi::Resources::Contributor, :destroy, [project_id, contributor_id]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module CustomTranslationStatuses
|
6
|
+
# Returns all translation statuses for the given project
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-custom-translation-statuses-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::CustomTranslationStatus<RubyLokaliseApi::Resources::CustomTranslationStatus>]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def translation_statuses(project_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::CustomTranslationStatus, :all, project_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns a single translation status for the given project
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-custom-translation-status-get
|
19
|
+
# @return [RubyLokaliseApi::Resources::CustomTranslationStatus]
|
20
|
+
# @param project_id [String]
|
21
|
+
# @param status_id [String, Integer]
|
22
|
+
def translation_status(project_id, status_id)
|
23
|
+
c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :find, [project_id, status_id]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates translation status inside the given project
|
27
|
+
#
|
28
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-custom-translation-status-post
|
29
|
+
# @return RubyLokaliseApi::Resources::CustomTranslationStatus
|
30
|
+
# @param project_id [String]
|
31
|
+
# @param params Hash
|
32
|
+
def create_translation_status(project_id, params)
|
33
|
+
c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :create, project_id, params
|
34
|
+
end
|
35
|
+
|
36
|
+
# Updates the given translation status inside the given project
|
37
|
+
#
|
38
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-custom-translation-status-put
|
39
|
+
# @return [RubyLokaliseApi::Resources::CustomTranslationStatus]
|
40
|
+
# @param project_id [String]
|
41
|
+
# @param status_id [String, Integer]
|
42
|
+
# @param params [Hash]
|
43
|
+
def update_translation_status(project_id, status_id, params)
|
44
|
+
c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :update, [project_id, status_id], params
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deletes translation status inside the given project
|
48
|
+
#
|
49
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-custom-translation-status-delete
|
50
|
+
# @return [Hash]
|
51
|
+
# @param project_id [String]
|
52
|
+
# @param status_id [String, Integer]
|
53
|
+
def destroy_translation_status(project_id, status_id)
|
54
|
+
c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :destroy, [project_id, status_id]
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns an array of available colors that can be assigned to custom translation statuses
|
58
|
+
#
|
59
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-available-colors-for-custom-translation-statuses-get
|
60
|
+
# @return [Array]
|
61
|
+
# @param project_id [String]
|
62
|
+
def translation_status_colors(project_id)
|
63
|
+
c_r RubyLokaliseApi::Resources::CustomTranslationStatus, :colors, [project_id, 'colors']
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Files
|
6
|
+
# Returns all translation files for the given project
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-files-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::File<RubyLokaliseApi::Resources::File>]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def files(project_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::File, :all, project_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# 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
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-download-files-post
|
19
|
+
# @return [Hash]
|
20
|
+
# @param project_id [String]
|
21
|
+
# @param params [Hash]
|
22
|
+
def download_files(project_id, params)
|
23
|
+
c_r RubyLokaliseApi::Resources::File, :download, [project_id, 'download'], params
|
24
|
+
end
|
25
|
+
|
26
|
+
# Imports translation file to the given project. File data must base64-encoded.
|
27
|
+
# To encode your data in Base64, use `Base64.strict_encode64()` method.
|
28
|
+
#
|
29
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-upload-a-file-post
|
30
|
+
# @return [Hash]
|
31
|
+
# @param project_id [String]
|
32
|
+
# @param params [Hash]
|
33
|
+
def upload_file(project_id, params)
|
34
|
+
c_r RubyLokaliseApi::Resources::File, :upload, [project_id, 'upload'], params
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|