ruby-lokalise-api 2.9.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODE_OF_CONDUCT.md +1 -1
- data/.github/CONTRIBUTING.md +9 -2
- data/CHANGELOG.md +1 -75
- data/LICENSE +9 -18
- data/README.md +18 -1734
- data/lib/ruby-lokalise-api.rb +2 -0
- data/lib/ruby-lokalise-api/client.rb +16 -4
- data/lib/ruby-lokalise-api/collections/base.rb +5 -3
- data/lib/ruby-lokalise-api/collections/queued_process.rb +15 -0
- data/lib/ruby-lokalise-api/connection.rb +1 -1
- data/lib/ruby-lokalise-api/data/attributes.json +29 -13
- data/lib/ruby-lokalise-api/request.rb +8 -1
- data/lib/ruby-lokalise-api/resources/base.rb +55 -25
- data/lib/ruby-lokalise-api/resources/branch.rb +1 -1
- data/lib/ruby-lokalise-api/resources/contributor.rb +1 -1
- data/lib/ruby-lokalise-api/resources/custom_translation_status.rb +1 -1
- data/lib/ruby-lokalise-api/resources/file.rb +3 -1
- data/lib/ruby-lokalise-api/resources/key.rb +1 -1
- data/lib/ruby-lokalise-api/resources/key_comment.rb +1 -1
- data/lib/ruby-lokalise-api/resources/order.rb +2 -0
- data/lib/ruby-lokalise-api/resources/payment_card.rb +1 -1
- data/lib/ruby-lokalise-api/resources/project.rb +2 -2
- data/lib/ruby-lokalise-api/resources/project_language.rb +1 -1
- data/lib/ruby-lokalise-api/resources/queued_process.rb +18 -0
- data/lib/ruby-lokalise-api/resources/screenshot.rb +1 -1
- data/lib/ruby-lokalise-api/resources/snapshot.rb +3 -1
- data/lib/ruby-lokalise-api/resources/task.rb +1 -1
- data/lib/ruby-lokalise-api/resources/team_user.rb +1 -1
- data/lib/ruby-lokalise-api/resources/team_user_group.rb +2 -1
- data/lib/ruby-lokalise-api/resources/translation.rb +1 -1
- data/lib/ruby-lokalise-api/resources/translation_provider.rb +3 -0
- data/lib/ruby-lokalise-api/resources/webhook.rb +11 -3
- data/lib/ruby-lokalise-api/rest/comments.rb +5 -5
- data/lib/ruby-lokalise-api/rest/contributors.rb +5 -5
- data/lib/ruby-lokalise-api/rest/custom_translation_statuses.rb +6 -6
- data/lib/ruby-lokalise-api/rest/files.rb +3 -3
- data/lib/ruby-lokalise-api/rest/keys.rb +7 -7
- data/lib/ruby-lokalise-api/rest/languages.rb +6 -6
- data/lib/ruby-lokalise-api/rest/payment_cards.rb +3 -3
- data/lib/ruby-lokalise-api/rest/projects.rb +6 -6
- data/lib/ruby-lokalise-api/rest/queued_processes.rb +26 -0
- data/lib/ruby-lokalise-api/rest/screenshots.rb +5 -5
- data/lib/ruby-lokalise-api/rest/snapshots.rb +4 -4
- data/lib/ruby-lokalise-api/rest/tasks.rb +5 -5
- data/lib/ruby-lokalise-api/rest/team_user_group.rb +4 -4
- data/lib/ruby-lokalise-api/rest/team_users.rb +4 -4
- data/lib/ruby-lokalise-api/rest/teams.rb +1 -1
- data/lib/ruby-lokalise-api/rest/translation_providers.rb +2 -2
- data/lib/ruby-lokalise-api/rest/translations.rb +3 -3
- data/lib/ruby-lokalise-api/rest/webhooks.rb +16 -5
- data/lib/ruby-lokalise-api/utils/attribute_helpers.rb +11 -6
- data/lib/ruby-lokalise-api/version.rb +1 -1
- data/ruby-lokalise-api.gemspec +7 -7
- data/spec/lib/ruby-lokalise-api/custom_json_parser_spec.rb +4 -4
- data/spec/lib/ruby-lokalise-api/error_spec.rb +8 -0
- data/spec/lib/ruby-lokalise-api/rest/branches_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/comments_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/custom_translation_statuses_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/files_spec.rb +17 -9
- data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +38 -20
- data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/orders_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/payment_cards_spec.rb +19 -5
- data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/queued_processes_spec.rb +57 -0
- data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +25 -0
- data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +20 -7
- data/spec/lib/ruby-lokalise-api/rest/team_user_groups_spec.rb +84 -0
- data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +13 -0
- data/spec/lib/ruby-lokalise-api/rest/translation_providers_spec.rb +5 -0
- data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +12 -0
- data/spec/lib/ruby-lokalise-api/rest/webhooks_spec.rb +50 -0
- metadata +25 -20
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all payment cards available to the user authorized with the API token
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-cards-get
|
8
8
|
# @return [Lokalise::Collection::PaymentCard<Lokalise::Resources::PaymentCard>]
|
9
9
|
# @param params [Hash]
|
10
10
|
def payment_cards(params = {})
|
@@ -13,7 +13,7 @@ module Lokalise
|
|
13
13
|
|
14
14
|
# Returns a single payment card
|
15
15
|
#
|
16
|
-
# @see https://lokalise.
|
16
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-card-get
|
17
17
|
# @return [Lokalise::Resources::PaymentCard]
|
18
18
|
# @param card_id [String, Integer]
|
19
19
|
def payment_card(card_id)
|
@@ -31,7 +31,7 @@ module Lokalise
|
|
31
31
|
|
32
32
|
# Deletes the payment card
|
33
33
|
#
|
34
|
-
# @see https://lokalise.
|
34
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-card-delete
|
35
35
|
# @return [Hash]
|
36
36
|
# @param card_id [String, Integer]
|
37
37
|
def destroy_payment_card(card_id)
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all projects available to the user authorized with the API token
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-projects-get
|
8
8
|
# @return [Lokalise::Collection::Project<Lokalise::Resources::Project>]
|
9
9
|
# @param params [Hash]
|
10
10
|
def projects(params = {})
|
@@ -13,7 +13,7 @@ module Lokalise
|
|
13
13
|
|
14
14
|
# Returns a single project
|
15
15
|
#
|
16
|
-
# @see https://lokalise.
|
16
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-project-get
|
17
17
|
# @return [Lokalise::Resources::Project]
|
18
18
|
# @param project_id [String, Integer]
|
19
19
|
def project(project_id)
|
@@ -22,7 +22,7 @@ module Lokalise
|
|
22
22
|
|
23
23
|
# Creates project
|
24
24
|
#
|
25
|
-
# @see https://lokalise.
|
25
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-project-post
|
26
26
|
# @return [Lokalise::Resources::Project]
|
27
27
|
# @param params [Hash]
|
28
28
|
def create_project(params)
|
@@ -31,7 +31,7 @@ module Lokalise
|
|
31
31
|
|
32
32
|
# Updates project
|
33
33
|
#
|
34
|
-
# @see https://lokalise.
|
34
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-project-put
|
35
35
|
# @return [Lokalise::Resources::Project]
|
36
36
|
# @param project_id [String, Integer]
|
37
37
|
# @param params [Hash]
|
@@ -41,7 +41,7 @@ module Lokalise
|
|
41
41
|
|
42
42
|
# Deletes all keys and translations from the project
|
43
43
|
#
|
44
|
-
# @see https://lokalise.
|
44
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-empty-a-project-put
|
45
45
|
# @return [Hash]
|
46
46
|
# @param project_id [String, Integer]
|
47
47
|
def empty_project(project_id)
|
@@ -50,7 +50,7 @@ module Lokalise
|
|
50
50
|
|
51
51
|
# Deletes the project
|
52
52
|
#
|
53
|
-
# @see https://lokalise.
|
53
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-project-delete
|
54
54
|
# @return [Hash]
|
55
55
|
# @param project_id [String, Integer]
|
56
56
|
def destroy_project(project_id)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lokalise
|
4
|
+
class Client
|
5
|
+
# Returns all queued processes for the given project
|
6
|
+
#
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-processes-get
|
8
|
+
# @return [Lokalise::Collection::QueuedProcess<Lokalise::Resources::QueuedProcess>]
|
9
|
+
# @param project_id [String]
|
10
|
+
# @param params [Hash]
|
11
|
+
def queued_processes(project_id, params = {})
|
12
|
+
c_r Lokalise::Collections::QueuedProcess, :all, project_id, params
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns a queued process for the given project
|
16
|
+
#
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-process-get
|
18
|
+
# @return [Lokalise::Resources::QueuedProcess]
|
19
|
+
# @param project_id [String]
|
20
|
+
# @param process_id [String]
|
21
|
+
def queued_process(project_id, process_id)
|
22
|
+
c_r Lokalise::Resources::QueuedProcess, :find,
|
23
|
+
[project_id, process_id]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all screenshots for the given project
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-screenshots-get
|
8
8
|
# @return [Lokalise::Collection::Screenshot<Lokalise::Resources::Screenshot>]
|
9
9
|
# @param project_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Returns a single screenshot for the given project
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-screenshot-get
|
18
18
|
# @return [Lokalise::Resources::Screenshot]
|
19
19
|
# @param project_id [String]
|
20
20
|
# @param screenshot_id [String, Integer]
|
@@ -24,7 +24,7 @@ module Lokalise
|
|
24
24
|
|
25
25
|
# Creates one or more screenshots for the given project
|
26
26
|
#
|
27
|
-
# @see https://lokalise.
|
27
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-screenshots-post
|
28
28
|
# @return [Lokalise::Collection::Screenshot<Lokalise::Resources::Screenshot>]
|
29
29
|
# @param project_id [String]
|
30
30
|
# @param params [Hash]
|
@@ -34,7 +34,7 @@ module Lokalise
|
|
34
34
|
|
35
35
|
# Updates screenshot
|
36
36
|
#
|
37
|
-
# @see https://lokalise.
|
37
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-screenshot-put
|
38
38
|
# @return [Lokalise::Resources::Screenshot]
|
39
39
|
# @param project_id [String]
|
40
40
|
# @param screenshot_id [String, Integer]
|
@@ -45,7 +45,7 @@ module Lokalise
|
|
45
45
|
|
46
46
|
# Deletes screenshot
|
47
47
|
#
|
48
|
-
# @see https://lokalise.
|
48
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-screenshot-delete
|
49
49
|
# @return [Hash]
|
50
50
|
# @param project_id [String]
|
51
51
|
# @param screenshot_id [String, Integer]
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all snapshots for the given project
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-snapshots-get
|
8
8
|
# @return [Lokalise::Collection::Snapshot<Lokalise::Resources::Snapshot>]
|
9
9
|
# @param project_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Creates snapshot for the given project
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-snapshot-post
|
18
18
|
# @return [Lokalise::Resources::Snapshot]
|
19
19
|
# @param project_id [String]
|
20
20
|
# @param params [Hash]
|
@@ -24,7 +24,7 @@ module Lokalise
|
|
24
24
|
|
25
25
|
# Restore project from the given snapshot by producing project's copy
|
26
26
|
#
|
27
|
-
# @see https://lokalise.
|
27
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-restore-a-snapshot-post
|
28
28
|
# @return [Lokalise::Resources::Project]
|
29
29
|
# @param project_id [String]
|
30
30
|
# @param snapshot_id [String, Integer]
|
@@ -34,7 +34,7 @@ module Lokalise
|
|
34
34
|
|
35
35
|
# Deletes snapshot
|
36
36
|
#
|
37
|
-
# @see https://lokalise.
|
37
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-snapshot-delete
|
38
38
|
# @return [Hash]
|
39
39
|
# @param project_id [String]
|
40
40
|
# @param snapshot_id [String, Integer]
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all tasks for the given project
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-tasks-get
|
8
8
|
# @return [Lokalise::Collection::Task<Lokalise::Resources::Task>]
|
9
9
|
# @param project_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Returns a single task for the given project
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-task-get
|
18
18
|
# @return [Lokalise::Resources::Task]
|
19
19
|
# @param project_id [String]
|
20
20
|
# @param task_id [String, Integer]
|
@@ -24,7 +24,7 @@ module Lokalise
|
|
24
24
|
|
25
25
|
# Creates task for the given project
|
26
26
|
#
|
27
|
-
# @see https://lokalise.
|
27
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-task-post
|
28
28
|
# @return [Lokalise::Resources::Task]
|
29
29
|
# @param project_id [String]
|
30
30
|
# @param params [Hash]
|
@@ -34,7 +34,7 @@ module Lokalise
|
|
34
34
|
|
35
35
|
# Updates task for the given project
|
36
36
|
#
|
37
|
-
# @see https://lokalise.
|
37
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-task-put
|
38
38
|
# @return [Lokalise::Resources::Task]
|
39
39
|
# @param project_id [String]
|
40
40
|
# @param task_id [String, Integer]
|
@@ -45,7 +45,7 @@ module Lokalise
|
|
45
45
|
|
46
46
|
# Deletes task for the given project
|
47
47
|
#
|
48
|
-
# @see https://lokalise.
|
48
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-task-delete
|
49
49
|
# @return [Hash]
|
50
50
|
# @param project_id [String]
|
51
51
|
# @param task_id [String, Integer]
|
@@ -62,7 +62,7 @@ module Lokalise
|
|
62
62
|
def add_projects_to_group(team_id, group_id, project_ids)
|
63
63
|
c_r Lokalise::Resources::TeamUserGroup, :update,
|
64
64
|
[team_id, group_id, 'projects', 'add'],
|
65
|
-
project_ids, :projects
|
65
|
+
project_ids, :projects, [team_id, group_id]
|
66
66
|
end
|
67
67
|
|
68
68
|
# Removes projects from the given group
|
@@ -75,7 +75,7 @@ module Lokalise
|
|
75
75
|
def remove_projects_from_group(team_id, group_id, project_ids)
|
76
76
|
c_r Lokalise::Resources::TeamUserGroup, :update,
|
77
77
|
[team_id, group_id, 'projects', 'remove'],
|
78
|
-
project_ids, :projects
|
78
|
+
project_ids, :projects, [team_id, group_id]
|
79
79
|
end
|
80
80
|
|
81
81
|
# Adds users to the given group
|
@@ -88,7 +88,7 @@ module Lokalise
|
|
88
88
|
def add_users_to_group(team_id, group_id, users_ids)
|
89
89
|
c_r Lokalise::Resources::TeamUserGroup, :update,
|
90
90
|
[team_id, group_id, 'members', 'add'],
|
91
|
-
users_ids, :users
|
91
|
+
users_ids, :users, [team_id, group_id]
|
92
92
|
end
|
93
93
|
|
94
94
|
# Removes users from the given group
|
@@ -101,7 +101,7 @@ module Lokalise
|
|
101
101
|
def remove_users_from_group(team_id, group_id, users_ids)
|
102
102
|
c_r Lokalise::Resources::TeamUserGroup, :update,
|
103
103
|
[team_id, group_id, 'members', 'remove'],
|
104
|
-
users_ids, :users
|
104
|
+
users_ids, :users, [team_id, group_id]
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all team users for the given team
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-team-users-get
|
8
8
|
# @return [Lokalise::Collection::TeamUser<Lokalise::Resources::TeamUser>]
|
9
9
|
# @param team_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Returns team user from the given team
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-team-user-get
|
18
18
|
# @return [Lokalise::Resources::TeamUser]
|
19
19
|
# @param team_id [String]
|
20
20
|
# @param user_id [String, Integer]
|
@@ -24,7 +24,7 @@ module Lokalise
|
|
24
24
|
|
25
25
|
# Updates team user for the given team
|
26
26
|
#
|
27
|
-
# @see https://lokalise.
|
27
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-team-user-put
|
28
28
|
# @return [Lokalise::Resources::TeamUser]
|
29
29
|
# @param team_id [String]
|
30
30
|
# @param user_id [String, Integer]
|
@@ -35,7 +35,7 @@ module Lokalise
|
|
35
35
|
|
36
36
|
# Deletes team user from the given team
|
37
37
|
#
|
38
|
-
# @see https://lokalise.
|
38
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-team-user-delete
|
39
39
|
# @return [Lokalise::Resources::TeamUser]
|
40
40
|
# @param team_id [String]
|
41
41
|
# @param user_id [String, Integer]
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all teams available to the user
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-teams-get
|
8
8
|
# @return [Lokalise::Collection::Team<Lokalise::Resources::Team>]
|
9
9
|
# @param params [Hash]
|
10
10
|
def teams(params = {})
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all translation providers for the given team
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-providers-get
|
8
8
|
# @return [Lokalise::Collection::TranslationProvider<Lokalise::Resources::TranslationProvider>]
|
9
9
|
# @param team_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Returns a single translation provider for the given team
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-provider-get
|
18
18
|
# @return [Lokalise::Resources::TranslationProvider]
|
19
19
|
# @param team_id [String]
|
20
20
|
# @param provider_id [String, Integer]
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all translations for the given project (ungrouped)
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-translations-get
|
8
8
|
# @return [Lokalise::Collection::Translation<Lokalise::Resources::Translation>]
|
9
9
|
# @param project_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Returns translation of the given project
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-translation-get
|
18
18
|
# @return [Lokalise::Resources::Translation]
|
19
19
|
# @param project_id [String]
|
20
20
|
# @param translation_id [String, Integer]
|
@@ -25,7 +25,7 @@ module Lokalise
|
|
25
25
|
|
26
26
|
# Updates translation of the given project
|
27
27
|
#
|
28
|
-
# @see https://lokalise.
|
28
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-translation-put
|
29
29
|
# @return [Lokalise::Resources::Translation]
|
30
30
|
# @param project_id [String]
|
31
31
|
# @param translation_id [String, Integer]
|
@@ -4,7 +4,7 @@ module Lokalise
|
|
4
4
|
class Client
|
5
5
|
# Returns all webhooks for the given project
|
6
6
|
#
|
7
|
-
# @see https://lokalise.
|
7
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-webhooks-get
|
8
8
|
# @return [Lokalise::Collection::Webhook<Lokalise::Resources::Webhook>]
|
9
9
|
# @param project_id [String]
|
10
10
|
# @param params [Hash]
|
@@ -14,7 +14,7 @@ module Lokalise
|
|
14
14
|
|
15
15
|
# Returns a single webhook for the given project
|
16
16
|
#
|
17
|
-
# @see https://lokalise.
|
17
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-webhook-get
|
18
18
|
# @return [Lokalise::Resources::Webhook]
|
19
19
|
# @param project_id [String]
|
20
20
|
# @param webhook_id [String, Integer]
|
@@ -24,7 +24,7 @@ module Lokalise
|
|
24
24
|
|
25
25
|
# Creates webhook for the given project
|
26
26
|
#
|
27
|
-
# @see https://lokalise.
|
27
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-webhook-post
|
28
28
|
# @return [Lokalise::Resources::Webhook]
|
29
29
|
# @param project_id [String]
|
30
30
|
# @param params [Hash]
|
@@ -34,7 +34,7 @@ module Lokalise
|
|
34
34
|
|
35
35
|
# Updates webhook for the given project
|
36
36
|
#
|
37
|
-
# @see https://lokalise.
|
37
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-webhook-put
|
38
38
|
# @return [Lokalise::Resources::Webhook]
|
39
39
|
# @param project_id [String]
|
40
40
|
# @param webhook_id [String, Integer]
|
@@ -45,12 +45,23 @@ module Lokalise
|
|
45
45
|
|
46
46
|
# Deletes webhook for the given project
|
47
47
|
#
|
48
|
-
# @see https://lokalise.
|
48
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-webhook-delete
|
49
49
|
# @return [Hash]
|
50
50
|
# @param project_id [String]
|
51
51
|
# @param webhook_id [String, Integer]
|
52
52
|
def destroy_webhook(project_id, webhook_id)
|
53
53
|
c_r Lokalise::Resources::Webhook, :destroy, [project_id, webhook_id]
|
54
54
|
end
|
55
|
+
|
56
|
+
# Regenerates secret for the given webhook
|
57
|
+
#
|
58
|
+
# @see https://lokalise.com/api2docs/curl/#transition-regenerate-a-webhook-secret-patch
|
59
|
+
# @return [Hash]
|
60
|
+
# @param project_id [String]
|
61
|
+
# @param webhook_id [String, Integer]
|
62
|
+
def regenerate_webhook_secret(project_id, webhook_id)
|
63
|
+
c_r Lokalise::Resources::Webhook, :regenerate_secret,
|
64
|
+
[project_id, webhook_id, 'secret', 'regenerate']
|
65
|
+
end
|
55
66
|
end
|
56
67
|
end
|
@@ -16,16 +16,21 @@ module Lokalise
|
|
16
16
|
# @return [String]
|
17
17
|
# @param model_class [String]
|
18
18
|
# @param plural [Boolean] Should the returned value be pluralized?
|
19
|
-
def data_key_for(model_class
|
20
|
-
data_key_plural = get_key(
|
19
|
+
def data_key_for(model_class:, plural: false, collection: false)
|
20
|
+
data_key_plural = get_key(
|
21
|
+
name: 'DATA_KEY_PLURAL',
|
22
|
+
model_class: model_class,
|
23
|
+
collection: true,
|
24
|
+
strict: true
|
25
|
+
)
|
21
26
|
|
22
27
|
return data_key_plural if collection && data_key_plural
|
23
28
|
|
24
|
-
data_key = get_key 'DATA_KEY', model_class, collection
|
29
|
+
data_key = get_key name: 'DATA_KEY', model_class: model_class, collection: collection
|
25
30
|
|
26
31
|
return data_key unless plural
|
27
32
|
|
28
|
-
data_key
|
33
|
+
"#{data_key}s"
|
29
34
|
end
|
30
35
|
|
31
36
|
# Returns key used to determine resource id (for example `user_id` or `project_id`).
|
@@ -35,7 +40,7 @@ module Lokalise
|
|
35
40
|
# @return [String]
|
36
41
|
# @param model_class [String]
|
37
42
|
def id_key_for(model_class)
|
38
|
-
get_key('ID_KEY', model_class)
|
43
|
+
"#{get_key(name: 'ID_KEY', model_class: model_class)}_id"
|
39
44
|
end
|
40
45
|
|
41
46
|
# Loads attributes for the given resource based on its name
|
@@ -52,7 +57,7 @@ module Lokalise
|
|
52
57
|
|
53
58
|
private
|
54
59
|
|
55
|
-
def get_key(name
|
60
|
+
def get_key(name:, model_class:, collection: false, strict: false)
|
56
61
|
key = if collection && Module.const_defined?("Lokalise::Collections::#{model_class}::#{name}")
|
57
62
|
Module.const_get "Lokalise::Collections::#{model_class}::#{name}"
|
58
63
|
elsif Module.const_defined? "Lokalise::Resources::#{model_class}::#{name}"
|