crowdin-api 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +96 -31
- data/README.md +8 -6
- data/bin/crowdin-console +1 -1
- data/crowdin-api.gemspec +1 -2
- data/lib/crowdin-api/{api-resources → api_resources}/dictionaries.rb +8 -10
- data/lib/crowdin-api/{api-resources → api_resources}/distributions.rb +25 -32
- data/lib/crowdin-api/{api-resources → api_resources}/glossaries.rb +64 -82
- data/lib/crowdin-api/{api-resources → api_resources}/labels.rb +28 -47
- data/lib/crowdin-api/api_resources/languages.rb +61 -0
- data/lib/crowdin-api/api_resources/machine_translation_engines.rb +79 -0
- data/lib/crowdin-api/api_resources/projects.rb +124 -0
- data/lib/crowdin-api/api_resources/reports.rb +120 -0
- data/lib/crowdin-api/{api-resources → api_resources}/screenshots.rb +47 -61
- data/lib/crowdin-api/{api-resources → api_resources}/source_files.rb +68 -131
- data/lib/crowdin-api/{api-resources → api_resources}/source_strings.rb +19 -24
- data/lib/crowdin-api/api_resources/storages.rb +54 -0
- data/lib/crowdin-api/{api-resources → api_resources}/string_comments.rb +18 -23
- data/lib/crowdin-api/{api-resources → api_resources}/string_translations.rb +63 -90
- data/lib/crowdin-api/{api-resources → api_resources}/tasks.rb +30 -41
- data/lib/crowdin-api/api_resources/teams.rb +135 -0
- data/lib/crowdin-api/{api-resources → api_resources}/translation_memory.rb +38 -52
- data/lib/crowdin-api/{api-resources → api_resources}/translation_status.rb +24 -30
- data/lib/crowdin-api/{api-resources → api_resources}/translations.rb +40 -58
- data/lib/crowdin-api/api_resources/users.rb +161 -0
- data/lib/crowdin-api/api_resources/vendors.rb +21 -0
- data/lib/crowdin-api/{api-resources → api_resources}/webhooks.rb +19 -24
- data/lib/crowdin-api/api_resources/workflows.rb +59 -0
- data/lib/crowdin-api/client/client.rb +51 -42
- data/lib/crowdin-api/client/configuration.rb +12 -12
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/errors_raisers.rb +1 -1
- data/lib/crowdin-api/core/request.rb +53 -88
- data/lib/crowdin-api/core/send_request.rb +67 -0
- data/lib/crowdin-api.rb +17 -24
- data/spec/api_resources/dictionaries_spec.rb +23 -0
- data/spec/api_resources/distributions_spec.rb +71 -0
- data/spec/api_resources/glossaries_spec.rb +167 -0
- data/spec/api_resources/labels_spec.rb +71 -0
- data/spec/api_resources/languages_spec.rb +51 -0
- data/spec/api_resources/machine_translation_engines_spec.rb +63 -0
- data/spec/api_resources/projects_spec.rb +215 -0
- data/spec/api_resources/reports_spec.rb +95 -0
- data/spec/api_resources/screenshots_spec.rb +134 -0
- data/spec/api_resources/source_files_spec.rb +13 -0
- data/spec/api_resources/source_strings_spec.rb +51 -0
- data/spec/api_resources/storages_spec.rb +13 -0
- data/spec/api_resources/string_comments_spec.rb +13 -0
- data/spec/api_resources/string_translations_spec.rb +13 -0
- data/spec/api_resources/tasks_spec.rb +79 -0
- data/spec/api_resources/teams_spec.rb +13 -0
- data/spec/api_resources/translation_memory_spec.rb +13 -0
- data/spec/api_resources/translation_status_spec.rb +15 -0
- data/spec/api_resources/translations_spec.rb +107 -0
- data/spec/api_resources/users_spec.rb +117 -0
- data/spec/api_resources/vendors_spec.rb +13 -0
- data/spec/api_resources/webhooks_spec.rb +51 -0
- data/spec/api_resources/workflows_spec.rb +41 -0
- data/spec/spec_helper.rb +20 -2
- data/spec/unit/client_spec.rb +85 -0
- metadata +64 -43
- data/bin/setup +0 -6
- data/lib/crowdin-api/api-resources/languages.rb +0 -82
- data/lib/crowdin-api/api-resources/machine_translation_engines.rb +0 -74
- data/lib/crowdin-api/api-resources/projects.rb +0 -148
- data/lib/crowdin-api/api-resources/reports.rb +0 -138
- data/lib/crowdin-api/api-resources/storages.rb +0 -106
- data/lib/crowdin-api/api-resources/teams.rb +0 -144
- data/lib/crowdin-api/api-resources/users.rb +0 -129
- data/lib/crowdin-api/api-resources/vendors.rb +0 -21
- data/lib/crowdin-api/api-resources/workflows.rb +0 -62
- data/lib/crowdin-api/core/utils.rb +0 -10
- data/spec/client/client-instance_spec.rb +0 -14
- data/spec/client/configuration-instance_spec.rb +0 -72
@@ -7,26 +7,24 @@ module Crowdin
|
|
7
7
|
project_id || raise_project_id_is_required_error
|
8
8
|
|
9
9
|
request = Web::Request.new(
|
10
|
-
|
10
|
+
connection,
|
11
11
|
:get,
|
12
|
-
"/projects/#{project_id}/approvals",
|
13
|
-
query
|
12
|
+
"#{config.target_api_url}/projects/#{project_id}/approvals",
|
13
|
+
{ params: query }
|
14
14
|
)
|
15
|
-
|
16
|
-
request.perform
|
15
|
+
Web::SendRequest.new(request).perform
|
17
16
|
end
|
18
17
|
|
19
18
|
def add_approval(query = {}, project_id = config.project_id)
|
20
19
|
project_id || raise_project_id_is_required_error
|
21
20
|
|
22
21
|
request = Web::Request.new(
|
23
|
-
|
22
|
+
connection,
|
24
23
|
:post,
|
25
|
-
"/projects/#{project_id}/approvals",
|
26
|
-
query
|
24
|
+
"#{config.target_api_url}/projects/#{project_id}/approvals",
|
25
|
+
{ params: query }
|
27
26
|
)
|
28
|
-
|
29
|
-
request.perform
|
27
|
+
Web::SendRequest.new(request).perform
|
30
28
|
end
|
31
29
|
|
32
30
|
def get_approval(approval_id = nil, project_id = config.project_id)
|
@@ -34,12 +32,11 @@ module Crowdin
|
|
34
32
|
project_id || raise_project_id_is_required_error
|
35
33
|
|
36
34
|
request = Web::Request.new(
|
37
|
-
|
35
|
+
connection,
|
38
36
|
:get,
|
39
|
-
"/projects/#{project_id}/approvals/#{approval_id}"
|
37
|
+
"#{config.target_api_url}/projects/#{project_id}/approvals/#{approval_id}"
|
40
38
|
)
|
41
|
-
|
42
|
-
request.perform
|
39
|
+
Web::SendRequest.new(request).perform
|
43
40
|
end
|
44
41
|
|
45
42
|
def remove_approval(approval_id = nil, project_id = config.project_id)
|
@@ -47,12 +44,11 @@ module Crowdin
|
|
47
44
|
project_id || raise_project_id_is_required_error
|
48
45
|
|
49
46
|
request = Web::Request.new(
|
50
|
-
|
47
|
+
connection,
|
51
48
|
:delete,
|
52
|
-
"/projects/#{project_id}/approvals/#{approval_id}"
|
49
|
+
"#{config.target_api_url}/projects/#{project_id}/approvals/#{approval_id}"
|
53
50
|
)
|
54
|
-
|
55
|
-
request.perform
|
51
|
+
Web::SendRequest.new(request).perform
|
56
52
|
end
|
57
53
|
|
58
54
|
def list_language_translations(language_id = nil, query = {}, project_id = config.project_id)
|
@@ -60,54 +56,40 @@ module Crowdin
|
|
60
56
|
project_id || raise_project_id_is_required_error
|
61
57
|
|
62
58
|
request = Web::Request.new(
|
63
|
-
|
59
|
+
connection,
|
64
60
|
:get,
|
65
|
-
"/projects/#{project_id}/languages/#{language_id}/translations",
|
66
|
-
query
|
61
|
+
"#{config.target_api_url}/projects/#{project_id}/languages/#{language_id}/translations",
|
62
|
+
{ params: query }
|
67
63
|
)
|
68
|
-
|
69
|
-
request.perform
|
64
|
+
Web::SendRequest.new(request).perform
|
70
65
|
end
|
71
66
|
|
72
67
|
def list_string_translations(query = {}, project_id = config.project_id)
|
73
68
|
project_id || raise_project_id_is_required_error
|
74
69
|
|
75
70
|
request = Web::Request.new(
|
76
|
-
|
71
|
+
connection,
|
77
72
|
:get,
|
78
|
-
"/projects/#{project_id}/translations",
|
79
|
-
query
|
73
|
+
"#{config.target_api_url}/projects/#{project_id}/translations",
|
74
|
+
{ params: query }
|
80
75
|
)
|
81
|
-
|
82
|
-
request.perform
|
76
|
+
Web::SendRequest.new(request).perform
|
83
77
|
end
|
84
78
|
|
85
79
|
def add_translation(query = {}, project_id = config.project_id)
|
86
80
|
project_id || raise_project_id_is_required_error
|
87
81
|
|
88
82
|
request = Web::Request.new(
|
89
|
-
|
83
|
+
connection,
|
90
84
|
:post,
|
91
|
-
"/projects/#{project_id}/translations",
|
92
|
-
query
|
85
|
+
"#{config.target_api_url}/projects/#{project_id}/translations",
|
86
|
+
{ params: query }
|
93
87
|
)
|
94
|
-
|
95
|
-
request.perform
|
88
|
+
Web::SendRequest.new(request).perform
|
96
89
|
end
|
97
90
|
|
98
|
-
# For now Rest Client Resource aren't support payload for DELETE requests.
|
99
|
-
# So we have workaround through Rest Client Execute for this case
|
100
91
|
def delete_string_translations(query = {}, project_id = config.project_id)
|
101
|
-
|
102
|
-
#
|
103
|
-
# request = Web::Request.new(
|
104
|
-
# self,
|
105
|
-
# :delete,
|
106
|
-
# "/projects/#{project_id}/translations",
|
107
|
-
# query
|
108
|
-
# )
|
109
|
-
#
|
110
|
-
# request.perform
|
92
|
+
project_id || raise_project_id_is_required_error
|
111
93
|
|
112
94
|
response = ::RestClient::Request.execute(
|
113
95
|
{
|
@@ -117,77 +99,70 @@ module Crowdin
|
|
117
99
|
}.merge(@options)
|
118
100
|
)
|
119
101
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
{}
|
124
|
-
end
|
102
|
+
response.body.empty? ? response.code : JSON.parse(response.body)
|
103
|
+
rescue StandardError => e
|
104
|
+
e.message
|
125
105
|
end
|
126
106
|
|
127
|
-
def get_translation(
|
128
|
-
|
129
|
-
project_id
|
107
|
+
def get_translation(translation_id = nil, query = {}, project_id = config.project_id)
|
108
|
+
translation_id || raise_parameter_is_required_error(:translation_id)
|
109
|
+
project_id || raise_project_id_is_required_error
|
130
110
|
|
131
111
|
request = Web::Request.new(
|
132
|
-
|
112
|
+
connection,
|
133
113
|
:get,
|
134
|
-
"/projects/#{project_id}/translations/#{
|
135
|
-
query
|
114
|
+
"#{config.target_api_url}/projects/#{project_id}/translations/#{translation_id}",
|
115
|
+
{ params: query }
|
136
116
|
)
|
137
|
-
|
138
|
-
request.perform
|
117
|
+
Web::SendRequest.new(request).perform
|
139
118
|
end
|
140
119
|
|
141
|
-
def restore_translation(
|
142
|
-
|
143
|
-
project_id
|
120
|
+
def restore_translation(translation_id = nil, project_id = config.project_id)
|
121
|
+
translation_id || raise_parameter_is_required_error(:translation_id)
|
122
|
+
project_id || raise_project_id_is_required_error
|
144
123
|
|
145
124
|
request = Web::Request.new(
|
146
|
-
|
125
|
+
connection,
|
147
126
|
:put,
|
148
|
-
"/projects/#{project_id}/translations/#{
|
127
|
+
"#{config.target_api_url}/projects/#{project_id}/translations/#{translation_id}"
|
149
128
|
)
|
150
|
-
|
151
|
-
request.perform
|
129
|
+
Web::SendRequest.new(request).perform
|
152
130
|
end
|
153
131
|
|
154
|
-
def delete_translation(
|
155
|
-
|
156
|
-
project_id
|
132
|
+
def delete_translation(translation_id = nil, project_id = config.project_id)
|
133
|
+
translation_id || raise_parameter_is_required_error(:translation_id)
|
134
|
+
project_id || raise_project_id_is_required_error
|
157
135
|
|
158
136
|
request = Web::Request.new(
|
159
|
-
|
137
|
+
connection,
|
160
138
|
:delete,
|
161
|
-
"/projects/#{project_id}/translations/#{
|
139
|
+
"#{config.target_api_url}/projects/#{project_id}/translations/#{translation_id}"
|
162
140
|
)
|
163
|
-
|
164
|
-
request.perform
|
141
|
+
Web::SendRequest.new(request).perform
|
165
142
|
end
|
166
143
|
|
167
144
|
def list_translation_votes(query = {}, project_id = config.project_id)
|
168
145
|
project_id || raise_project_id_is_required_error
|
169
146
|
|
170
147
|
request = Web::Request.new(
|
171
|
-
|
148
|
+
connection,
|
172
149
|
:get,
|
173
|
-
"/projects/#{project_id}/votes",
|
174
|
-
query
|
150
|
+
"#{config.target_api_url}/projects/#{project_id}/votes",
|
151
|
+
{ params: query }
|
175
152
|
)
|
176
|
-
|
177
|
-
request.perform
|
153
|
+
Web::SendRequest.new(request).perform
|
178
154
|
end
|
179
155
|
|
180
156
|
def add_vote(query = {}, project_id = config.project_id)
|
181
157
|
project_id || raise_project_id_is_required_error
|
182
158
|
|
183
159
|
request = Web::Request.new(
|
184
|
-
|
160
|
+
connection,
|
185
161
|
:post,
|
186
|
-
"/projects/#{project_id}/votes",
|
187
|
-
query
|
162
|
+
"#{config.target_api_url}/projects/#{project_id}/votes",
|
163
|
+
{ params: query }
|
188
164
|
)
|
189
|
-
|
190
|
-
request.perform
|
165
|
+
Web::SendRequest.new(request).perform
|
191
166
|
end
|
192
167
|
|
193
168
|
def get_vote(vote_id = nil, project_id = config.project_id)
|
@@ -195,12 +170,11 @@ module Crowdin
|
|
195
170
|
project_id || raise_project_id_is_required_error
|
196
171
|
|
197
172
|
request = Web::Request.new(
|
198
|
-
|
173
|
+
connection,
|
199
174
|
:get,
|
200
|
-
"/projects/#{project_id}/votes/#{vote_id}"
|
175
|
+
"#{config.target_api_url}/projects/#{project_id}/votes/#{vote_id}"
|
201
176
|
)
|
202
|
-
|
203
|
-
request.perform
|
177
|
+
Web::SendRequest.new(request).perform
|
204
178
|
end
|
205
179
|
|
206
180
|
def edit_screenshot(vote_id = nil, project_id = config.project_id)
|
@@ -208,12 +182,11 @@ module Crowdin
|
|
208
182
|
project_id || raise_project_id_is_required_error
|
209
183
|
|
210
184
|
request = Web::Request.new(
|
211
|
-
|
185
|
+
connection,
|
212
186
|
:delete,
|
213
|
-
"/projects/#{project_id}/votes/#{vote_id}"
|
187
|
+
"#{config.target_api_url}/projects/#{project_id}/votes/#{vote_id}"
|
214
188
|
)
|
215
|
-
|
216
|
-
request.perform
|
189
|
+
Web::SendRequest.new(request).perform
|
217
190
|
end
|
218
191
|
end
|
219
192
|
end
|
@@ -7,26 +7,24 @@ module Crowdin
|
|
7
7
|
project_id || raise_project_id_is_required_error
|
8
8
|
|
9
9
|
request = Web::Request.new(
|
10
|
-
|
10
|
+
connection,
|
11
11
|
:get,
|
12
|
-
"/projects/#{project_id}/tasks",
|
13
|
-
query
|
12
|
+
"#{config.target_api_url}/projects/#{project_id}/tasks",
|
13
|
+
{ params: query }
|
14
14
|
)
|
15
|
-
|
16
|
-
request.perform
|
15
|
+
Web::SendRequest.new(request).perform
|
17
16
|
end
|
18
17
|
|
19
18
|
def add_task(query = {}, project_id = config.project_id)
|
20
19
|
project_id || raise_project_id_is_required_error
|
21
20
|
|
22
21
|
request = Web::Request.new(
|
23
|
-
|
22
|
+
connection,
|
24
23
|
:post,
|
25
|
-
"/projects/#{project_id}/tasks",
|
26
|
-
query
|
24
|
+
"#{config.target_api_url}/projects/#{project_id}/tasks",
|
25
|
+
{ params: query }
|
27
26
|
)
|
28
|
-
|
29
|
-
request.perform
|
27
|
+
Web::SendRequest.new(request).perform
|
30
28
|
end
|
31
29
|
|
32
30
|
def export_task_strings(task_id = nil, destination = nil, project_id = config.project_id)
|
@@ -34,15 +32,11 @@ module Crowdin
|
|
34
32
|
project_id || raise_project_id_is_required_error
|
35
33
|
|
36
34
|
request = Web::Request.new(
|
37
|
-
|
35
|
+
connection,
|
38
36
|
:post,
|
39
|
-
"/projects/#{project_id}/tasks/#{task_id}/exports"
|
40
|
-
{},
|
41
|
-
{},
|
42
|
-
destination
|
37
|
+
"#{config.target_api_url}/projects/#{project_id}/tasks/#{task_id}/exports"
|
43
38
|
)
|
44
|
-
|
45
|
-
request.perform
|
39
|
+
Web::SendRequest.new(request, destination).perform
|
46
40
|
end
|
47
41
|
|
48
42
|
def get_task(task_id = nil, project_id = config.project_id)
|
@@ -50,12 +44,11 @@ module Crowdin
|
|
50
44
|
project_id || raise_project_id_is_required_error
|
51
45
|
|
52
46
|
request = Web::Request.new(
|
53
|
-
|
47
|
+
connection,
|
54
48
|
:get,
|
55
|
-
"/projects/#{project_id}/tasks/#{task_id}"
|
49
|
+
"#{config.target_api_url}/projects/#{project_id}/tasks/#{task_id}"
|
56
50
|
)
|
57
|
-
|
58
|
-
request.perform
|
51
|
+
Web::SendRequest.new(request).perform
|
59
52
|
end
|
60
53
|
|
61
54
|
def delete_task(task_id = nil, project_id = config.project_id)
|
@@ -63,12 +56,11 @@ module Crowdin
|
|
63
56
|
project_id || raise_project_id_is_required_error
|
64
57
|
|
65
58
|
request = Web::Request.new(
|
66
|
-
|
59
|
+
connection,
|
67
60
|
:delete,
|
68
|
-
"/projects/#{project_id}/tasks/#{task_id}"
|
61
|
+
"#{config.target_api_url}/projects/#{project_id}/tasks/#{task_id}"
|
69
62
|
)
|
70
|
-
|
71
|
-
request.perform
|
63
|
+
Web::SendRequest.new(request).perform
|
72
64
|
end
|
73
65
|
|
74
66
|
def edit_task(task_id = nil, query = {}, project_id = config.project_id)
|
@@ -76,37 +68,34 @@ module Crowdin
|
|
76
68
|
project_id || raise_project_id_is_required_error
|
77
69
|
|
78
70
|
request = Web::Request.new(
|
79
|
-
|
71
|
+
connection,
|
80
72
|
:patch,
|
81
|
-
"/projects/#{project_id}/tasks/#{task_id}",
|
82
|
-
query
|
73
|
+
"#{config.target_api_url}/projects/#{project_id}/tasks/#{task_id}",
|
74
|
+
{ params: query }
|
83
75
|
)
|
84
|
-
|
85
|
-
request.perform
|
76
|
+
Web::SendRequest.new(request).perform
|
86
77
|
end
|
87
78
|
|
88
79
|
def list_user_tasks(query = {})
|
89
80
|
request = Web::Request.new(
|
90
|
-
|
81
|
+
connection,
|
91
82
|
:get,
|
92
|
-
|
93
|
-
query
|
83
|
+
"#{config.target_api_url}/user/tasks",
|
84
|
+
{ params: query }
|
94
85
|
)
|
95
|
-
|
96
|
-
request.perform
|
86
|
+
Web::SendRequest.new(request).perform
|
97
87
|
end
|
98
88
|
|
99
89
|
def edit_task_archived_status(task_id = nil, query = {})
|
100
90
|
task_id || raise_parameter_is_required_error(:task_id)
|
101
91
|
|
102
92
|
request = Web::Request.new(
|
103
|
-
|
104
|
-
:
|
105
|
-
"/user/tasks/#{task_id}",
|
106
|
-
query
|
93
|
+
connection,
|
94
|
+
:patch,
|
95
|
+
"#{config.target_api_url}/user/tasks/#{task_id}",
|
96
|
+
{ params: query }
|
107
97
|
)
|
108
|
-
|
109
|
-
request.perform
|
98
|
+
Web::SendRequest.new(request).perform
|
110
99
|
end
|
111
100
|
end
|
112
101
|
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Teams
|
6
|
+
# -- For Enterprise mode only --
|
7
|
+
|
8
|
+
def add_team_to_project(query = {}, project_id = config.project_id)
|
9
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
10
|
+
project_id || raise_project_id_is_required_error
|
11
|
+
|
12
|
+
request = Web::Request.new(
|
13
|
+
connection,
|
14
|
+
:post,
|
15
|
+
"#{config.target_api_url}/projects/#{project_id}/teams",
|
16
|
+
{ params: query }
|
17
|
+
)
|
18
|
+
Web::SendRequest.new(request).perform
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_teams(query = {})
|
22
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
23
|
+
|
24
|
+
request = Web::Request.new(
|
25
|
+
connection,
|
26
|
+
:get,
|
27
|
+
"#{config.target_api_url}/teams",
|
28
|
+
{ params: query }
|
29
|
+
)
|
30
|
+
Web::SendRequest.new(request).perform
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_team(query = {})
|
34
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
35
|
+
|
36
|
+
request = Web::Request.new(
|
37
|
+
connection,
|
38
|
+
:post,
|
39
|
+
"#{config.target_api_url}/teams",
|
40
|
+
{ params: query }
|
41
|
+
)
|
42
|
+
Web::SendRequest.new(request).perform
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_team(team_id = nil, query = {})
|
46
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
47
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
48
|
+
|
49
|
+
request = Web::Request.new(
|
50
|
+
connection,
|
51
|
+
:get,
|
52
|
+
"#{config.target_api_url}/teams/#{team_id}",
|
53
|
+
{ params: query }
|
54
|
+
)
|
55
|
+
Web::SendRequest.new(request).perform
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete_team(team_id = nil)
|
59
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
60
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
61
|
+
|
62
|
+
request = Web::Request.new(
|
63
|
+
connection,
|
64
|
+
:delete,
|
65
|
+
"#{config.target_api_url}/teams/#{team_id}"
|
66
|
+
)
|
67
|
+
Web::SendRequest.new(request).perform
|
68
|
+
end
|
69
|
+
|
70
|
+
def edit_team(team_id = nil, query = {})
|
71
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
72
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
73
|
+
|
74
|
+
request = Web::Request.new(
|
75
|
+
connection,
|
76
|
+
:patch,
|
77
|
+
"#{config.target_api_url}/teams/#{team_id}",
|
78
|
+
{ params: query }
|
79
|
+
)
|
80
|
+
Web::SendRequest.new(request).perform
|
81
|
+
end
|
82
|
+
|
83
|
+
def team_members_list(team_id = nil, query = {})
|
84
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
85
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
86
|
+
|
87
|
+
request = Web::Request.new(
|
88
|
+
connection,
|
89
|
+
:get,
|
90
|
+
"#{config.target_api_url}/teams/#{team_id}/members",
|
91
|
+
{ params: query }
|
92
|
+
)
|
93
|
+
Web::SendRequest.new(request).perform
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_team_members(team_id = nil, query = {})
|
97
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
98
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
99
|
+
|
100
|
+
request = Web::Request.new(
|
101
|
+
connection,
|
102
|
+
:post,
|
103
|
+
"#{config.target_api_url}/teams/#{team_id}/members",
|
104
|
+
{ params: query }
|
105
|
+
)
|
106
|
+
Web::SendRequest.new(request).perform
|
107
|
+
end
|
108
|
+
|
109
|
+
def delete_all_team_members(team_id = nil)
|
110
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
111
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
112
|
+
|
113
|
+
request = Web::Request.new(
|
114
|
+
connection,
|
115
|
+
:delete,
|
116
|
+
"#{config.target_api_url}/teams/#{team_id}/members"
|
117
|
+
)
|
118
|
+
Web::SendRequest.new(request).perform
|
119
|
+
end
|
120
|
+
|
121
|
+
def delete_team_member(team_id = nil, member_id = nil)
|
122
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
123
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
124
|
+
member_id || raise_parameter_is_required_error(:member_id)
|
125
|
+
|
126
|
+
request = Web::Request.new(
|
127
|
+
connection,
|
128
|
+
:delete,
|
129
|
+
"#{config.target_api_url}/teams/#{team_id}/members/#{member_id}"
|
130
|
+
)
|
131
|
+
Web::SendRequest.new(request).perform
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|