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
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module TeamUserBillingDetails
|
6
|
+
# Returns team user billing details
|
7
|
+
#
|
8
|
+
# @see https://developers.lokalise.com/reference/retrieve-team-user-billing-details
|
9
|
+
# @return [RubyLokaliseApi::Resources::TeamUserBillingDetails]
|
10
|
+
# @param team_id [String]
|
11
|
+
def team_user_billing_details(team_id)
|
12
|
+
c_r RubyLokaliseApi::Resources::TeamUserBillingDetails, :find, team_id
|
13
|
+
end
|
14
|
+
|
15
|
+
# Creates team user billing details
|
16
|
+
#
|
17
|
+
# @see https://developers.lokalise.com/reference/create-team-user-billing-details
|
18
|
+
# @return [RubyLokaliseApi::Resources::TeamUserBillingDetails]
|
19
|
+
# @param team_id [String]
|
20
|
+
# @param params [Hash]
|
21
|
+
def create_team_user_billing_details(team_id, params)
|
22
|
+
c_r RubyLokaliseApi::Resources::TeamUserBillingDetails, :create, team_id, params
|
23
|
+
end
|
24
|
+
|
25
|
+
# Updates team user billing details
|
26
|
+
#
|
27
|
+
# @see https://developers.lokalise.com/reference/create-team-user-billing-details
|
28
|
+
# @return [RubyLokaliseApi::Resources::TeamUserBillingDetails]
|
29
|
+
# @param team_id [String]
|
30
|
+
# @param params [Hash]
|
31
|
+
def update_team_user_billing_details(team_id, params)
|
32
|
+
c_r RubyLokaliseApi::Resources::TeamUserBillingDetails, :update, team_id, params
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyLokaliseApi
|
4
|
+
module Rest
|
5
|
+
module TeamUserGroups
|
6
|
+
# Returns all team user groups for the given team
|
7
|
+
#
|
8
|
+
# @see https://developers.lokalise.com/reference/list-all-team-users
|
9
|
+
# @return [RubyLokaliseApi::Collection::TeamUserGroup<RubyLokaliseApi::Resources::TeamUserGroup>]
|
10
|
+
# @param team_id [String]
|
11
|
+
# @param params [Hash]
|
12
|
+
def team_user_groups(team_id, params = {})
|
13
|
+
c_r RubyLokaliseApi::Collections::TeamUserGroup, :all, team_id, params
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns team user from the given team
|
17
|
+
#
|
18
|
+
# @see https://developers.lokalise.com/reference/retrieve-a-team-user
|
19
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
20
|
+
# @param team_id [String]
|
21
|
+
# @param group_id [String, Integer]
|
22
|
+
def team_user_group(team_id, group_id)
|
23
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :find, [team_id, group_id]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates team user group
|
27
|
+
#
|
28
|
+
# @see https://developers.lokalise.com/reference/create-a-group
|
29
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
30
|
+
# @param params [Hash]
|
31
|
+
def create_team_user_group(team_id, params)
|
32
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :create, team_id, params
|
33
|
+
end
|
34
|
+
|
35
|
+
# Updates team user group for the given team
|
36
|
+
#
|
37
|
+
# @see https://developers.lokalise.com/reference/update-a-group
|
38
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
39
|
+
# @param team_id [String]
|
40
|
+
# @param group_id [String, Integer]
|
41
|
+
# @param params [Hash]
|
42
|
+
def update_team_user_group(team_id, group_id, params)
|
43
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :update, [team_id, group_id], params
|
44
|
+
end
|
45
|
+
|
46
|
+
# Deletes team user group from the given team
|
47
|
+
#
|
48
|
+
# @see https://developers.lokalise.com/reference/delete-a-group
|
49
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
50
|
+
# @param team_id [String]
|
51
|
+
# @param group_id [String, Integer]
|
52
|
+
def destroy_team_user_group(team_id, group_id)
|
53
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :destroy, [team_id, group_id]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Adds projects to the given group
|
57
|
+
#
|
58
|
+
# @see https://developers.lokalise.com/reference/add-projects-to-group
|
59
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
60
|
+
# @param team_id [String]
|
61
|
+
# @param group_id [String, Integer]
|
62
|
+
# @param project_ids [String, Integer, Array<String>, Array<Integer>]
|
63
|
+
def add_projects_to_group(team_id, group_id, project_ids)
|
64
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :update,
|
65
|
+
[team_id, group_id, 'projects', 'add'],
|
66
|
+
project_ids, :projects, [team_id, group_id]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Removes projects from the given group
|
70
|
+
#
|
71
|
+
# @see https://developers.lokalise.com/reference/remove-projects-from-group
|
72
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
73
|
+
# @param team_id [String]
|
74
|
+
# @param group_id [String, Integer]
|
75
|
+
# @param project_ids [String, Integer, Array<String>, Array<Integer>]
|
76
|
+
def remove_projects_from_group(team_id, group_id, project_ids)
|
77
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :update,
|
78
|
+
[team_id, group_id, 'projects', 'remove'],
|
79
|
+
project_ids, :projects, [team_id, group_id]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Adds users to the given group
|
83
|
+
#
|
84
|
+
# @see https://developers.lokalise.com/reference/add-members-to-group
|
85
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
86
|
+
# @param team_id [String]
|
87
|
+
# @param group_id [String, Integer]
|
88
|
+
# @param users_ids [String, Integer, Array<String>, Array<Integer>]
|
89
|
+
def add_users_to_group(team_id, group_id, users_ids)
|
90
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :update,
|
91
|
+
[team_id, group_id, 'members', 'add'],
|
92
|
+
users_ids, :users, [team_id, group_id]
|
93
|
+
end
|
94
|
+
|
95
|
+
# Removes users from the given group
|
96
|
+
#
|
97
|
+
# @see https://developers.lokalise.com/reference/remove-members-from-group
|
98
|
+
# @return [RubyLokaliseApi::Resources::TeamUserGroup]
|
99
|
+
# @param team_id [String]
|
100
|
+
# @param group_id [String, Integer]
|
101
|
+
# @param users_ids [String, Integer, Array<String>, Array<Integer>]
|
102
|
+
def remove_users_from_group(team_id, group_id, users_ids)
|
103
|
+
c_r RubyLokaliseApi::Resources::TeamUserGroup, :update,
|
104
|
+
[team_id, group_id, 'members', 'remove'],
|
105
|
+
users_ids, :users, [team_id, group_id]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -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://developers.lokalise.com/reference/list-all-team-users
|
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://developers.lokalise.com/reference/retrieve-a-team-user
|
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://developers.lokalise.com/reference/update-a-team-user
|
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://developers.lokalise.com/reference/delete-a-team-user
|
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://developers.lokalise.com/reference/list-all-teams
|
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://developers.lokalise.com/reference/list-all-providers
|
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://developers.lokalise.com/reference/retrieve-a-provider
|
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://developers.lokalise.com/reference/list-all-translations
|
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://developers.lokalise.com/reference/retrieve-a-translation
|
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://developers.lokalise.com/reference/update-a-translation
|
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://developers.lokalise.com/reference/list-all-webhooks
|
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://developers.lokalise.com/reference/retrieve-a-webhook
|
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://developers.lokalise.com/reference/create-a-webhook
|
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://developers.lokalise.com/reference/update-a-webhook
|
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://developers.lokalise.com/reference/delete-a-webhook
|
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://developers.lokalise.com/reference/regenerate-a-webhook-secret
|
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,31 +1,31 @@
|
|
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 =
|
8
|
-
spec.authors = ['Ilya
|
7
|
+
spec.version = RubyLokaliseApi::VERSION
|
8
|
+
spec.authors = ['Ilya Krukowski']
|
9
9
|
spec.email = ['golosizpru@gmail.com']
|
10
10
|
spec.summary = 'Ruby interface to the Lokalise API'
|
11
11
|
spec.description = 'Opinionated Ruby client for the Lokalise platform API allowing to work with translations, projects, users and other resources as with Ruby objects.'
|
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
|
-
spec.test_files = Dir['spec/**/*.rb']
|
22
21
|
spec.extra_rdoc_files = ['README.md']
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
24
|
spec.add_dependency 'addressable', '~> 2.5'
|
26
25
|
spec.add_dependency 'faraday', '~> 2.0'
|
27
26
|
spec.add_dependency 'faraday-gzip', '~> 0.1'
|
28
|
-
spec.add_dependency 'json', '
|
27
|
+
spec.add_dependency 'json', '~> 2'
|
28
|
+
spec.add_dependency 'zeitwerk', '~> 2.4'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'codecov', '~> 0.1'
|
31
31
|
spec.add_development_dependency 'dotenv', '~> 2.5'
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
38
38
|
spec.add_development_dependency 'simplecov', '~> 0.16'
|
39
39
|
spec.add_development_dependency 'vcr', '~> 6.0'
|
40
|
+
spec.add_development_dependency 'webmock', '~> 3.14'
|
40
41
|
spec.metadata = {
|
41
42
|
'rubygems_mfa_required' => 'true'
|
42
43
|
}
|