ruby-lokalise-api 7.2.0 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_lokalise_api/base_client.rb +2 -34
- data/lib/ruby_lokalise_api/client.rb +2 -31
- data/lib/ruby_lokalise_api/collections/base.rb +97 -70
- data/lib/ruby_lokalise_api/collections/branches.rb +11 -0
- data/lib/ruby_lokalise_api/collections/contributors.rb +10 -0
- data/lib/ruby_lokalise_api/collections/custom_translation_statuses.rb +10 -0
- data/lib/ruby_lokalise_api/collections/files.rb +10 -0
- data/lib/ruby_lokalise_api/collections/key_comments.rb +11 -0
- data/lib/ruby_lokalise_api/collections/keys.rb +10 -0
- data/lib/ruby_lokalise_api/collections/orders.rb +10 -0
- data/lib/ruby_lokalise_api/collections/payment_cards.rb +10 -0
- data/lib/ruby_lokalise_api/collections/project_comments.rb +12 -0
- data/lib/ruby_lokalise_api/collections/project_languages.rb +11 -0
- data/lib/ruby_lokalise_api/collections/projects.rb +10 -0
- data/lib/ruby_lokalise_api/collections/queued_processes.rb +11 -0
- data/lib/ruby_lokalise_api/collections/screenshots.rb +10 -0
- data/lib/ruby_lokalise_api/collections/segments.rb +10 -0
- data/lib/ruby_lokalise_api/collections/snapshots.rb +10 -0
- data/lib/ruby_lokalise_api/collections/system_languages.rb +11 -0
- data/lib/ruby_lokalise_api/collections/tasks.rb +10 -0
- data/lib/ruby_lokalise_api/collections/team_user_groups.rb +11 -0
- data/lib/ruby_lokalise_api/collections/team_users.rb +10 -0
- data/lib/ruby_lokalise_api/collections/teams.rb +10 -0
- data/lib/ruby_lokalise_api/collections/translation_providers.rb +10 -0
- data/lib/ruby_lokalise_api/collections/translations.rb +10 -0
- data/lib/ruby_lokalise_api/collections/webhooks.rb +10 -0
- data/lib/ruby_lokalise_api/concerns/attrs_loadable.rb +32 -0
- data/lib/ruby_lokalise_api/concerns/hash_accessible.rb +16 -0
- data/lib/ruby_lokalise_api/concerns/unsupportable.rb +16 -0
- data/lib/ruby_lokalise_api/connection.rb +17 -9
- data/lib/ruby_lokalise_api/data/collection_attributes.yml +52 -0
- data/lib/ruby_lokalise_api/data/{attributes.yml → resource_attributes.yml} +64 -6
- data/lib/ruby_lokalise_api/endpoints/base_endpoint.rb +66 -0
- data/lib/ruby_lokalise_api/endpoints/branches_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/contributors_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/custom_translation_statuses_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/files_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/jwts_endpoint.rb +15 -0
- data/lib/ruby_lokalise_api/endpoints/key_comments_endpoint.rb +17 -0
- data/lib/ruby_lokalise_api/endpoints/keys_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/main_endpoint.rb +25 -0
- data/lib/ruby_lokalise_api/endpoints/oauth2/oauth2_endpoint.rb +33 -0
- data/lib/ruby_lokalise_api/endpoints/orders_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/payment_cards_endpoint.rb +15 -0
- data/lib/ruby_lokalise_api/endpoints/project_comments_endpoint.rb +15 -0
- data/lib/ruby_lokalise_api/endpoints/project_languages_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/projects_endpoint.rb +15 -0
- data/lib/ruby_lokalise_api/endpoints/queued_processes_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/screenshots_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/segments_endpoint.rb +17 -0
- data/lib/ruby_lokalise_api/endpoints/snapshots_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/system_languages_endpoint.rb +15 -0
- data/lib/ruby_lokalise_api/endpoints/tasks_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/team_user_billing_details_endpoint.rb +15 -0
- data/lib/ruby_lokalise_api/endpoints/team_user_groups_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/team_users_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/teams_endpoint.rb +13 -0
- data/lib/ruby_lokalise_api/endpoints/translation_providers_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/translations_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/endpoints/webhooks_endpoint.rb +16 -0
- data/lib/ruby_lokalise_api/error.rb +1 -0
- data/lib/ruby_lokalise_api/generics.rb +25 -0
- data/lib/ruby_lokalise_api/json_handler.rb +1 -2
- data/lib/ruby_lokalise_api/oauth2/auth.rb +48 -39
- data/lib/ruby_lokalise_api/oauth2_client.rb +3 -0
- data/lib/ruby_lokalise_api/request.rb +66 -18
- data/lib/ruby_lokalise_api/resources/base.rb +41 -185
- data/lib/ruby_lokalise_api/resources/branch.rb +2 -21
- data/lib/ruby_lokalise_api/resources/comment.rb +11 -0
- data/lib/ruby_lokalise_api/resources/contributor.rb +1 -9
- data/lib/ruby_lokalise_api/resources/custom_translation_status.rb +1 -13
- data/lib/ruby_lokalise_api/resources/file.rb +2 -16
- data/lib/ruby_lokalise_api/resources/jwt.rb +2 -5
- data/lib/ruby_lokalise_api/resources/key.rb +5 -8
- data/lib/ruby_lokalise_api/resources/oauth2_refreshed_token.rb +9 -0
- data/lib/ruby_lokalise_api/resources/oauth2_token.rb +9 -0
- data/lib/ruby_lokalise_api/resources/order.rb +2 -9
- data/lib/ruby_lokalise_api/resources/payment_card.rb +2 -8
- data/lib/ruby_lokalise_api/resources/project.rb +85 -16
- data/lib/ruby_lokalise_api/resources/project_language.rb +2 -10
- data/lib/ruby_lokalise_api/resources/queued_process.rb +3 -10
- data/lib/ruby_lokalise_api/resources/screenshot.rb +1 -9
- data/lib/ruby_lokalise_api/resources/segment.rb +2 -11
- data/lib/ruby_lokalise_api/resources/snapshot.rb +3 -18
- data/lib/ruby_lokalise_api/resources/system_language.rb +2 -1
- data/lib/ruby_lokalise_api/resources/task.rb +1 -9
- data/lib/ruby_lokalise_api/resources/team.rb +2 -0
- data/lib/ruby_lokalise_api/resources/team_user.rb +1 -9
- data/lib/ruby_lokalise_api/resources/team_user_billing_details.rb +10 -5
- data/lib/ruby_lokalise_api/resources/team_user_group.rb +6 -14
- data/lib/ruby_lokalise_api/resources/translation.rb +2 -9
- data/lib/ruby_lokalise_api/resources/translation_provider.rb +2 -9
- data/lib/ruby_lokalise_api/resources/webhook.rb +2 -16
- data/lib/ruby_lokalise_api/response.rb +50 -0
- data/lib/ruby_lokalise_api/rest/branches.rb +52 -27
- data/lib/ruby_lokalise_api/rest/comments.rb +48 -23
- data/lib/ruby_lokalise_api/rest/contributors.rb +47 -23
- data/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb +60 -36
- data/lib/ruby_lokalise_api/rest/files.rb +43 -24
- data/lib/ruby_lokalise_api/rest/jwts.rb +21 -0
- data/lib/ruby_lokalise_api/rest/keys.rb +67 -34
- data/lib/ruby_lokalise_api/rest/languages.rb +57 -28
- data/lib/ruby_lokalise_api/rest/orders.rb +36 -14
- data/lib/ruby_lokalise_api/rest/payment_cards.rb +29 -12
- data/lib/ruby_lokalise_api/rest/projects.rb +55 -32
- data/lib/ruby_lokalise_api/rest/queued_processes.rb +21 -13
- data/lib/ruby_lokalise_api/rest/screenshots.rb +45 -20
- data/lib/ruby_lokalise_api/rest/segments.rb +31 -18
- data/lib/ruby_lokalise_api/rest/snapshots.rb +34 -14
- data/lib/ruby_lokalise_api/rest/tasks.rb +41 -19
- data/lib/ruby_lokalise_api/rest/team_user_billing_details.rb +33 -12
- data/lib/ruby_lokalise_api/rest/team_user_groups.rb +82 -50
- data/lib/ruby_lokalise_api/rest/team_users.rb +35 -18
- data/lib/ruby_lokalise_api/rest/teams.rb +10 -5
- data/lib/ruby_lokalise_api/rest/translation_providers.rb +24 -9
- data/lib/ruby_lokalise_api/rest/translations.rb +28 -15
- data/lib/ruby_lokalise_api/rest/webhooks.rb +54 -30
- data/lib/ruby_lokalise_api/rest.rb +31 -0
- data/lib/ruby_lokalise_api/utils/attributes.rb +37 -0
- data/lib/ruby_lokalise_api/utils/classes.rb +28 -0
- data/lib/ruby_lokalise_api/utils/keys.rb +33 -0
- data/lib/ruby_lokalise_api/utils/loaders.rb +27 -0
- data/lib/ruby_lokalise_api/utils/strings.rb +20 -0
- data/lib/ruby_lokalise_api/version.rb +1 -1
- data/lib/ruby_lokalise_api.rb +6 -2
- data/ruby-lokalise-api.gemspec +3 -3
- metadata +76 -47
- data/lib/ruby_lokalise_api/base_request.rb +0 -73
- data/lib/ruby_lokalise_api/collections/branch.rb +0 -15
- data/lib/ruby_lokalise_api/collections/contributor.rb +0 -13
- data/lib/ruby_lokalise_api/collections/custom_translation_status.rb +0 -15
- data/lib/ruby_lokalise_api/collections/file.rb +0 -13
- data/lib/ruby_lokalise_api/collections/key.rb +0 -20
- data/lib/ruby_lokalise_api/collections/key_comment.rb +0 -14
- data/lib/ruby_lokalise_api/collections/order.rb +0 -13
- data/lib/ruby_lokalise_api/collections/payment_card.rb +0 -13
- data/lib/ruby_lokalise_api/collections/project.rb +0 -13
- data/lib/ruby_lokalise_api/collections/project_comment.rb +0 -13
- data/lib/ruby_lokalise_api/collections/project_language.rb +0 -13
- data/lib/ruby_lokalise_api/collections/queued_process.rb +0 -15
- data/lib/ruby_lokalise_api/collections/screenshot.rb +0 -13
- data/lib/ruby_lokalise_api/collections/segment.rb +0 -15
- data/lib/ruby_lokalise_api/collections/snapshot.rb +0 -13
- data/lib/ruby_lokalise_api/collections/system_language.rb +0 -13
- data/lib/ruby_lokalise_api/collections/task.rb +0 -13
- data/lib/ruby_lokalise_api/collections/team.rb +0 -13
- data/lib/ruby_lokalise_api/collections/team_user.rb +0 -13
- data/lib/ruby_lokalise_api/collections/team_user_group.rb +0 -15
- data/lib/ruby_lokalise_api/collections/translation.rb +0 -13
- data/lib/ruby_lokalise_api/collections/translation_provider.rb +0 -13
- data/lib/ruby_lokalise_api/collections/webhook.rb +0 -13
- data/lib/ruby_lokalise_api/oauth2/refresh.rb +0 -16
- data/lib/ruby_lokalise_api/oauth2/token.rb +0 -16
- data/lib/ruby_lokalise_api/resources/key_comment.rb +0 -19
- data/lib/ruby_lokalise_api/resources/project_comment.rb +0 -10
- data/lib/ruby_lokalise_api/rest/jwt.rb +0 -15
- data/lib/ruby_lokalise_api/utils/attribute_helpers.rb +0 -86
- data/lib/ruby_lokalise_api/utils/endpoint_helpers.rb +0 -14
- data/lib/ruby_lokalise_api/utils/string_utils.rb +0 -33
@@ -3,59 +3,82 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module Projects
|
6
|
-
# Returns all projects available to the user authorized with the API token
|
7
|
-
#
|
8
|
-
# @see https://developers.lokalise.com/reference/list-all-projects
|
9
|
-
# @return [RubyLokaliseApi::Collection::Project<RubyLokaliseApi::Resources::Project>]
|
10
|
-
# @param params [Hash]
|
11
|
-
def projects(params = {})
|
12
|
-
c_r RubyLokaliseApi::Collections::Project, :all, nil, params
|
13
|
-
end
|
14
|
-
|
15
6
|
# Returns a single project
|
16
7
|
#
|
17
8
|
# @see https://developers.lokalise.com/reference/retrieve-a-project
|
18
9
|
# @return [RubyLokaliseApi::Resources::Project]
|
19
|
-
# @param project_id [String
|
10
|
+
# @param project_id [String]
|
20
11
|
def project(project_id)
|
21
|
-
|
12
|
+
params = { query: project_id }
|
13
|
+
|
14
|
+
data = endpoint(name: 'Projects', params: params).do_get
|
15
|
+
|
16
|
+
resource 'Project', data
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns a collection of projects
|
20
|
+
#
|
21
|
+
# @see https://developers.lokalise.com/reference/list-all-projects
|
22
|
+
# @return [RubyLokaliseApi::Collections::Projects]
|
23
|
+
# @param req_params [Hash]
|
24
|
+
def projects(req_params = {})
|
25
|
+
name = 'Projects'
|
26
|
+
params = { req: req_params }
|
27
|
+
|
28
|
+
data = endpoint(name: name, params: params).do_get
|
29
|
+
|
30
|
+
collection name, data
|
22
31
|
end
|
23
32
|
|
24
|
-
# Creates project
|
33
|
+
# Creates a project
|
25
34
|
#
|
26
35
|
# @see https://developers.lokalise.com/reference/create-a-project
|
27
36
|
# @return [RubyLokaliseApi::Resources::Project]
|
28
|
-
# @param
|
29
|
-
def create_project(
|
30
|
-
|
37
|
+
# @param req_params [Hash]
|
38
|
+
def create_project(req_params)
|
39
|
+
params = { req: req_params }
|
40
|
+
|
41
|
+
data = endpoint(name: 'Projects', params: params).do_post
|
42
|
+
|
43
|
+
resource 'Project', data
|
31
44
|
end
|
32
45
|
|
33
|
-
# Updates project
|
46
|
+
# Updates a project
|
34
47
|
#
|
35
48
|
# @see https://developers.lokalise.com/reference/update-a-project
|
36
49
|
# @return [RubyLokaliseApi::Resources::Project]
|
37
|
-
# @param project_id [String
|
38
|
-
# @param
|
39
|
-
def update_project(project_id,
|
40
|
-
|
41
|
-
end
|
50
|
+
# @param project_id [String]
|
51
|
+
# @param req_params [Hash]
|
52
|
+
def update_project(project_id, req_params)
|
53
|
+
params = { query: project_id, req: req_params }
|
42
54
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
# @return [Hash]
|
47
|
-
# @param project_id [String, Integer]
|
48
|
-
def empty_project(project_id)
|
49
|
-
c_r RubyLokaliseApi::Resources::Project, :empty, [project_id, 'empty']
|
55
|
+
data = endpoint(name: 'Projects', params: params).do_put
|
56
|
+
|
57
|
+
resource 'Project', data
|
50
58
|
end
|
51
59
|
|
52
|
-
# Deletes
|
60
|
+
# Deletes a project
|
53
61
|
#
|
54
62
|
# @see https://developers.lokalise.com/reference/delete-a-project
|
55
|
-
# @return [
|
56
|
-
# @param project_id [String
|
63
|
+
# @return [RubyLokaliseApi::Generics::DeletedResource]
|
64
|
+
# @param project_id [String]
|
57
65
|
def destroy_project(project_id)
|
58
|
-
|
66
|
+
params = { query: project_id }
|
67
|
+
|
68
|
+
data = endpoint(name: 'Projects', params: params).do_delete
|
69
|
+
|
70
|
+
RubyLokaliseApi::Generics::DeletedResource.new data.content
|
71
|
+
end
|
72
|
+
|
73
|
+
# Empties a project by deleting all keys and translations
|
74
|
+
#
|
75
|
+
# @see https://developers.lokalise.com/reference/empty-a-project
|
76
|
+
# @return [RubyLokaliseApi::Generics::EmptiedResource]
|
77
|
+
# @param project_id [String]
|
78
|
+
def empty_project(project_id)
|
79
|
+
data = endpoint(name: 'Projects', params: { query: [project_id, :empty] }).do_put
|
80
|
+
|
81
|
+
RubyLokaliseApi::Generics::EmptiedResource.new data.content
|
59
82
|
end
|
60
83
|
end
|
61
84
|
end
|
@@ -3,25 +3,33 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module QueuedProcesses
|
6
|
-
# Returns
|
6
|
+
# Returns a single queued process
|
7
7
|
#
|
8
|
-
# @see https://developers.lokalise.com/reference/
|
9
|
-
# @return [RubyLokaliseApi::
|
8
|
+
# @see https://developers.lokalise.com/reference/retrieve-a-process
|
9
|
+
# @return [RubyLokaliseApi::Resources::QueuedProcess]
|
10
10
|
# @param project_id [String]
|
11
|
-
# @param
|
12
|
-
def
|
13
|
-
|
11
|
+
# @param process_id [String, Integer]
|
12
|
+
def queued_process(project_id, process_id)
|
13
|
+
params = { query: [project_id, process_id] }
|
14
|
+
|
15
|
+
data = endpoint(name: 'QueuedProcesses', params: params).do_get
|
16
|
+
|
17
|
+
resource 'QueuedProcess', data
|
14
18
|
end
|
15
19
|
|
16
|
-
# Returns
|
20
|
+
# Returns queued processes
|
17
21
|
#
|
18
|
-
# @see https://developers.lokalise.com/reference/
|
19
|
-
# @return [RubyLokaliseApi::
|
22
|
+
# @see https://developers.lokalise.com/reference/list-all-processes
|
23
|
+
# @return [RubyLokaliseApi::Collections::QueuedProcesses]
|
20
24
|
# @param project_id [String]
|
21
|
-
# @param
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
+
# @param req_params [Hash]
|
26
|
+
def queued_processes(project_id, req_params = {})
|
27
|
+
name = 'QueuedProcesses'
|
28
|
+
params = { query: project_id, req: req_params }
|
29
|
+
|
30
|
+
data = endpoint(name: name, params: params).do_get
|
31
|
+
|
32
|
+
collection name, data
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
@@ -3,55 +3,80 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module Screenshots
|
6
|
-
|
6
|
+
using RubyLokaliseApi::Utils::Classes
|
7
|
+
|
8
|
+
# Returns project screenshots
|
7
9
|
#
|
8
10
|
# @see https://developers.lokalise.com/reference/list-all-screenshots
|
9
|
-
# @return [RubyLokaliseApi::
|
11
|
+
# @return [RubyLokaliseApi::Collections::Screenshots]
|
10
12
|
# @param project_id [String]
|
11
|
-
# @param
|
12
|
-
def screenshots(project_id,
|
13
|
-
|
13
|
+
# @param req_params [Hash]
|
14
|
+
def screenshots(project_id, req_params = {})
|
15
|
+
name = 'Screenshots'
|
16
|
+
params = { query: project_id, req: req_params }
|
17
|
+
|
18
|
+
data = endpoint(name: name, params: params).do_get
|
19
|
+
|
20
|
+
collection name, data
|
14
21
|
end
|
15
22
|
|
16
|
-
# Returns a single screenshot
|
23
|
+
# Returns a single screenshot
|
17
24
|
#
|
18
25
|
# @see https://developers.lokalise.com/reference/retrieve-a-screenshot
|
19
26
|
# @return [RubyLokaliseApi::Resources::Screenshot]
|
20
27
|
# @param project_id [String]
|
21
28
|
# @param screenshot_id [String, Integer]
|
22
|
-
|
23
|
-
|
29
|
+
# @param req_params[Hash]
|
30
|
+
def screenshot(project_id, screenshot_id, req_params = {})
|
31
|
+
params = { query: [project_id, screenshot_id], req: req_params }
|
32
|
+
|
33
|
+
data = endpoint(name: 'Screenshots', params: params).do_get
|
34
|
+
|
35
|
+
resource 'Screenshot', data
|
24
36
|
end
|
25
37
|
|
26
|
-
# Creates
|
38
|
+
# Creates a new order
|
27
39
|
#
|
28
40
|
# @see https://developers.lokalise.com/reference/create-screenshots
|
29
|
-
# @return [RubyLokaliseApi::
|
41
|
+
# @return [RubyLokaliseApi::Collections::Screenshots]
|
30
42
|
# @param project_id [String]
|
31
|
-
# @param
|
32
|
-
def create_screenshots(project_id,
|
33
|
-
|
43
|
+
# @param req_params [Hash, Array]
|
44
|
+
def create_screenshots(project_id, req_params)
|
45
|
+
name = 'Screenshots'
|
46
|
+
params = { query: project_id, req: req_params.to_array_obj(:screenshots) }
|
47
|
+
|
48
|
+
data = endpoint(name: name, params: params).do_post
|
49
|
+
|
50
|
+
collection name, data
|
34
51
|
end
|
35
52
|
|
36
|
-
# Updates screenshot
|
53
|
+
# Updates a screenshot
|
37
54
|
#
|
38
55
|
# @see https://developers.lokalise.com/reference/update-a-screenshot
|
39
56
|
# @return [RubyLokaliseApi::Resources::Screenshot]
|
40
57
|
# @param project_id [String]
|
41
58
|
# @param screenshot_id [String, Integer]
|
42
|
-
# @param
|
43
|
-
def update_screenshot(project_id, screenshot_id,
|
44
|
-
|
59
|
+
# @param req_params [Hash]
|
60
|
+
def update_screenshot(project_id, screenshot_id, req_params = {})
|
61
|
+
params = { query: [project_id, screenshot_id], req: req_params }
|
62
|
+
|
63
|
+
data = endpoint(name: 'Screenshots', params: params).do_put
|
64
|
+
|
65
|
+
resource 'Screenshot', data
|
45
66
|
end
|
46
67
|
|
47
|
-
# Deletes screenshot
|
68
|
+
# Deletes a screenshot
|
48
69
|
#
|
49
70
|
# @see https://developers.lokalise.com/reference/delete-a-screenshot
|
50
|
-
# @return [
|
71
|
+
# @return [RubyLokaliseApi::Generics::DeletedResource]
|
51
72
|
# @param project_id [String]
|
52
73
|
# @param screenshot_id [String, Integer]
|
53
74
|
def destroy_screenshot(project_id, screenshot_id)
|
54
|
-
|
75
|
+
params = { query: [project_id, screenshot_id] }
|
76
|
+
|
77
|
+
data = endpoint(name: 'Screenshots', params: params).do_delete
|
78
|
+
|
79
|
+
RubyLokaliseApi::Generics::DeletedResource.new data.content
|
55
80
|
end
|
56
81
|
end
|
57
82
|
end
|
@@ -3,42 +3,55 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module Segments
|
6
|
-
# Returns
|
6
|
+
# Returns project segments
|
7
7
|
#
|
8
8
|
# @see https://developers.lokalise.com/reference/list-all-segments-for-key-language
|
9
|
-
# @return [RubyLokaliseApi::
|
9
|
+
# @return [RubyLokaliseApi::Collections::Segments]
|
10
10
|
# @param project_id [String]
|
11
11
|
# @param key_id [String, Integer]
|
12
|
-
# @param
|
13
|
-
# @param
|
14
|
-
def segments(project_id, key_id,
|
15
|
-
|
12
|
+
# @param language_iso [String]
|
13
|
+
# @param req_params [Hash]
|
14
|
+
def segments(project_id, key_id, language_iso, req_params = {})
|
15
|
+
name = 'Segments'
|
16
|
+
params = { query: [project_id, key_id, language_iso], req: req_params }
|
17
|
+
|
18
|
+
data = endpoint(name: name, params: params).do_get
|
19
|
+
|
20
|
+
collection name, data
|
16
21
|
end
|
17
22
|
|
18
|
-
# Returns a
|
23
|
+
# Returns a single project segment
|
19
24
|
#
|
20
25
|
# @see https://developers.lokalise.com/reference/retrieve-a-segment-for-key-language
|
21
26
|
# @return [RubyLokaliseApi::Resources::Segment]
|
22
27
|
# @param project_id [String]
|
23
28
|
# @param key_id [String, Integer]
|
24
|
-
# @param
|
25
|
-
# @
|
26
|
-
# @param
|
27
|
-
def segment(project_id, key_id,
|
28
|
-
|
29
|
+
# @param language_iso [String]
|
30
|
+
# @param segment_number [String, Integer]
|
31
|
+
# @param req_params [Hash]
|
32
|
+
def segment(project_id, key_id, language_iso, segment_number, req_params = {})
|
33
|
+
params = { query: [project_id, key_id, language_iso, segment_number], req: req_params }
|
34
|
+
|
35
|
+
data = endpoint(name: 'Segments', params: params).do_get
|
36
|
+
|
37
|
+
resource 'Segment', data
|
29
38
|
end
|
30
39
|
|
31
|
-
# Updates a segment
|
40
|
+
# Updates a segment
|
32
41
|
#
|
33
42
|
# @see https://developers.lokalise.com/reference/update-a-segment
|
34
43
|
# @return [RubyLokaliseApi::Resources::Segment]
|
35
44
|
# @param project_id [String]
|
36
45
|
# @param key_id [String, Integer]
|
37
|
-
# @param
|
38
|
-
# @
|
39
|
-
# @param
|
40
|
-
def update_segment(project_id, key_id,
|
41
|
-
|
46
|
+
# @param language_iso [String]
|
47
|
+
# @param segment_number [String, Integer]
|
48
|
+
# @param req_params [Hash]
|
49
|
+
def update_segment(project_id, key_id, language_iso, segment_number, req_params = {})
|
50
|
+
params = { query: [project_id, key_id, language_iso, segment_number], req: req_params }
|
51
|
+
|
52
|
+
data = endpoint(name: 'Segments', params: params).do_put
|
53
|
+
|
54
|
+
resource 'Segment', data
|
42
55
|
end
|
43
56
|
end
|
44
57
|
end
|
@@ -3,44 +3,64 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module Snapshots
|
6
|
-
# Returns
|
6
|
+
# Returns project snapshots
|
7
7
|
#
|
8
8
|
# @see https://developers.lokalise.com/reference/list-all-snapshots
|
9
|
-
# @return [RubyLokaliseApi::
|
9
|
+
# @return [RubyLokaliseApi::Collections::Snapshots]
|
10
10
|
# @param project_id [String]
|
11
|
-
# @param
|
12
|
-
def snapshots(project_id,
|
13
|
-
|
11
|
+
# @param req_params [Hash]
|
12
|
+
def snapshots(project_id, req_params = {})
|
13
|
+
name = 'Snapshots'
|
14
|
+
params = { query: project_id, req: req_params }
|
15
|
+
|
16
|
+
data = endpoint(name: name, params: params).do_get
|
17
|
+
|
18
|
+
collection name, data
|
14
19
|
end
|
15
20
|
|
16
|
-
# Creates snapshot
|
21
|
+
# Creates a snapshot
|
17
22
|
#
|
18
23
|
# @see https://developers.lokalise.com/reference/create-a-snapshot
|
19
24
|
# @return [RubyLokaliseApi::Resources::Snapshot]
|
20
25
|
# @param project_id [String]
|
21
|
-
# @param
|
22
|
-
def create_snapshot(project_id,
|
23
|
-
|
26
|
+
# @param req_params [Hash]
|
27
|
+
def create_snapshot(project_id, req_params = {})
|
28
|
+
params = { query: project_id, req: req_params }
|
29
|
+
|
30
|
+
data = endpoint(name: 'Snapshots', params: params).do_post
|
31
|
+
|
32
|
+
resource 'Snapshot', data
|
24
33
|
end
|
25
34
|
|
26
|
-
#
|
35
|
+
# Restores a snapshot by creating a project copy
|
27
36
|
#
|
28
37
|
# @see https://developers.lokalise.com/reference/restore-a-snapshot
|
29
38
|
# @return [RubyLokaliseApi::Resources::Project]
|
30
39
|
# @param project_id [String]
|
31
40
|
# @param snapshot_id [String, Integer]
|
32
41
|
def restore_snapshot(project_id, snapshot_id)
|
33
|
-
|
42
|
+
params = { query: [project_id, snapshot_id] }
|
43
|
+
|
44
|
+
response = endpoint(name: 'Snapshots', params: params).do_post
|
45
|
+
|
46
|
+
# We restore a project so its endpoint is different
|
47
|
+
response.patch_endpoint_with endpoint(name: 'Projects', params: { query: [project_id] })
|
48
|
+
|
49
|
+
resource 'Project', response
|
34
50
|
end
|
35
51
|
|
36
|
-
# Deletes snapshot
|
52
|
+
# Deletes a snapshot
|
37
53
|
#
|
38
54
|
# @see https://developers.lokalise.com/reference/delete-a-snapshot
|
39
|
-
# @return [
|
55
|
+
# @return [RubyLokaliseApi::Generics::DeletedResource]
|
40
56
|
# @param project_id [String]
|
41
57
|
# @param snapshot_id [String, Integer]
|
42
58
|
def destroy_snapshot(project_id, snapshot_id)
|
43
|
-
|
59
|
+
params = { query: [project_id, snapshot_id] }
|
60
|
+
|
61
|
+
data = endpoint(name: 'Snapshots', params: params).do_delete
|
62
|
+
|
63
|
+
RubyLokaliseApi::Generics::DeletedResource.new data.content
|
44
64
|
end
|
45
65
|
end
|
46
66
|
end
|
@@ -3,55 +3,77 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module Tasks
|
6
|
-
# Returns
|
6
|
+
# Returns project tasks
|
7
7
|
#
|
8
8
|
# @see https://developers.lokalise.com/reference/list-all-tasks
|
9
|
-
# @return [RubyLokaliseApi::
|
9
|
+
# @return [RubyLokaliseApi::Collections::Tasks]
|
10
10
|
# @param project_id [String]
|
11
|
-
# @param
|
12
|
-
def tasks(project_id,
|
13
|
-
|
11
|
+
# @param req_params [Hash]
|
12
|
+
def tasks(project_id, req_params = {})
|
13
|
+
name = 'Tasks'
|
14
|
+
params = { query: project_id, req: req_params }
|
15
|
+
|
16
|
+
data = endpoint(name: name, params: params).do_get
|
17
|
+
|
18
|
+
collection name, data
|
14
19
|
end
|
15
20
|
|
16
|
-
# Returns a single task
|
21
|
+
# Returns a single task
|
17
22
|
#
|
18
23
|
# @see https://developers.lokalise.com/reference/retrieve-a-task
|
19
24
|
# @return [RubyLokaliseApi::Resources::Task]
|
20
25
|
# @param project_id [String]
|
21
26
|
# @param task_id [String, Integer]
|
22
|
-
|
23
|
-
|
27
|
+
# @param req_params[Hash]
|
28
|
+
def task(project_id, task_id, req_params = {})
|
29
|
+
params = { query: [project_id, task_id], req: req_params }
|
30
|
+
|
31
|
+
data = endpoint(name: 'Tasks', params: params).do_get
|
32
|
+
|
33
|
+
resource 'Task', data
|
24
34
|
end
|
25
35
|
|
26
|
-
# Creates
|
36
|
+
# Creates a new task
|
27
37
|
#
|
28
38
|
# @see https://developers.lokalise.com/reference/create-a-task
|
29
39
|
# @return [RubyLokaliseApi::Resources::Task]
|
30
40
|
# @param project_id [String]
|
31
|
-
# @param
|
32
|
-
def create_task(project_id,
|
33
|
-
|
41
|
+
# @param req_params [Hash, Array]
|
42
|
+
def create_task(project_id, req_params)
|
43
|
+
params = { query: project_id, req: req_params }
|
44
|
+
|
45
|
+
data = endpoint(name: 'Tasks', params: params).do_post
|
46
|
+
|
47
|
+
resource 'Task', data
|
34
48
|
end
|
35
49
|
|
36
|
-
# Updates task
|
50
|
+
# Updates a task
|
37
51
|
#
|
38
52
|
# @see https://developers.lokalise.com/reference/update-a-task
|
39
53
|
# @return [RubyLokaliseApi::Resources::Task]
|
40
54
|
# @param project_id [String]
|
41
55
|
# @param task_id [String, Integer]
|
42
|
-
# @param
|
43
|
-
def update_task(project_id, task_id,
|
44
|
-
|
56
|
+
# @param req_params [Hash]
|
57
|
+
def update_task(project_id, task_id, req_params = {})
|
58
|
+
params = { query: [project_id, task_id], req: req_params }
|
59
|
+
|
60
|
+
data = endpoint(name: 'Tasks', params: params).do_put
|
61
|
+
|
62
|
+
resource 'Task', data
|
45
63
|
end
|
46
64
|
|
47
|
-
# Deletes task
|
65
|
+
# Deletes a task
|
48
66
|
#
|
49
67
|
# @see https://developers.lokalise.com/reference/delete-a-task
|
50
|
-
# @return [
|
68
|
+
# @return [RubyLokaliseApi::Generics::DeletedResource]
|
51
69
|
# @param project_id [String]
|
52
70
|
# @param task_id [String, Integer]
|
53
71
|
def destroy_task(project_id, task_id)
|
54
|
-
|
72
|
+
params = { query: [project_id, task_id] }
|
73
|
+
|
74
|
+
data = endpoint(name: 'Tasks', params: params).do_delete
|
75
|
+
|
76
|
+
RubyLokaliseApi::Generics::DeletedResource.new data.content
|
55
77
|
end
|
56
78
|
end
|
57
79
|
end
|
@@ -3,33 +3,54 @@
|
|
3
3
|
module RubyLokaliseApi
|
4
4
|
module Rest
|
5
5
|
module TeamUserBillingDetails
|
6
|
-
# Returns team user
|
6
|
+
# Returns billing details for a team user
|
7
7
|
#
|
8
8
|
# @see https://developers.lokalise.com/reference/retrieve-team-user-billing-details
|
9
9
|
# @return [RubyLokaliseApi::Resources::TeamUserBillingDetails]
|
10
|
-
# @param team_id [String]
|
10
|
+
# @param team_id [String, Integer]
|
11
11
|
def team_user_billing_details(team_id)
|
12
|
-
|
12
|
+
params = { query: team_id }
|
13
|
+
|
14
|
+
response = endpoint(name: 'TeamUserBillingDetails', params: params).do_get
|
15
|
+
|
16
|
+
# We must patch content because the API does not return team_id and it's mandatory to build resource URLs
|
17
|
+
response.patch_content_with 'team_id', team_id
|
18
|
+
|
19
|
+
resource 'TeamUserBillingDetails', response
|
13
20
|
end
|
14
21
|
|
15
22
|
# Creates team user billing details
|
16
23
|
#
|
17
24
|
# @see https://developers.lokalise.com/reference/create-team-user-billing-details
|
18
25
|
# @return [RubyLokaliseApi::Resources::TeamUserBillingDetails]
|
19
|
-
# @param team_id [String]
|
20
|
-
# @param
|
21
|
-
def create_team_user_billing_details(team_id,
|
22
|
-
|
26
|
+
# @param team_id [String, Integer]
|
27
|
+
# @param req_params [Hash, Array]
|
28
|
+
def create_team_user_billing_details(team_id, req_params)
|
29
|
+
params = { query: team_id, req: req_params }
|
30
|
+
|
31
|
+
response = endpoint(name: 'TeamUserBillingDetails', params: params).do_post
|
32
|
+
|
33
|
+
# We must patch content because the API does not return team_id and it's mandatory to build resource URL
|
34
|
+
response.patch_content_with 'team_id', team_id
|
35
|
+
|
36
|
+
resource 'TeamUserBillingDetails', response
|
23
37
|
end
|
24
38
|
|
25
39
|
# Updates team user billing details
|
26
40
|
#
|
27
|
-
# @see https://developers.lokalise.com/reference/
|
41
|
+
# @see https://developers.lokalise.com/reference/update-team-user-billing-details
|
28
42
|
# @return [RubyLokaliseApi::Resources::TeamUserBillingDetails]
|
29
|
-
# @param team_id [String]
|
30
|
-
# @param
|
31
|
-
def update_team_user_billing_details(team_id,
|
32
|
-
|
43
|
+
# @param team_id [String, Integer]
|
44
|
+
# @param req_params [Hash]
|
45
|
+
def update_team_user_billing_details(team_id, req_params = {})
|
46
|
+
params = { query: team_id, req: req_params }
|
47
|
+
|
48
|
+
data = endpoint(name: 'TeamUserBillingDetails', params: params).do_put
|
49
|
+
|
50
|
+
# We must patch content because the API does not return team_id and it's mandatory to build resource URL
|
51
|
+
data.patch_content_with 'team_id', team_id
|
52
|
+
|
53
|
+
resource 'TeamUserBillingDetails', data
|
33
54
|
end
|
34
55
|
end
|
35
56
|
end
|