ruby-lokalise-api 5.0.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +7 -5
- 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 +16 -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 +49 -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 +8 -7
- metadata +125 -157
- 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
- data/spec/lib/ruby-lokalise-api/connection_spec.rb +0 -68
- data/spec/lib/ruby-lokalise-api/custom_json_parser_spec.rb +0 -81
- data/spec/lib/ruby-lokalise-api/error_spec.rb +0 -41
- data/spec/lib/ruby-lokalise-api/oauth2/auth_spec.rb +0 -73
- data/spec/lib/ruby-lokalise-api/rest/branches_spec.rb +0 -140
- data/spec/lib/ruby-lokalise-api/rest/comments_spec.rb +0 -118
- data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +0 -132
- data/spec/lib/ruby-lokalise-api/rest/custom_translation_statuses_spec.rb +0 -131
- data/spec/lib/ruby-lokalise-api/rest/files_spec.rb +0 -66
- data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +0 -199
- data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +0 -134
- data/spec/lib/ruby-lokalise-api/rest/orders_spec.rb +0 -113
- data/spec/lib/ruby-lokalise-api/rest/payment_cards_spec.rb +0 -92
- data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +0 -150
- data/spec/lib/ruby-lokalise-api/rest/queued_processes_spec.rb +0 -57
- data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +0 -127
- data/spec/lib/ruby-lokalise-api/rest/segments_spec.rb +0 -106
- data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +0 -117
- data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +0 -145
- data/spec/lib/ruby-lokalise-api/rest/team_user_billing_details_spec.rb +0 -48
- data/spec/lib/ruby-lokalise-api/rest/team_user_groups_spec.rb +0 -278
- data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +0 -95
- data/spec/lib/ruby-lokalise-api/rest/teams_spec.rb +0 -25
- data/spec/lib/ruby-lokalise-api/rest/translation_providers_spec.rb +0 -48
- data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +0 -118
- data/spec/lib/ruby-lokalise-api/rest/webhooks_spec.rb +0 -126
- data/spec/lib/ruby-lokalise-api_spec.rb +0 -47
- data/spec/spec_helper.rb +0 -22
- data/spec/support/test_client.rb +0 -15
- data/spec/support/vcr.rb +0 -15
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
class Error < StandardError
|
5
5
|
ClientError = Class.new(self)
|
6
6
|
ServerError = Class.new(self)
|
@@ -21,19 +21,19 @@ module Lokalise
|
|
21
21
|
GatewayTimeout = Class.new(ServerError)
|
22
22
|
|
23
23
|
ERRORS = {
|
24
|
-
400 =>
|
25
|
-
401 =>
|
26
|
-
403 =>
|
27
|
-
404 =>
|
28
|
-
405 =>
|
29
|
-
406 =>
|
30
|
-
409 =>
|
31
|
-
423 =>
|
32
|
-
429 =>
|
33
|
-
500 =>
|
34
|
-
502 =>
|
35
|
-
503 =>
|
36
|
-
504 =>
|
24
|
+
400 => RubyLokaliseApi::Error::BadRequest,
|
25
|
+
401 => RubyLokaliseApi::Error::Unauthorized,
|
26
|
+
403 => RubyLokaliseApi::Error::Forbidden,
|
27
|
+
404 => RubyLokaliseApi::Error::NotFound,
|
28
|
+
405 => RubyLokaliseApi::Error::MethodNotAllowed,
|
29
|
+
406 => RubyLokaliseApi::Error::NotAcceptable,
|
30
|
+
409 => RubyLokaliseApi::Error::Conflict,
|
31
|
+
423 => RubyLokaliseApi::Error::Locked,
|
32
|
+
429 => RubyLokaliseApi::Error::TooManyRequests,
|
33
|
+
500 => RubyLokaliseApi::Error::ServerError,
|
34
|
+
502 => RubyLokaliseApi::Error::BadGateway,
|
35
|
+
503 => RubyLokaliseApi::Error::ServiceUnavailable,
|
36
|
+
504 => RubyLokaliseApi::Error::GatewayTimeout
|
37
37
|
}.freeze
|
38
38
|
|
39
39
|
class << self
|
@@ -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']
|
@@ -27,6 +27,14 @@ module Lokalise
|
|
27
27
|
@path = infer_path_from response, endpoint_generator
|
28
28
|
end
|
29
29
|
|
30
|
+
def [](raw_key_attr)
|
31
|
+
key_attr = raw_key_attr.to_s.to_sym
|
32
|
+
|
33
|
+
return nil unless self.instance_variables.include?(:"@#{key_attr}")
|
34
|
+
|
35
|
+
self.send key_attr
|
36
|
+
end
|
37
|
+
|
30
38
|
class << self
|
31
39
|
# Dynamically adds attribute readers for each inherited class.
|
32
40
|
# Attributes are defined in the `data/attributes.json` file.
|
@@ -120,7 +128,7 @@ module Lokalise
|
|
120
128
|
end
|
121
129
|
|
122
130
|
def produce_collection(model_class, response, params)
|
123
|
-
Module.const_get("
|
131
|
+
Module.const_get("RubyLokaliseApi::Collections::#{model_class}").new(response, params)
|
124
132
|
end
|
125
133
|
end
|
126
134
|
|
@@ -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://developers.lokalise.com/reference/list-all-branches
|
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://developers.lokalise.com/reference/create-a-branch
|
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://developers.lokalise.com/reference/retrieve-a-branch
|
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://developers.lokalise.com/reference/update-a-branch
|
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://developers.lokalise.com/reference/delete-a-branch
|
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://developers.lokalise.com/reference/merge-a-branch
|
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://developers.lokalise.com/reference/retrieve-a-comment
|
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://developers.lokalise.com/reference/list-project-comments
|
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://developers.lokalise.com/reference/list-key-comments
|
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://developers.lokalise.com/reference/create-comments
|
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://developers.lokalise.com/reference/delete-a-comment
|
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://developers.lokalise.com/reference/list-all-contributors
|
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://developers.lokalise.com/reference/retrieve-a-contributor
|
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://developers.lokalise.com/reference/create-contributors
|
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://developers.lokalise.com/reference/update-a-contributor
|
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://developers.lokalise.com/reference/delete-a-contributor
|
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
|