ruby-lokalise-api 5.0.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +7 -5
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/base_request.rb +4 -4
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/client.rb +24 -24
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/base.rb +10 -10
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/branch.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/contributor.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/custom_translation_status.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/file.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/key.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/key_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/order.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/payment_card.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/project.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/project_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/project_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/queued_process.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/screenshot.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/segment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/snapshot.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/system_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/task.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/team.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/team_user.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/team_user_group.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/translation.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/translation_provider.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/collections/webhook.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/connection.rb +2 -2
- data/lib/ruby_lokalise_api/data/attributes.yml +235 -0
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/error.rb +14 -14
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/json_handler.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/auth.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/connection.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2/request.rb +3 -3
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/oauth2_client.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/request.rb +3 -3
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/base.rb +16 -8
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/branch.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/contributor.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/custom_translation_status.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/file.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/key.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/key_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/order.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/payment_card.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/project.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/project_comment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/project_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/queued_process.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/screenshot.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/segment.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/snapshot.rb +2 -2
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/system_language.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/task.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team_user.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team_user_billing_details.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/team_user_group.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/translation.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/translation_provider.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/resources/webhook.rb +1 -1
- data/lib/ruby_lokalise_api/rest/branches.rb +69 -0
- data/lib/ruby_lokalise_api/rest/comments.rb +61 -0
- data/lib/ruby_lokalise_api/rest/contributors.rb +58 -0
- data/lib/ruby_lokalise_api/rest/custom_translation_statuses.rb +67 -0
- data/lib/ruby_lokalise_api/rest/files.rb +49 -0
- data/lib/ruby_lokalise_api/rest/keys.rb +79 -0
- data/lib/ruby_lokalise_api/rest/languages.rb +67 -0
- data/lib/ruby_lokalise_api/rest/orders.rb +37 -0
- data/lib/ruby_lokalise_api/rest/payment_cards.rb +43 -0
- data/lib/ruby_lokalise_api/rest/projects.rb +62 -0
- data/lib/ruby_lokalise_api/rest/queued_processes.rb +28 -0
- data/lib/ruby_lokalise_api/rest/screenshots.rb +58 -0
- data/lib/ruby_lokalise_api/rest/segments.rb +45 -0
- data/lib/ruby_lokalise_api/rest/snapshots.rb +47 -0
- data/lib/ruby_lokalise_api/rest/tasks.rb +58 -0
- data/lib/ruby_lokalise_api/rest/team_user_billing_details.rb +36 -0
- data/lib/ruby_lokalise_api/rest/team_user_groups.rb +109 -0
- data/lib/ruby_lokalise_api/rest/team_users.rb +48 -0
- data/lib/ruby_lokalise_api/rest/teams.rb +16 -0
- data/lib/ruby_lokalise_api/rest/translation_providers.rb +27 -0
- data/lib/ruby_lokalise_api/rest/translations.rb +39 -0
- data/lib/ruby_lokalise_api/rest/webhooks.rb +69 -0
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/utils/attribute_helpers.rb +7 -7
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/utils/endpoint_helpers.rb +1 -1
- data/lib/{ruby-lokalise-api → ruby_lokalise_api}/utils/string_utils.rb +1 -1
- data/lib/ruby_lokalise_api/version.rb +5 -0
- data/lib/ruby_lokalise_api.rb +50 -0
- data/ruby-lokalise-api.gemspec +8 -7
- metadata +125 -157
- data/lib/ruby-lokalise-api/data/attributes.json +0 -259
- data/lib/ruby-lokalise-api/rest/branches.rb +0 -67
- data/lib/ruby-lokalise-api/rest/comments.rb +0 -59
- data/lib/ruby-lokalise-api/rest/contributors.rb +0 -56
- data/lib/ruby-lokalise-api/rest/custom_translation_statuses.rb +0 -65
- data/lib/ruby-lokalise-api/rest/files.rb +0 -36
- data/lib/ruby-lokalise-api/rest/keys.rb +0 -77
- data/lib/ruby-lokalise-api/rest/languages.rb +0 -65
- data/lib/ruby-lokalise-api/rest/orders.rb +0 -35
- data/lib/ruby-lokalise-api/rest/payment_cards.rb +0 -41
- data/lib/ruby-lokalise-api/rest/projects.rb +0 -60
- data/lib/ruby-lokalise-api/rest/queued_processes.rb +0 -26
- data/lib/ruby-lokalise-api/rest/screenshots.rb +0 -56
- data/lib/ruby-lokalise-api/rest/segments.rb +0 -43
- data/lib/ruby-lokalise-api/rest/snapshots.rb +0 -45
- data/lib/ruby-lokalise-api/rest/tasks.rb +0 -56
- data/lib/ruby-lokalise-api/rest/team_user_billing_details.rb +0 -34
- data/lib/ruby-lokalise-api/rest/team_user_group.rb +0 -107
- data/lib/ruby-lokalise-api/rest/team_users.rb +0 -46
- data/lib/ruby-lokalise-api/rest/teams.rb +0 -14
- data/lib/ruby-lokalise-api/rest/translation_providers.rb +0 -25
- data/lib/ruby-lokalise-api/rest/translations.rb +0 -37
- data/lib/ruby-lokalise-api/rest/webhooks.rb +0 -67
- data/lib/ruby-lokalise-api/version.rb +0 -5
- data/lib/ruby-lokalise-api.rb +0 -111
- data/spec/lib/ruby-lokalise-api/connection_spec.rb +0 -68
- data/spec/lib/ruby-lokalise-api/custom_json_parser_spec.rb +0 -81
- data/spec/lib/ruby-lokalise-api/error_spec.rb +0 -41
- data/spec/lib/ruby-lokalise-api/oauth2/auth_spec.rb +0 -73
- data/spec/lib/ruby-lokalise-api/rest/branches_spec.rb +0 -140
- data/spec/lib/ruby-lokalise-api/rest/comments_spec.rb +0 -118
- data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +0 -132
- data/spec/lib/ruby-lokalise-api/rest/custom_translation_statuses_spec.rb +0 -131
- data/spec/lib/ruby-lokalise-api/rest/files_spec.rb +0 -66
- data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +0 -199
- data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +0 -134
- data/spec/lib/ruby-lokalise-api/rest/orders_spec.rb +0 -113
- data/spec/lib/ruby-lokalise-api/rest/payment_cards_spec.rb +0 -92
- data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +0 -150
- data/spec/lib/ruby-lokalise-api/rest/queued_processes_spec.rb +0 -57
- data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +0 -127
- data/spec/lib/ruby-lokalise-api/rest/segments_spec.rb +0 -106
- data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +0 -117
- data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +0 -145
- data/spec/lib/ruby-lokalise-api/rest/team_user_billing_details_spec.rb +0 -48
- data/spec/lib/ruby-lokalise-api/rest/team_user_groups_spec.rb +0 -278
- data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +0 -95
- data/spec/lib/ruby-lokalise-api/rest/teams_spec.rb +0 -25
- data/spec/lib/ruby-lokalise-api/rest/translation_providers_spec.rb +0 -48
- data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +0 -118
- data/spec/lib/ruby-lokalise-api/rest/webhooks_spec.rb +0 -126
- data/spec/lib/ruby-lokalise-api_spec.rb +0 -47
- data/spec/spec_helper.rb +0 -22
- data/spec/support/test_client.rb +0 -15
- data/spec/support/vcr.rb +0 -15
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all tasks for the given project
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-tasks-get
|
8
|
-
# @return [Lokalise::Collection::Task<Lokalise::Resources::Task>]
|
9
|
-
# @param project_id [String]
|
10
|
-
# @param params [Hash]
|
11
|
-
def tasks(project_id, params = {})
|
12
|
-
c_r Lokalise::Collections::Task, :all, project_id, params
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns a single task for the given project
|
16
|
-
#
|
17
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-task-get
|
18
|
-
# @return [Lokalise::Resources::Task]
|
19
|
-
# @param project_id [String]
|
20
|
-
# @param task_id [String, Integer]
|
21
|
-
def task(project_id, task_id)
|
22
|
-
c_r Lokalise::Resources::Task, :find, [project_id, task_id]
|
23
|
-
end
|
24
|
-
|
25
|
-
# Creates task for the given project
|
26
|
-
#
|
27
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-task-post
|
28
|
-
# @return [Lokalise::Resources::Task]
|
29
|
-
# @param project_id [String]
|
30
|
-
# @param params [Hash]
|
31
|
-
def create_task(project_id, params)
|
32
|
-
c_r Lokalise::Resources::Task, :create, project_id, params
|
33
|
-
end
|
34
|
-
|
35
|
-
# Updates task for the given project
|
36
|
-
#
|
37
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-task-put
|
38
|
-
# @return [Lokalise::Resources::Task]
|
39
|
-
# @param project_id [String]
|
40
|
-
# @param task_id [String, Integer]
|
41
|
-
# @param params [Hash]
|
42
|
-
def update_task(project_id, task_id, params = {})
|
43
|
-
c_r Lokalise::Resources::Task, :update, [project_id, task_id], params
|
44
|
-
end
|
45
|
-
|
46
|
-
# Deletes task for the given project
|
47
|
-
#
|
48
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-task-delete
|
49
|
-
# @return [Hash]
|
50
|
-
# @param project_id [String]
|
51
|
-
# @param task_id [String, Integer]
|
52
|
-
def destroy_task(project_id, task_id)
|
53
|
-
c_r Lokalise::Resources::Task, :destroy, [project_id, task_id]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns team user billing details
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-team-user-billing-details-get
|
8
|
-
# @return [Lokalise::Resources::TeamUserBillingDetails]
|
9
|
-
# @param team_id [String]
|
10
|
-
def team_user_billing_details(team_id)
|
11
|
-
c_r Lokalise::Resources::TeamUserBillingDetails, :find, team_id
|
12
|
-
end
|
13
|
-
|
14
|
-
# Creates team user billing details
|
15
|
-
#
|
16
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-create-team-user-billing-details-post
|
17
|
-
# @return [Lokalise::Resources::TeamUserBillingDetails]
|
18
|
-
# @param team_id [String]
|
19
|
-
# @param params [Hash]
|
20
|
-
def create_team_user_billing_details(team_id, params)
|
21
|
-
c_r Lokalise::Resources::TeamUserBillingDetails, :create, team_id, params
|
22
|
-
end
|
23
|
-
|
24
|
-
# Updates team user billing details
|
25
|
-
#
|
26
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-create-team-user-billing-details-post
|
27
|
-
# @return [Lokalise::Resources::TeamUserBillingDetails]
|
28
|
-
# @param team_id [String]
|
29
|
-
# @param params [Hash]
|
30
|
-
def update_team_user_billing_details(team_id, params)
|
31
|
-
c_r Lokalise::Resources::TeamUserBillingDetails, :update, team_id, params
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all team user groups for the given team
|
6
|
-
#
|
7
|
-
# @see https://lokalise.co/api2docs/curl/#transition-list-all-groups-get
|
8
|
-
# @return [Lokalise::Collection::TeamUserGroup<Lokalise::Resources::TeamUserGroup>]
|
9
|
-
# @param team_id [String]
|
10
|
-
# @param params [Hash]
|
11
|
-
def team_user_groups(team_id, params = {})
|
12
|
-
c_r Lokalise::Collections::TeamUserGroup, :all, team_id, params
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns team user from the given team
|
16
|
-
#
|
17
|
-
# @see https://lokalise.co/api2docs/curl/#transition-retrieve-a-group-get
|
18
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
19
|
-
# @param team_id [String]
|
20
|
-
# @param group_id [String, Integer]
|
21
|
-
def team_user_group(team_id, group_id)
|
22
|
-
c_r Lokalise::Resources::TeamUserGroup, :find, [team_id, group_id]
|
23
|
-
end
|
24
|
-
|
25
|
-
# Creates team user group
|
26
|
-
#
|
27
|
-
# @see https://lokalise.co/api2docs/curl/#resource-team-user-groups
|
28
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
29
|
-
# @param params [Hash]
|
30
|
-
def create_team_user_group(team_id, params)
|
31
|
-
c_r Lokalise::Resources::TeamUserGroup, :create, team_id, params
|
32
|
-
end
|
33
|
-
|
34
|
-
# Updates team user group for the given team
|
35
|
-
#
|
36
|
-
# @see https://lokalise.co/api2docs/curl/#transition-update-a-group-put
|
37
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
38
|
-
# @param team_id [String]
|
39
|
-
# @param group_id [String, Integer]
|
40
|
-
# @param params [Hash]
|
41
|
-
def update_team_user_group(team_id, group_id, params)
|
42
|
-
c_r Lokalise::Resources::TeamUserGroup, :update, [team_id, group_id], params
|
43
|
-
end
|
44
|
-
|
45
|
-
# Deletes team user group from the given team
|
46
|
-
#
|
47
|
-
# @see https://lokalise.co/api2docs/curl/#transition-delete-a-group-delete
|
48
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
49
|
-
# @param team_id [String]
|
50
|
-
# @param group_id [String, Integer]
|
51
|
-
def destroy_team_user_group(team_id, group_id)
|
52
|
-
c_r Lokalise::Resources::TeamUserGroup, :destroy, [team_id, group_id]
|
53
|
-
end
|
54
|
-
|
55
|
-
# Adds projects to the given group
|
56
|
-
#
|
57
|
-
# @see https://lokalise.co/api2docs/curl/#transition-add-projects-to-group-put
|
58
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
59
|
-
# @param team_id [String]
|
60
|
-
# @param group_id [String, Integer]
|
61
|
-
# @param project_ids [String, Integer, Array<String>, Array<Integer>]
|
62
|
-
def add_projects_to_group(team_id, group_id, project_ids)
|
63
|
-
c_r Lokalise::Resources::TeamUserGroup, :update,
|
64
|
-
[team_id, group_id, 'projects', 'add'],
|
65
|
-
project_ids, :projects, [team_id, group_id]
|
66
|
-
end
|
67
|
-
|
68
|
-
# Removes projects from the given group
|
69
|
-
#
|
70
|
-
# @see https://lokalise.co/api2docs/curl/#transition-remove-projects-from-group-put
|
71
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
72
|
-
# @param team_id [String]
|
73
|
-
# @param group_id [String, Integer]
|
74
|
-
# @param project_ids [String, Integer, Array<String>, Array<Integer>]
|
75
|
-
def remove_projects_from_group(team_id, group_id, project_ids)
|
76
|
-
c_r Lokalise::Resources::TeamUserGroup, :update,
|
77
|
-
[team_id, group_id, 'projects', 'remove'],
|
78
|
-
project_ids, :projects, [team_id, group_id]
|
79
|
-
end
|
80
|
-
|
81
|
-
# Adds users to the given group
|
82
|
-
#
|
83
|
-
# @see https://lokalise.co/api2docs/curl/#transition-add-members-to-group-put
|
84
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
85
|
-
# @param team_id [String]
|
86
|
-
# @param group_id [String, Integer]
|
87
|
-
# @param users_ids [String, Integer, Array<String>, Array<Integer>]
|
88
|
-
def add_users_to_group(team_id, group_id, users_ids)
|
89
|
-
c_r Lokalise::Resources::TeamUserGroup, :update,
|
90
|
-
[team_id, group_id, 'members', 'add'],
|
91
|
-
users_ids, :users, [team_id, group_id]
|
92
|
-
end
|
93
|
-
|
94
|
-
# Removes users from the given group
|
95
|
-
#
|
96
|
-
# @see https://lokalise.co/api2docs/curl/#transition-remove-members-from-group-put
|
97
|
-
# @return [Lokalise::Resources::TeamUserGroup]
|
98
|
-
# @param team_id [String]
|
99
|
-
# @param group_id [String, Integer]
|
100
|
-
# @param users_ids [String, Integer, Array<String>, Array<Integer>]
|
101
|
-
def remove_users_from_group(team_id, group_id, users_ids)
|
102
|
-
c_r Lokalise::Resources::TeamUserGroup, :update,
|
103
|
-
[team_id, group_id, 'members', 'remove'],
|
104
|
-
users_ids, :users, [team_id, group_id]
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all team users for the given team
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-team-users-get
|
8
|
-
# @return [Lokalise::Collection::TeamUser<Lokalise::Resources::TeamUser>]
|
9
|
-
# @param team_id [String]
|
10
|
-
# @param params [Hash]
|
11
|
-
def team_users(team_id, params = {})
|
12
|
-
c_r Lokalise::Collections::TeamUser, :all, team_id, params
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns team user from the given team
|
16
|
-
#
|
17
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-team-user-get
|
18
|
-
# @return [Lokalise::Resources::TeamUser]
|
19
|
-
# @param team_id [String]
|
20
|
-
# @param user_id [String, Integer]
|
21
|
-
def team_user(team_id, user_id)
|
22
|
-
c_r Lokalise::Resources::TeamUser, :find, [team_id, user_id]
|
23
|
-
end
|
24
|
-
|
25
|
-
# Updates team user for the given team
|
26
|
-
#
|
27
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-team-user-put
|
28
|
-
# @return [Lokalise::Resources::TeamUser]
|
29
|
-
# @param team_id [String]
|
30
|
-
# @param user_id [String, Integer]
|
31
|
-
# @param params [Hash]
|
32
|
-
def update_team_user(team_id, user_id, params)
|
33
|
-
c_r Lokalise::Resources::TeamUser, :update, [team_id, user_id], params
|
34
|
-
end
|
35
|
-
|
36
|
-
# Deletes team user from the given team
|
37
|
-
#
|
38
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-team-user-delete
|
39
|
-
# @return [Lokalise::Resources::TeamUser]
|
40
|
-
# @param team_id [String]
|
41
|
-
# @param user_id [String, Integer]
|
42
|
-
def destroy_team_user(team_id, user_id)
|
43
|
-
c_r Lokalise::Resources::TeamUser, :destroy, [team_id, user_id]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all teams available to the user
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-teams-get
|
8
|
-
# @return [Lokalise::Collection::Team<Lokalise::Resources::Team>]
|
9
|
-
# @param params [Hash]
|
10
|
-
def teams(params = {})
|
11
|
-
c_r Lokalise::Collections::Team, :all, nil, params
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all translation providers for the given team
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-providers-get
|
8
|
-
# @return [Lokalise::Collection::TranslationProvider<Lokalise::Resources::TranslationProvider>]
|
9
|
-
# @param team_id [String]
|
10
|
-
# @param params [Hash]
|
11
|
-
def translation_providers(team_id, params = {})
|
12
|
-
c_r Lokalise::Collections::TranslationProvider, :all, team_id, params
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns a single translation provider for the given team
|
16
|
-
#
|
17
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-provider-get
|
18
|
-
# @return [Lokalise::Resources::TranslationProvider]
|
19
|
-
# @param team_id [String]
|
20
|
-
# @param provider_id [String, Integer]
|
21
|
-
def translation_provider(team_id, provider_id)
|
22
|
-
c_r Lokalise::Resources::TranslationProvider, :find, [team_id, provider_id]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all translations for the given project (ungrouped)
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-translations-get
|
8
|
-
# @return [Lokalise::Collection::Translation<Lokalise::Resources::Translation>]
|
9
|
-
# @param project_id [String]
|
10
|
-
# @param params [Hash]
|
11
|
-
def translations(project_id, params = {})
|
12
|
-
c_r Lokalise::Collections::Translation, :all, project_id, params
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns translation of the given project
|
16
|
-
#
|
17
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-translation-get
|
18
|
-
# @return [Lokalise::Resources::Translation]
|
19
|
-
# @param project_id [String]
|
20
|
-
# @param translation_id [String, Integer]
|
21
|
-
# @param params [Hash]
|
22
|
-
def translation(project_id, translation_id, params = {})
|
23
|
-
c_r Lokalise::Resources::Translation, :find, [project_id, translation_id], params
|
24
|
-
end
|
25
|
-
|
26
|
-
# Updates translation of the given project
|
27
|
-
#
|
28
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-translation-put
|
29
|
-
# @return [Lokalise::Resources::Translation]
|
30
|
-
# @param project_id [String]
|
31
|
-
# @param translation_id [String, Integer]
|
32
|
-
# @param params [Hash]
|
33
|
-
def update_translation(project_id, translation_id, params)
|
34
|
-
c_r Lokalise::Resources::Translation, :update, [project_id, translation_id], params
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lokalise
|
4
|
-
class Client
|
5
|
-
# Returns all webhooks for the given project
|
6
|
-
#
|
7
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-list-all-webhooks-get
|
8
|
-
# @return [Lokalise::Collection::Webhook<Lokalise::Resources::Webhook>]
|
9
|
-
# @param project_id [String]
|
10
|
-
# @param params [Hash]
|
11
|
-
def webhooks(project_id, params = {})
|
12
|
-
c_r Lokalise::Collections::Webhook, :all, project_id, params
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns a single webhook for the given project
|
16
|
-
#
|
17
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-webhook-get
|
18
|
-
# @return [Lokalise::Resources::Webhook]
|
19
|
-
# @param project_id [String]
|
20
|
-
# @param webhook_id [String, Integer]
|
21
|
-
def webhook(project_id, webhook_id)
|
22
|
-
c_r Lokalise::Resources::Webhook, :find, [project_id, webhook_id]
|
23
|
-
end
|
24
|
-
|
25
|
-
# Creates webhook for the given project
|
26
|
-
#
|
27
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-create-a-webhook-post
|
28
|
-
# @return [Lokalise::Resources::Webhook]
|
29
|
-
# @param project_id [String]
|
30
|
-
# @param params [Hash]
|
31
|
-
def create_webhook(project_id, params)
|
32
|
-
c_r Lokalise::Resources::Webhook, :create, project_id, params
|
33
|
-
end
|
34
|
-
|
35
|
-
# Updates webhook for the given project
|
36
|
-
#
|
37
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-update-a-webhook-put
|
38
|
-
# @return [Lokalise::Resources::Webhook]
|
39
|
-
# @param project_id [String]
|
40
|
-
# @param webhook_id [String, Integer]
|
41
|
-
# @param params [Hash]
|
42
|
-
def update_webhook(project_id, webhook_id, params = {})
|
43
|
-
c_r Lokalise::Resources::Webhook, :update, [project_id, webhook_id], params
|
44
|
-
end
|
45
|
-
|
46
|
-
# Deletes webhook for the given project
|
47
|
-
#
|
48
|
-
# @see https://app.lokalise.com/api2docs/curl/#transition-delete-a-webhook-delete
|
49
|
-
# @return [Hash]
|
50
|
-
# @param project_id [String]
|
51
|
-
# @param webhook_id [String, Integer]
|
52
|
-
def destroy_webhook(project_id, webhook_id)
|
53
|
-
c_r Lokalise::Resources::Webhook, :destroy, [project_id, webhook_id]
|
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
|
66
|
-
end
|
67
|
-
end
|
data/lib/ruby-lokalise-api.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'faraday'
|
4
|
-
require 'faraday/gzip'
|
5
|
-
require 'yaml'
|
6
|
-
require 'addressable'
|
7
|
-
|
8
|
-
require 'ruby-lokalise-api/version'
|
9
|
-
require 'ruby-lokalise-api/json_handler'
|
10
|
-
require 'ruby-lokalise-api/connection'
|
11
|
-
require 'ruby-lokalise-api/base_request'
|
12
|
-
require 'ruby-lokalise-api/request'
|
13
|
-
require 'ruby-lokalise-api/error'
|
14
|
-
require 'ruby-lokalise-api/utils/string_utils'
|
15
|
-
require 'ruby-lokalise-api/utils/attribute_helpers'
|
16
|
-
require 'ruby-lokalise-api/utils/endpoint_helpers'
|
17
|
-
|
18
|
-
require 'ruby-lokalise-api/oauth2/connection'
|
19
|
-
require 'ruby-lokalise-api/oauth2/request'
|
20
|
-
|
21
|
-
require 'ruby-lokalise-api/resources/base'
|
22
|
-
require 'ruby-lokalise-api/resources/branch'
|
23
|
-
require 'ruby-lokalise-api/resources/project'
|
24
|
-
require 'ruby-lokalise-api/resources/project_language'
|
25
|
-
require 'ruby-lokalise-api/resources/queued_process'
|
26
|
-
require 'ruby-lokalise-api/resources/key_comment'
|
27
|
-
require 'ruby-lokalise-api/resources/contributor'
|
28
|
-
require 'ruby-lokalise-api/resources/file'
|
29
|
-
require 'ruby-lokalise-api/resources/translation'
|
30
|
-
require 'ruby-lokalise-api/resources/team_user'
|
31
|
-
require 'ruby-lokalise-api/resources/task'
|
32
|
-
require 'ruby-lokalise-api/resources/snapshot'
|
33
|
-
require 'ruby-lokalise-api/resources/screenshot'
|
34
|
-
require 'ruby-lokalise-api/resources/key'
|
35
|
-
require 'ruby-lokalise-api/resources/project_comment'
|
36
|
-
require 'ruby-lokalise-api/resources/system_language'
|
37
|
-
require 'ruby-lokalise-api/resources/team'
|
38
|
-
require 'ruby-lokalise-api/resources/order'
|
39
|
-
require 'ruby-lokalise-api/resources/payment_card'
|
40
|
-
require 'ruby-lokalise-api/resources/translation_provider'
|
41
|
-
require 'ruby-lokalise-api/resources/team_user_group'
|
42
|
-
require 'ruby-lokalise-api/resources/custom_translation_status'
|
43
|
-
require 'ruby-lokalise-api/resources/webhook'
|
44
|
-
require 'ruby-lokalise-api/resources/segment'
|
45
|
-
require 'ruby-lokalise-api/resources/team_user_billing_details'
|
46
|
-
|
47
|
-
require 'ruby-lokalise-api/collections/base'
|
48
|
-
require 'ruby-lokalise-api/collections/branch'
|
49
|
-
require 'ruby-lokalise-api/collections/project'
|
50
|
-
require 'ruby-lokalise-api/collections/team'
|
51
|
-
require 'ruby-lokalise-api/collections/system_language'
|
52
|
-
require 'ruby-lokalise-api/collections/project_language'
|
53
|
-
require 'ruby-lokalise-api/collections/project_comment'
|
54
|
-
require 'ruby-lokalise-api/collections/queued_process'
|
55
|
-
require 'ruby-lokalise-api/collections/key_comment'
|
56
|
-
require 'ruby-lokalise-api/collections/key'
|
57
|
-
require 'ruby-lokalise-api/collections/contributor'
|
58
|
-
require 'ruby-lokalise-api/collections/file'
|
59
|
-
require 'ruby-lokalise-api/collections/translation'
|
60
|
-
require 'ruby-lokalise-api/collections/team_user'
|
61
|
-
require 'ruby-lokalise-api/collections/task'
|
62
|
-
require 'ruby-lokalise-api/collections/snapshot'
|
63
|
-
require 'ruby-lokalise-api/collections/screenshot'
|
64
|
-
require 'ruby-lokalise-api/collections/order'
|
65
|
-
require 'ruby-lokalise-api/collections/payment_card'
|
66
|
-
require 'ruby-lokalise-api/collections/translation_provider'
|
67
|
-
require 'ruby-lokalise-api/collections/team_user_group'
|
68
|
-
require 'ruby-lokalise-api/collections/custom_translation_status'
|
69
|
-
require 'ruby-lokalise-api/collections/webhook'
|
70
|
-
require 'ruby-lokalise-api/collections/segment'
|
71
|
-
|
72
|
-
require 'ruby-lokalise-api/client'
|
73
|
-
require 'ruby-lokalise-api/oauth2_client'
|
74
|
-
|
75
|
-
require 'ruby-lokalise-api/oauth2/auth'
|
76
|
-
|
77
|
-
module Lokalise
|
78
|
-
class << self
|
79
|
-
# Initializes a new Client object
|
80
|
-
#
|
81
|
-
# @return [Lokalise::Client]
|
82
|
-
# @param token [String]
|
83
|
-
# @param params [Hash]
|
84
|
-
def client(token, params = {})
|
85
|
-
@client = Lokalise::Client.new token, params
|
86
|
-
end
|
87
|
-
|
88
|
-
# Reset the currently set client
|
89
|
-
def reset_client!
|
90
|
-
@client = nil
|
91
|
-
end
|
92
|
-
|
93
|
-
# Initializes a new OAuth2Client object
|
94
|
-
#
|
95
|
-
# @return [Lokalise::OAuth2Client]
|
96
|
-
# @param token [String]
|
97
|
-
# @param params [Hash]
|
98
|
-
def oauth2_client(token, params = {})
|
99
|
-
@oauth2_client = Lokalise::OAuth2Client.new token, params
|
100
|
-
end
|
101
|
-
|
102
|
-
# Reset the currently set OAuth2 client
|
103
|
-
def reset_oauth2_client!
|
104
|
-
@oauth2_client = nil
|
105
|
-
end
|
106
|
-
|
107
|
-
def auth_client(client_id, client_secret)
|
108
|
-
Lokalise::OAuth2::Auth.new client_id, client_secret
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Lokalise::Connection do
|
4
|
-
let(:dummy) { Class.new { include Lokalise::Connection }.new }
|
5
|
-
|
6
|
-
let(:project_id) { '803826145ba90b42d5d860.46800099' }
|
7
|
-
let(:key_id) { 44_596_059 }
|
8
|
-
|
9
|
-
before { Lokalise.reset_client! }
|
10
|
-
|
11
|
-
after { Lokalise.reset_client! }
|
12
|
-
|
13
|
-
it 'Authorization header must be present for OAuth2 client' do
|
14
|
-
conn = dummy.connection test_oauth2_client
|
15
|
-
expect(conn.headers['Authorization']).to eq(test_oauth2_client.token)
|
16
|
-
expect(conn.headers['X-api-token']).to be_nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'timeouts are not be set by default but the token must be present' do
|
20
|
-
conn = dummy.connection test_client
|
21
|
-
expect(conn.options.timeout).to be_nil
|
22
|
-
expect(conn.options.open_timeout).to be_nil
|
23
|
-
expect(conn.headers['X-api-token']).to eq(test_client.token)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'allows to customize timeouts' do
|
27
|
-
custom_client = Lokalise.client(ENV['LOKALISE_API_TOKEN'],
|
28
|
-
open_timeout: 100, timeout: 500)
|
29
|
-
conn = dummy.connection custom_client
|
30
|
-
expect(conn.options.timeout).to eq(500)
|
31
|
-
expect(conn.options.open_timeout).to eq(100)
|
32
|
-
expect(conn.headers['X-api-token']).to eq(custom_client.token)
|
33
|
-
|
34
|
-
custom_client.timeout = 300
|
35
|
-
custom_client.open_timeout = 200
|
36
|
-
another_conn = dummy.connection custom_client
|
37
|
-
expect(another_conn.options.timeout).to eq(300)
|
38
|
-
expect(another_conn.options.open_timeout).to eq(200)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'works with gzip compression' do
|
42
|
-
gzip_client = Lokalise.client(ENV['LOKALISE_API_TOKEN'])
|
43
|
-
keys = VCR.use_cassette('all_keys_gzip') do
|
44
|
-
gzip_client.keys project_id, limit: 30
|
45
|
-
end.collection
|
46
|
-
|
47
|
-
expect(keys.first.key_id).to eq(key_id)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'gzip compression is on by default' do
|
51
|
-
custom_client = Lokalise.client(ENV['LOKALISE_API_TOKEN'])
|
52
|
-
conn = dummy.connection custom_client
|
53
|
-
expect(conn.headers['X-api-token']).to eq(custom_client.token)
|
54
|
-
expect(conn.builder.handlers).to include(Faraday::Gzip::Middleware)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'is possible to customize adapter' do
|
58
|
-
conn = dummy.connection test_client
|
59
|
-
expect(conn.builder.adapter).to eq(Faraday::Adapter::NetHttp)
|
60
|
-
|
61
|
-
Faraday.default_adapter = :test
|
62
|
-
|
63
|
-
another_conn = dummy.connection test_client
|
64
|
-
|
65
|
-
expect(another_conn.builder.adapter).to eq(Faraday::Adapter::Test)
|
66
|
-
expect(conn.builder.adapter).to eq(Faraday::Adapter::NetHttp)
|
67
|
-
end
|
68
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'oj'
|
4
|
-
|
5
|
-
RSpec.describe Lokalise::JsonHandler do
|
6
|
-
let(:loaded_json) do
|
7
|
-
{'projects' => [{'project_id' => '547879415c01a0e6e0b855.29978928',
|
8
|
-
'name' => 'demo phoenix copy',
|
9
|
-
'description' => '',
|
10
|
-
'created_at' => '2018-11-30 20:43:18 (Etc/UTC)',
|
11
|
-
'created_by' => 20_181,
|
12
|
-
'created_by_email' => 'bodrovis@protonmail.com',
|
13
|
-
'team_id' => 176_692,
|
14
|
-
'statistics' =>
|
15
|
-
{'progress' => 0,
|
16
|
-
'keys' => 1,
|
17
|
-
'team' => 1,
|
18
|
-
'base_words' => 0,
|
19
|
-
'qa_issues' => 1,
|
20
|
-
'languages' =>
|
21
|
-
[{'language_id' => 640, 'language_iso' => 'en', 'progress' => 0, 'words_to_do' => 0},
|
22
|
-
{'language_id' => 597, 'language_iso' => 'ru', 'progress' => 0, 'words_to_do' => 0},
|
23
|
-
{'language_id' => 673, 'language_iso' => 'f_over', 'progress' => 0, 'words_to_do' => 0}]}}]}
|
24
|
-
end
|
25
|
-
|
26
|
-
let(:dumped_json) do
|
27
|
-
'{":name":"rspec proj",":description":"demo project for rspec"}'
|
28
|
-
end
|
29
|
-
|
30
|
-
# rubocop:disable RSpec/LeakyConstantDeclaration, Lint/ConstantDefinitionInBlock
|
31
|
-
before do
|
32
|
-
module Lokalise
|
33
|
-
module JsonHandler
|
34
|
-
def custom_dump(obj)
|
35
|
-
Oj.dump obj
|
36
|
-
end
|
37
|
-
|
38
|
-
def custom_load(obj)
|
39
|
-
Oj.load obj
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
after do
|
46
|
-
module Lokalise
|
47
|
-
module JsonHandler
|
48
|
-
def custom_dump(obj)
|
49
|
-
JSON.dump obj
|
50
|
-
end
|
51
|
-
|
52
|
-
def custom_load(obj)
|
53
|
-
JSON.parse obj
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
# rubocop:enable RSpec/LeakyConstantDeclaration, Lint/ConstantDefinitionInBlock
|
59
|
-
|
60
|
-
it 'allows to customize #load' do
|
61
|
-
allow(Oj).to receive(:load).and_return(loaded_json)
|
62
|
-
expect(JSON).not_to receive(:parse)
|
63
|
-
projects = VCR.use_cassette('all_projects_pagination') do
|
64
|
-
test_client.projects limit: 1, page: 2
|
65
|
-
end
|
66
|
-
|
67
|
-
expect(projects.collection.count).to eq(1)
|
68
|
-
expect(projects.total_results).to eq(5)
|
69
|
-
expect(projects.collection.first.name).to eq('demo phoenix copy')
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'allows to customize #dump' do
|
73
|
-
allow(Oj).to receive(:dump).and_return(dumped_json)
|
74
|
-
expect(JSON).not_to receive(:dump)
|
75
|
-
project = VCR.use_cassette('new_project') do
|
76
|
-
test_client.create_project name: 'rspec proj', description: 'demo project for rspec'
|
77
|
-
end
|
78
|
-
|
79
|
-
expect(project.name).to eq('rspec proj')
|
80
|
-
end
|
81
|
-
end
|