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
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module TeamUsers
|
6
|
+
# Returns all team users for the given team
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-team-users-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::TeamUser<RubyLokaliseApi::Resources::TeamUser>]
|
10
|
+
# @param team_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def team_users(team_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::TeamUser, :all, team_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns team user from the given team
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-team-user-get
|
19
|
+
# @return [RubyLokaliseApi::Resources::TeamUser]
|
20
|
+
# @param team_id [String]
|
21
|
+
# @param user_id [String, Integer]
|
22
|
+
def team_user(team_id, user_id)
|
23
|
+
c_r RubyLokaliseApi::Resources::TeamUser, :find, [team_id, user_id]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Updates team user for the given team
|
27
|
+
#
|
28
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-team-user-put
|
29
|
+
# @return [RubyLokaliseApi::Resources::TeamUser]
|
30
|
+
# @param team_id [String]
|
31
|
+
# @param user_id [String, Integer]
|
32
|
+
# @param params [Hash]
|
33
|
+
def update_team_user(team_id, user_id, params)
|
34
|
+
c_r RubyLokaliseApi::Resources::TeamUser, :update, [team_id, user_id], params
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deletes team user from the given team
|
38
|
+
#
|
39
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-team-user-delete
|
40
|
+
# @return [RubyLokaliseApi::Resources::TeamUser]
|
41
|
+
# @param team_id [String]
|
42
|
+
# @param user_id [String, Integer]
|
43
|
+
def destroy_team_user(team_id, user_id)
|
44
|
+
c_r RubyLokaliseApi::Resources::TeamUser, :destroy, [team_id, user_id]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Teams
|
6
|
+
# Returns all teams available to the user
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-teams-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::Team<RubyLokaliseApi::Resources::Team>]
|
10
|
+
# @param params [Hash]
|
11
|
+
def teams(params = {})
|
12
|
+
c_r RubyLokaliseApi::Collections::Team, :all, nil, params
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module TranslationProviders
|
6
|
+
# Returns all translation providers for the given team
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-providers-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::TranslationProvider<RubyLokaliseApi::Resources::TranslationProvider>]
|
10
|
+
# @param team_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def translation_providers(team_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::TranslationProvider, :all, team_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns a single translation provider for the given team
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-provider-get
|
19
|
+
# @return [RubyLokaliseApi::Resources::TranslationProvider]
|
20
|
+
# @param team_id [String]
|
21
|
+
# @param provider_id [String, Integer]
|
22
|
+
def translation_provider(team_id, provider_id)
|
23
|
+
c_r RubyLokaliseApi::Resources::TranslationProvider, :find, [team_id, provider_id]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Translations
|
6
|
+
# Returns all translations for the given project (ungrouped)
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-translations-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::Translation<RubyLokaliseApi::Resources::Translation>]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def translations(project_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::Translation, :all, project_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns translation of the given project
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-translation-get
|
19
|
+
# @return [RubyLokaliseApi::Resources::Translation]
|
20
|
+
# @param project_id [String]
|
21
|
+
# @param translation_id [String, Integer]
|
22
|
+
# @param params [Hash]
|
23
|
+
def translation(project_id, translation_id, params = {})
|
24
|
+
c_r RubyLokaliseApi::Resources::Translation, :find, [project_id, translation_id], params
|
25
|
+
end
|
26
|
+
|
27
|
+
# Updates translation of the given project
|
28
|
+
#
|
29
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-translation-put
|
30
|
+
# @return [RubyLokaliseApi::Resources::Translation]
|
31
|
+
# @param project_id [String]
|
32
|
+
# @param translation_id [String, Integer]
|
33
|
+
# @param params [Hash]
|
34
|
+
def update_translation(project_id, translation_id, params)
|
35
|
+
c_r RubyLokaliseApi::Resources::Translation, :update, [project_id, translation_id], params
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module Webhooks
|
6
|
+
# Returns all webhooks for the given project
|
7
|
+
#
|
8
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-webhooks-get
|
9
|
+
# @return [RubyLokaliseApi::Collection::Webhook<RubyLokaliseApi::Resources::Webhook>]
|
10
|
+
# @param project_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def webhooks(project_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::Webhook, :all, project_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns a single webhook for the given project
|
17
|
+
#
|
18
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-webhook-get
|
19
|
+
# @return [RubyLokaliseApi::Resources::Webhook]
|
20
|
+
# @param project_id [String]
|
21
|
+
# @param webhook_id [String, Integer]
|
22
|
+
def webhook(project_id, webhook_id)
|
23
|
+
c_r RubyLokaliseApi::Resources::Webhook, :find, [project_id, webhook_id]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates webhook for the given project
|
27
|
+
#
|
28
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-webhook-post
|
29
|
+
# @return [RubyLokaliseApi::Resources::Webhook]
|
30
|
+
# @param project_id [String]
|
31
|
+
# @param params [Hash]
|
32
|
+
def create_webhook(project_id, params)
|
33
|
+
c_r RubyLokaliseApi::Resources::Webhook, :create, project_id, params
|
34
|
+
end
|
35
|
+
|
36
|
+
# Updates webhook for the given project
|
37
|
+
#
|
38
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-webhook-put
|
39
|
+
# @return [RubyLokaliseApi::Resources::Webhook]
|
40
|
+
# @param project_id [String]
|
41
|
+
# @param webhook_id [String, Integer]
|
42
|
+
# @param params [Hash]
|
43
|
+
def update_webhook(project_id, webhook_id, params = {})
|
44
|
+
c_r RubyLokaliseApi::Resources::Webhook, :update, [project_id, webhook_id], params
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deletes webhook for the given project
|
48
|
+
#
|
49
|
+
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-webhook-delete
|
50
|
+
# @return [Hash]
|
51
|
+
# @param project_id [String]
|
52
|
+
# @param webhook_id [String, Integer]
|
53
|
+
def destroy_webhook(project_id, webhook_id)
|
54
|
+
c_r RubyLokaliseApi::Resources::Webhook, :destroy, [project_id, webhook_id]
|
55
|
+
end
|
56
|
+
|
57
|
+
# Regenerates secret for the given webhook
|
58
|
+
#
|
59
|
+
# @see https://lokalise.com/api2docs/curl/#transition-regenerate-a-webhook-secret-patch
|
60
|
+
# @return [Hash]
|
61
|
+
# @param project_id [String]
|
62
|
+
# @param webhook_id [String, Integer]
|
63
|
+
def regenerate_webhook_secret(project_id, webhook_id)
|
64
|
+
c_r RubyLokaliseApi::Resources::Webhook, :regenerate_secret,
|
65
|
+
[project_id, webhook_id, 'secret', 'regenerate']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module RubyLokaliseApi
|
4
4
|
module Utils
|
5
5
|
module AttributeHelpers
|
6
|
-
using
|
6
|
+
using RubyLokaliseApi::Utils::StringUtils
|
7
7
|
|
8
8
|
UNIFIED_RESOURCES = %w[comment language].freeze
|
9
9
|
|
@@ -49,7 +49,7 @@ module Lokalise
|
|
49
49
|
#
|
50
50
|
# @return [Array<String>]
|
51
51
|
def attributes_for(klass)
|
52
|
-
@attributes ||= YAML.load_file(File.expand_path('../data/attributes.
|
52
|
+
@attributes ||= YAML.load_file(File.expand_path('../data/attributes.yml', __dir__)).freeze
|
53
53
|
|
54
54
|
name = unify klass.name.snakecase
|
55
55
|
@attributes[name]
|
@@ -58,10 +58,10 @@ module Lokalise
|
|
58
58
|
private
|
59
59
|
|
60
60
|
def get_key(name:, model_class:, collection: false, strict: false)
|
61
|
-
key = if collection && Module.const_defined?("
|
62
|
-
Module.const_get "
|
63
|
-
elsif Module.const_defined? "
|
64
|
-
Module.const_get "
|
61
|
+
key = if collection && Module.const_defined?("RubyLokaliseApi::Collections::#{model_class}::#{name}")
|
62
|
+
Module.const_get "RubyLokaliseApi::Collections::#{model_class}::#{name}"
|
63
|
+
elsif Module.const_defined? "RubyLokaliseApi::Resources::#{model_class}::#{name}"
|
64
|
+
Module.const_get "RubyLokaliseApi::Resources::#{model_class}::#{name}"
|
65
65
|
else
|
66
66
|
strict ? nil : model_class
|
67
67
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'zeitwerk'
|
4
|
+
require 'faraday'
|
5
|
+
require 'faraday/gzip'
|
6
|
+
require 'yaml'
|
7
|
+
require 'addressable'
|
8
|
+
|
9
|
+
loader = Zeitwerk::Loader.for_gem
|
10
|
+
loader.inflector.inflect(
|
11
|
+
'oauth2' => 'OAuth2',
|
12
|
+
'oauth2_client' => 'OAuth2Client'
|
13
|
+
)
|
14
|
+
loader.setup
|
15
|
+
|
16
|
+
module RubyLokaliseApi
|
17
|
+
class << self
|
18
|
+
# Initializes a new Client object
|
19
|
+
#
|
20
|
+
# @return [RubyLokaliseApi::Client]
|
21
|
+
# @param token [String]
|
22
|
+
# @param params [Hash]
|
23
|
+
def client(token, params = {})
|
24
|
+
@client = RubyLokaliseApi::Client.new token, params
|
25
|
+
end
|
26
|
+
|
27
|
+
# Reset the currently set client
|
28
|
+
def reset_client!
|
29
|
+
@client = nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# Initializes a new OAuth2Client object
|
33
|
+
#
|
34
|
+
# @return [RubyLokaliseApi::OAuth2Client]
|
35
|
+
# @param token [String]
|
36
|
+
# @param params [Hash]
|
37
|
+
def oauth2_client(token, params = {})
|
38
|
+
@oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params
|
39
|
+
end
|
40
|
+
|
41
|
+
# Reset the currently set OAuth2 client
|
42
|
+
def reset_oauth2_client!
|
43
|
+
@oauth2_client = nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def auth_client(client_id, client_secret)
|
47
|
+
RubyLokaliseApi::OAuth2::Auth.new client_id, client_secret
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/ruby-lokalise-api.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path('lib/
|
3
|
+
require File.expand_path('lib/ruby_lokalise_api/version', __dir__)
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'ruby-lokalise-api'
|
7
|
-
spec.version =
|
7
|
+
spec.version = RubyLokaliseApi::VERSION
|
8
8
|
spec.authors = ['Ilya Bodrov-Krukowski']
|
9
9
|
spec.email = ['golosizpru@gmail.com']
|
10
10
|
spec.summary = 'Ruby interface to the Lokalise API'
|
@@ -12,10 +12,10 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = 'https://github.com/lokalise/ruby-lokalise-api'
|
13
13
|
spec.license = 'BSD-3-Clause'
|
14
14
|
spec.platform = Gem::Platform::RUBY
|
15
|
-
spec.required_ruby_version = '>= 2.
|
15
|
+
spec.required_ruby_version = '>= 2.7'
|
16
16
|
|
17
17
|
spec.files = Dir['README.md', 'LICENSE',
|
18
|
-
'CHANGELOG.md', 'lib/**/*.rb', 'lib/
|
18
|
+
'CHANGELOG.md', 'lib/**/*.rb', 'lib/ruby_lokalise_api/data/attributes.yml',
|
19
19
|
'ruby-lokalise-api.gemspec', '.github/*.md',
|
20
20
|
'Gemfile', 'Rakefile']
|
21
21
|
spec.test_files = Dir['spec/**/*.rb']
|
@@ -25,7 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency 'addressable', '~> 2.5'
|
26
26
|
spec.add_dependency 'faraday', '~> 2.0'
|
27
27
|
spec.add_dependency 'faraday-gzip', '~> 0.1'
|
28
|
-
spec.add_dependency 'json', '
|
28
|
+
spec.add_dependency 'json', '~> 2'
|
29
|
+
spec.add_dependency 'zeitwerk', '~> 2.4'
|
29
30
|
|
30
31
|
spec.add_development_dependency 'codecov', '~> 0.1'
|
31
32
|
spec.add_development_dependency 'dotenv', '~> 2.5'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
let(:branch_id) { 41_302 }
|
6
6
|
|
@@ -74,7 +74,7 @@ RSpec.describe Lokalise::Client do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
expect(response['project_id']).to eq(project_id)
|
77
|
-
expect(response['branch_deleted']).to
|
77
|
+
expect(response['branch_deleted']).to be(true)
|
78
78
|
end
|
79
79
|
|
80
80
|
specify '#merge_branch' do
|
@@ -91,7 +91,7 @@ RSpec.describe Lokalise::Client do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
expect(response['project_id']).to eq(project_id)
|
94
|
-
expect(response['branch_merged']).to
|
94
|
+
expect(response['branch_merged']).to be(true)
|
95
95
|
expect(response['branch']['branch_id']).to eq(branch_id)
|
96
96
|
expect(response['branch']['name']).to eq(branch.name)
|
97
97
|
end
|
@@ -111,7 +111,7 @@ RSpec.describe Lokalise::Client do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
expect(response['project_id']).to eq(project_id)
|
114
|
-
expect(response['branch_merged']).to
|
114
|
+
expect(response['branch_merged']).to be(true)
|
115
115
|
expect(response['branch']['branch_id']).to eq(branch_id)
|
116
116
|
expect(response['branch']['name']).to eq(branch.name)
|
117
117
|
end
|
@@ -134,7 +134,7 @@ RSpec.describe Lokalise::Client do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
expect(response['project_id']).to eq(project_id)
|
137
|
-
expect(response['branch_deleted']).to
|
137
|
+
expect(response['branch_deleted']).to be(true)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
let(:key_id) { 15_305_182 }
|
6
6
|
let(:another_key_id) { 15_519_786 }
|
@@ -26,10 +26,10 @@ RSpec.describe Lokalise::Client do
|
|
26
26
|
expect(comments.current_page).to eq(2)
|
27
27
|
expect(comments.collection.first.comment).to eq('demo comment')
|
28
28
|
|
29
|
-
expect(comments.next_page?).to
|
30
|
-
expect(comments.last_page?).to
|
31
|
-
expect(comments.prev_page?).to
|
32
|
-
expect(comments.first_page?).to
|
29
|
+
expect(comments.next_page?).to be(true)
|
30
|
+
expect(comments.last_page?).to be(false)
|
31
|
+
expect(comments.prev_page?).to be(true)
|
32
|
+
expect(comments.first_page?).to be(false)
|
33
33
|
|
34
34
|
expect(comments.client).to be_an_instance_of(described_class)
|
35
35
|
end
|
@@ -96,7 +96,7 @@ RSpec.describe Lokalise::Client do
|
|
96
96
|
test_client.destroy_comment project_id, key_id, 767_938
|
97
97
|
end
|
98
98
|
expect(response['project_id']).to eq(project_id)
|
99
|
-
expect(response['comment_deleted']).to
|
99
|
+
expect(response['comment_deleted']).to be(true)
|
100
100
|
end
|
101
101
|
|
102
102
|
context 'when comment methods are chained' do
|
@@ -112,7 +112,7 @@ RSpec.describe Lokalise::Client do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
expect(delete_response['project_id']).to eq(project_id)
|
115
|
-
expect(delete_response['comment_deleted']).to
|
115
|
+
expect(delete_response['comment_deleted']).to be(true)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
let(:contributor_id) { 25_953 }
|
6
6
|
|
@@ -25,10 +25,10 @@ RSpec.describe Lokalise::Client do
|
|
25
25
|
expect(contributors.results_per_page).to eq(1)
|
26
26
|
expect(contributors.current_page).to eq(2)
|
27
27
|
|
28
|
-
expect(contributors.next_page?).to
|
29
|
-
expect(contributors.last_page?).to
|
30
|
-
expect(contributors.prev_page?).to
|
31
|
-
expect(contributors.first_page?).to
|
28
|
+
expect(contributors.next_page?).to be(false)
|
29
|
+
expect(contributors.last_page?).to be(true)
|
30
|
+
expect(contributors.prev_page?).to be(true)
|
31
|
+
expect(contributors.first_page?).to be(false)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -41,8 +41,8 @@ RSpec.describe Lokalise::Client do
|
|
41
41
|
expect(contributor.email).to eq('bodrovis@protonmail.com')
|
42
42
|
expect(contributor.fullname).to eq('Ilya B')
|
43
43
|
expect(contributor.created_at).to eq('2018-08-21 15:35:25 (Etc/UTC)')
|
44
|
-
expect(contributor.is_admin).to
|
45
|
-
expect(contributor.is_reviewer).to
|
44
|
+
expect(contributor.is_admin).to be(true)
|
45
|
+
expect(contributor.is_reviewer).to be(true)
|
46
46
|
expect(contributor.languages.first['lang_id']).to eq(803)
|
47
47
|
expect(contributor.admin_rights.first).to eq('upload')
|
48
48
|
expect(contributor.created_at_timestamp).to eq(1_534_865_725)
|
@@ -94,7 +94,7 @@ RSpec.describe Lokalise::Client do
|
|
94
94
|
test_client.destroy_contributor project_id, contributor_id
|
95
95
|
end
|
96
96
|
expect(response['project_id']).to eq(project_id)
|
97
|
-
expect(response['contributor_deleted']).to
|
97
|
+
expect(response['contributor_deleted']).to be(true)
|
98
98
|
end
|
99
99
|
|
100
100
|
context 'when contributor methods are chained' do
|
@@ -126,7 +126,7 @@ RSpec.describe Lokalise::Client do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
expect(delete_response['project_id']).to eq(project_id)
|
129
|
-
expect(delete_response['contributor_deleted']).to
|
129
|
+
expect(delete_response['contributor_deleted']).to be(true)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
let(:status_id) { 128 }
|
6
6
|
let(:new_status_id) { 126 }
|
@@ -26,10 +26,10 @@ RSpec.describe Lokalise::Client do
|
|
26
26
|
expect(statuses.results_per_page).to eq(1)
|
27
27
|
expect(statuses.current_page).to eq(2)
|
28
28
|
|
29
|
-
expect(statuses.next_page?).to
|
30
|
-
expect(statuses.last_page?).to
|
31
|
-
expect(statuses.prev_page?).to
|
32
|
-
expect(statuses.first_page?).to
|
29
|
+
expect(statuses.next_page?).to be(true)
|
30
|
+
expect(statuses.last_page?).to be(false)
|
31
|
+
expect(statuses.prev_page?).to be(true)
|
32
|
+
expect(statuses.first_page?).to be(false)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -87,7 +87,7 @@ RSpec.describe Lokalise::Client do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
expect(response['project_id']).to eq(project_id)
|
90
|
-
expect(response['custom_translation_status_deleted']).to
|
90
|
+
expect(response['custom_translation_status_deleted']).to be(true)
|
91
91
|
end
|
92
92
|
|
93
93
|
specify '#translation_status_colors' do
|
@@ -125,7 +125,7 @@ RSpec.describe Lokalise::Client do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
expect(response['project_id']).to eq(project_id)
|
128
|
-
expect(response['custom_translation_status_deleted']).to
|
128
|
+
expect(response['custom_translation_status_deleted']).to be(true)
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
|
6
6
|
describe '#files' do
|
@@ -51,7 +51,7 @@ RSpec.describe Lokalise::Client do
|
|
51
51
|
lang_iso: 'ru'
|
52
52
|
end
|
53
53
|
|
54
|
-
expect(process).to be_an_instance_of(
|
54
|
+
expect(process).to be_an_instance_of(RubyLokaliseApi::Resources::QueuedProcess)
|
55
55
|
expect(process.process_id).to eq('85c42bf5eff44648ca2f01f9db67b7d306a2f282')
|
56
56
|
expect(process.status).to eq('queued')
|
57
57
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
let(:key_id) { 15_305_182 }
|
6
6
|
let(:new_key_id) { 15_519_770 }
|
@@ -25,10 +25,10 @@ RSpec.describe Lokalise::Client do
|
|
25
25
|
expect(keys.results_per_page).to eq(2)
|
26
26
|
expect(keys.current_page).to eq(3)
|
27
27
|
|
28
|
-
expect(keys.next_page?).to
|
29
|
-
expect(keys.last_page?).to
|
30
|
-
expect(keys.prev_page?).to
|
31
|
-
expect(keys.first_page?).to
|
28
|
+
expect(keys.next_page?).to be(true)
|
29
|
+
expect(keys.last_page?).to be(false)
|
30
|
+
expect(keys.prev_page?).to be(true)
|
31
|
+
expect(keys.first_page?).to be(false)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -50,10 +50,10 @@ RSpec.describe Lokalise::Client do
|
|
50
50
|
expect(key.comments).to eq([])
|
51
51
|
expect(key.screenshots).to eq([])
|
52
52
|
expect(key.translations.first['modified_by_email']).to eq('bodrovis@protonmail.com')
|
53
|
-
expect(key.is_plural).to
|
53
|
+
expect(key.is_plural).to be(false)
|
54
54
|
expect(key.plural_name).to eq('')
|
55
|
-
expect(key.is_hidden).to
|
56
|
-
expect(key.is_archived).to
|
55
|
+
expect(key.is_hidden).to be(true)
|
56
|
+
expect(key.is_archived).to be(false)
|
57
57
|
expect(key.context).to eq('')
|
58
58
|
expect(key.base_words).to eq(1)
|
59
59
|
expect(key.char_limit).to eq(0)
|
@@ -113,8 +113,8 @@ RSpec.describe Lokalise::Client do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# `update_keys` returns a collection but it should not be paginated
|
116
|
-
expect(keys.next_page?).to
|
117
|
-
expect(keys.prev_page?).to
|
116
|
+
expect(keys.next_page?).to be(false)
|
117
|
+
expect(keys.prev_page?).to be(false)
|
118
118
|
|
119
119
|
first_key = keys.collection.first
|
120
120
|
second_key = keys.collection[1]
|
@@ -134,7 +134,7 @@ RSpec.describe Lokalise::Client do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
expect(response['project_id']).to eq(project_id)
|
137
|
-
expect(response['key_removed']).to
|
137
|
+
expect(response['key_removed']).to be(true)
|
138
138
|
end
|
139
139
|
|
140
140
|
specify '#destroy_keys' do
|
@@ -143,7 +143,7 @@ RSpec.describe Lokalise::Client do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
expect(response['project_id']).to eq(project_id)
|
146
|
-
expect(response['keys_removed']).to
|
146
|
+
expect(response['keys_removed']).to be(true)
|
147
147
|
end
|
148
148
|
|
149
149
|
context 'when key methods are chained' do
|
@@ -169,7 +169,7 @@ RSpec.describe Lokalise::Client do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
expect(delete_response['project_id']).to eq(project_id)
|
172
|
-
expect(delete_response['key_removed']).to
|
172
|
+
expect(delete_response['key_removed']).to be(true)
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
@@ -193,7 +193,7 @@ RSpec.describe Lokalise::Client do
|
|
193
193
|
end
|
194
194
|
|
195
195
|
expect(delete_response['project_id']).to eq(project_id)
|
196
|
-
expect(delete_response['keys_removed']).to
|
196
|
+
expect(delete_response['keys_removed']).to be(true)
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe RubyLokaliseApi::Client do
|
4
4
|
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
5
5
|
let(:language_id) { 640 }
|
6
6
|
let(:new_language_id) { 894 }
|
@@ -59,7 +59,7 @@ RSpec.describe Lokalise::Client do
|
|
59
59
|
expect(language.lang_id).to eq(language_id)
|
60
60
|
expect(language.lang_iso).to eq('en')
|
61
61
|
expect(language.lang_name).to eq('English')
|
62
|
-
expect(language.is_rtl).to
|
62
|
+
expect(language.is_rtl).to be(false)
|
63
63
|
expect(language.plural_forms).to eq(%w[one other])
|
64
64
|
end
|
65
65
|
|
@@ -100,7 +100,7 @@ RSpec.describe Lokalise::Client do
|
|
100
100
|
test_client.destroy_language project_id, new_language_id
|
101
101
|
end
|
102
102
|
expect(response['project_id']).to eq(project_id)
|
103
|
-
expect(response['language_deleted']).to
|
103
|
+
expect(response['language_deleted']).to be(true)
|
104
104
|
end
|
105
105
|
|
106
106
|
context 'when project language methods are chained' do
|
@@ -128,7 +128,7 @@ RSpec.describe Lokalise::Client do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
expect(delete_response['project_id']).to eq(project_id)
|
131
|
-
expect(delete_response['language_deleted']).to
|
131
|
+
expect(delete_response['language_deleted']).to be(true)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|