crowdin-api 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -3
- data/.rubocop_todo.yml +34 -13
- data/README.md +29 -22
- data/bin/crowdin-console +10 -7
- data/crowdin-api.gemspec +7 -4
- data/lib/crowdin-api/api-resources/languages.rb +3 -3
- data/lib/crowdin-api/api-resources/projects.rb +14 -7
- data/lib/crowdin-api/api-resources/source_files.rb +44 -54
- data/lib/crowdin-api/api-resources/source_strings.rb +74 -0
- data/lib/crowdin-api/api-resources/storages.rb +5 -5
- data/lib/crowdin-api/api-resources/translation_status.rb +14 -22
- data/lib/crowdin-api/api-resources/translations.rb +24 -30
- data/lib/crowdin-api/api-resources/workflows.rb +59 -0
- data/lib/crowdin-api/client/client.rb +32 -32
- data/lib/crowdin-api/client/configuration.rb +8 -5
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/api_errors_raiser.rb +29 -0
- data/lib/crowdin-api/core/errors.rb +1 -14
- data/lib/crowdin-api/core/request.rb +35 -11
- data/lib/crowdin-api.rb +4 -3
- data/spec/core/config-instance_spec.rb +50 -13
- data/spec/spec_helper.rb +6 -0
- metadata +25 -8
- data/lib/crowdin-api/core/payload.rb +0 -26
@@ -4,7 +4,7 @@ module Crowdin
|
|
4
4
|
module ApiResources
|
5
5
|
module SourceFiles
|
6
6
|
def list_branches(query = {}, project_id = config.project_id)
|
7
|
-
project_id ||
|
7
|
+
project_id || raise_project_id_is_required_error
|
8
8
|
|
9
9
|
request = Web::Request.new(
|
10
10
|
self,
|
@@ -17,7 +17,7 @@ module Crowdin
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def add_branch(query = {}, project_id = config.project_id)
|
20
|
-
project_id ||
|
20
|
+
project_id || raise_project_id_is_required_error
|
21
21
|
|
22
22
|
request = Web::Request.new(
|
23
23
|
self,
|
@@ -30,8 +30,8 @@ module Crowdin
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def get_branch(branch_id = nil, project_id = config.project_id)
|
33
|
-
branch_id ||
|
34
|
-
project_id ||
|
33
|
+
branch_id || raise_parameter_is_required_error(:branch_id)
|
34
|
+
project_id || raise_project_id_is_required_error
|
35
35
|
|
36
36
|
request = Web::Request.new(
|
37
37
|
self,
|
@@ -43,8 +43,8 @@ module Crowdin
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def delete_branch(branch_id = nil, project_id = config.project_id)
|
46
|
-
branch_id ||
|
47
|
-
project_id ||
|
46
|
+
branch_id || raise_parameter_is_required_error(:branch_id)
|
47
|
+
project_id || raise_project_id_is_required_error
|
48
48
|
|
49
49
|
request = Web::Request.new(
|
50
50
|
self,
|
@@ -55,11 +55,9 @@ module Crowdin
|
|
55
55
|
request.perform
|
56
56
|
end
|
57
57
|
|
58
|
-
def edit_branch(branch_id = nil, query = {})
|
59
|
-
|
60
|
-
|
61
|
-
branch_id || raise(ArgumentError, ':branch_id is required')
|
62
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
58
|
+
def edit_branch(branch_id = nil, query = {}, project_id = config.project_id)
|
59
|
+
branch_id || raise_parameter_is_required_error(:branch_id)
|
60
|
+
project_id || raise_project_id_is_required_error
|
63
61
|
|
64
62
|
request = Web::Request.new(
|
65
63
|
self,
|
@@ -72,7 +70,7 @@ module Crowdin
|
|
72
70
|
end
|
73
71
|
|
74
72
|
def list_directories(query = {}, project_id = config.project_id)
|
75
|
-
project_id ||
|
73
|
+
project_id || raise_project_id_is_required_error
|
76
74
|
|
77
75
|
request = Web::Request.new(
|
78
76
|
self,
|
@@ -85,7 +83,7 @@ module Crowdin
|
|
85
83
|
end
|
86
84
|
|
87
85
|
def add_directory(query = {}, project_id = config.project_id)
|
88
|
-
project_id ||
|
86
|
+
project_id || raise_project_id_is_required_error
|
89
87
|
|
90
88
|
request = Web::Request.new(
|
91
89
|
self,
|
@@ -98,8 +96,8 @@ module Crowdin
|
|
98
96
|
end
|
99
97
|
|
100
98
|
def get_directory(directory_id = nil, project_id = config.project_id)
|
101
|
-
directory_id ||
|
102
|
-
project_id ||
|
99
|
+
directory_id || raise_parameter_is_required_error(:directory_id)
|
100
|
+
project_id || raise_project_id_is_required_error
|
103
101
|
|
104
102
|
request = Web::Request.new(
|
105
103
|
self,
|
@@ -111,8 +109,8 @@ module Crowdin
|
|
111
109
|
end
|
112
110
|
|
113
111
|
def delete_directory(directory_id = nil, project_id = config.project_id)
|
114
|
-
directory_id ||
|
115
|
-
project_id ||
|
112
|
+
directory_id || raise_parameter_is_required_error(:directory_id)
|
113
|
+
project_id || raise_project_id_is_required_error
|
116
114
|
|
117
115
|
request = Web::Request.new(
|
118
116
|
self,
|
@@ -123,11 +121,9 @@ module Crowdin
|
|
123
121
|
request.perform
|
124
122
|
end
|
125
123
|
|
126
|
-
def edit_directory(directory_id = nil, query = {})
|
127
|
-
|
128
|
-
|
129
|
-
directory_id || raise(ArgumentError, ':directory_id is required')
|
130
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
124
|
+
def edit_directory(directory_id = nil, query = {}, project_id = config.project_id)
|
125
|
+
directory_id || raise_parameter_is_required_error(:directory_id)
|
126
|
+
project_id || raise_project_id_is_required_error
|
131
127
|
|
132
128
|
request = Web::Request.new(
|
133
129
|
self,
|
@@ -140,7 +136,7 @@ module Crowdin
|
|
140
136
|
end
|
141
137
|
|
142
138
|
def list_files(query = {}, project_id = config.project_id)
|
143
|
-
project_id ||
|
139
|
+
project_id || raise_project_id_is_required_error
|
144
140
|
|
145
141
|
request = Web::Request.new(
|
146
142
|
self,
|
@@ -166,12 +162,12 @@ module Crowdin
|
|
166
162
|
#
|
167
163
|
# crowdin.add_file(storage_id: your_storage_id, name: 'your_filename')
|
168
164
|
#
|
169
|
-
# or you can
|
165
|
+
# or you can specify project_id
|
170
166
|
#
|
171
|
-
# crowdin.add_file({}, your_project_id)
|
167
|
+
# crowdin.add_file({ storage_id: your_storage_id, name: 'your_filename' }, your_project_id)
|
172
168
|
#
|
173
169
|
def add_file(query = {}, project_id = config.project_id)
|
174
|
-
project_id ||
|
170
|
+
project_id || raise_project_id_is_required_error
|
175
171
|
|
176
172
|
request = Web::Request.new(
|
177
173
|
self,
|
@@ -184,8 +180,8 @@ module Crowdin
|
|
184
180
|
end
|
185
181
|
|
186
182
|
def get_file(file_id = nil, project_id = config.project_id)
|
187
|
-
file_id ||
|
188
|
-
project_id ||
|
183
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
184
|
+
project_id || raise_project_id_is_required_error
|
189
185
|
|
190
186
|
request = Web::Request.new(
|
191
187
|
self,
|
@@ -196,11 +192,9 @@ module Crowdin
|
|
196
192
|
request.perform
|
197
193
|
end
|
198
194
|
|
199
|
-
def update_or_restore_file(file_id = nil, query = {})
|
200
|
-
|
201
|
-
|
202
|
-
file_id || raise(ArgumentError, ':file_id is required')
|
203
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
195
|
+
def update_or_restore_file(file_id = nil, query = {}, project_id = config.project_id)
|
196
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
197
|
+
project_id || raise_project_id_is_required_error
|
204
198
|
|
205
199
|
request = Web::Request.new(
|
206
200
|
self,
|
@@ -213,8 +207,8 @@ module Crowdin
|
|
213
207
|
end
|
214
208
|
|
215
209
|
def delete_file(file_id = nil, project_id = config.project_id)
|
216
|
-
file_id ||
|
217
|
-
project_id ||
|
210
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
211
|
+
project_id || raise_project_id_is_required_error
|
218
212
|
|
219
213
|
request = Web::Request.new(
|
220
214
|
self,
|
@@ -225,11 +219,9 @@ module Crowdin
|
|
225
219
|
request.perform
|
226
220
|
end
|
227
221
|
|
228
|
-
def edit_file(file_id = nil, query = {})
|
229
|
-
|
230
|
-
|
231
|
-
file_id || raise(ArgumentError, ':file_id is required')
|
232
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
222
|
+
def edit_file(file_id = nil, query = {}, project_id = config.project_id)
|
223
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
224
|
+
project_id || raise_project_id_is_required_error
|
233
225
|
|
234
226
|
request = Web::Request.new(
|
235
227
|
self,
|
@@ -242,9 +234,9 @@ module Crowdin
|
|
242
234
|
end
|
243
235
|
|
244
236
|
def download_file(destination = nil, file_id = nil, project_id = config.project_id)
|
245
|
-
destination ||
|
246
|
-
file_id ||
|
247
|
-
project_id ||
|
237
|
+
destination || raise_parameter_is_required_error(:destination)
|
238
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
239
|
+
project_id || raise_project_id_is_required_error
|
248
240
|
|
249
241
|
request = Web::Request.new(
|
250
242
|
self,
|
@@ -273,17 +265,15 @@ module Crowdin
|
|
273
265
|
#
|
274
266
|
# when you're initialized Crowdin Client with a project_id
|
275
267
|
#
|
276
|
-
# crowdin.list_file_revisions(your_file_id,
|
268
|
+
# crowdin.list_file_revisions(your_file_id, limit: your_value)
|
277
269
|
#
|
278
|
-
# or you can
|
270
|
+
# or you can specify project_id
|
279
271
|
#
|
280
|
-
# crowdin.list_file_revisions(your_file_id, {
|
272
|
+
# crowdin.list_file_revisions(your_file_id, { limit: your_value }, your_project_id)
|
281
273
|
#
|
282
|
-
def list_file_revisions(file_id = nil, query = {})
|
283
|
-
|
284
|
-
|
285
|
-
file_id || raise(ArgumentError, ':file_id is required')
|
286
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
274
|
+
def list_file_revisions(file_id = nil, query = {}, project_id = config.project_id)
|
275
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
276
|
+
project_id || raise_project_id_is_required_error
|
287
277
|
|
288
278
|
request = Web::Request.new(
|
289
279
|
self,
|
@@ -296,9 +286,9 @@ module Crowdin
|
|
296
286
|
end
|
297
287
|
|
298
288
|
def get_file_revision(file_id = nil, revision_id = nil, project_id = config.project_id)
|
299
|
-
file_id ||
|
300
|
-
revision_id ||
|
301
|
-
project_id ||
|
289
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
290
|
+
revision_id || raise_parameter_is_required_error(:revision_id)
|
291
|
+
project_id || raise_project_id_is_required_error
|
302
292
|
|
303
293
|
request = Web::Request.new(
|
304
294
|
self,
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module SourceStrings
|
6
|
+
def list_strings(query = {}, project_id = config.project_id)
|
7
|
+
project_id || raise_project_id_is_required_error
|
8
|
+
|
9
|
+
request = Web::Request.new(
|
10
|
+
self,
|
11
|
+
:get,
|
12
|
+
"/projects/#{project_id}/strings",
|
13
|
+
query
|
14
|
+
)
|
15
|
+
|
16
|
+
request.perform
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_string(query = {}, project_id = config.project_id)
|
20
|
+
project_id || raise_project_id_is_required_error
|
21
|
+
|
22
|
+
request = Web::Request.new(
|
23
|
+
self,
|
24
|
+
:post,
|
25
|
+
"/projects/#{project_id}/strings",
|
26
|
+
query
|
27
|
+
)
|
28
|
+
|
29
|
+
request.perform
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_string(string_id = nil, query = {}, project_id = config.project_id)
|
33
|
+
string_id || raise_parameter_is_required_error(:string_id)
|
34
|
+
project_id || raise_project_id_is_required_error
|
35
|
+
|
36
|
+
request = Web::Request.new(
|
37
|
+
self,
|
38
|
+
:get,
|
39
|
+
"/projects/#{project_id}/strings/#{string_id}",
|
40
|
+
query
|
41
|
+
)
|
42
|
+
|
43
|
+
request.perform
|
44
|
+
end
|
45
|
+
|
46
|
+
def delete_string(string_id = nil, project_id = config.project_id)
|
47
|
+
string_id || raise_parameter_is_required_error(:string_id)
|
48
|
+
project_id || raise_project_id_is_required_error
|
49
|
+
|
50
|
+
request = Web::Request.new(
|
51
|
+
self,
|
52
|
+
:delete,
|
53
|
+
"/projects/#{project_id}/strings/#{string_id}"
|
54
|
+
)
|
55
|
+
|
56
|
+
request.perform
|
57
|
+
end
|
58
|
+
|
59
|
+
def edit_string(string_id = nil, query = {}, project_id = config.project_id)
|
60
|
+
string_id || raise_parameter_is_required_error(:string_id)
|
61
|
+
project_id || raise_project_id_is_required_error
|
62
|
+
|
63
|
+
request = Web::Request.new(
|
64
|
+
self,
|
65
|
+
:patch,
|
66
|
+
"/projects/#{project_id}/strings/#{string_id}",
|
67
|
+
query
|
68
|
+
)
|
69
|
+
|
70
|
+
request.perform
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -34,14 +34,14 @@ module Crowdin
|
|
34
34
|
#
|
35
35
|
# === Example
|
36
36
|
#
|
37
|
-
# crowdin.add_storage(File.open('your_filename.extension'))
|
37
|
+
# crowdin.add_storage(File.open('your_filename.extension', 'r'))
|
38
38
|
# or
|
39
39
|
# crowdin.add_storage('your_filename.extension')
|
40
40
|
#
|
41
41
|
def add_storage(file = nil)
|
42
|
-
file ||
|
42
|
+
file || raise_parameter_is_required_error(:file)
|
43
43
|
|
44
|
-
file = file.is_a?(File) ? file : File.open(file)
|
44
|
+
file = file.is_a?(File) ? file : File.open(file, 'r')
|
45
45
|
|
46
46
|
request = Web::Request.new(
|
47
47
|
self,
|
@@ -65,7 +65,7 @@ module Crowdin
|
|
65
65
|
# crowdin.get_storage(your_storage_id)
|
66
66
|
#
|
67
67
|
def get_storage(storage_id = nil)
|
68
|
-
storage_id ||
|
68
|
+
storage_id || raise_parameter_is_required_error(:storage_id)
|
69
69
|
|
70
70
|
request = Web::Request.new(
|
71
71
|
self,
|
@@ -87,7 +87,7 @@ module Crowdin
|
|
87
87
|
# crowdin.delete_storage(your_storage_id)
|
88
88
|
#
|
89
89
|
def delete_storage(storage_id = nil)
|
90
|
-
storage_id ||
|
90
|
+
storage_id || raise_parameter_is_required_error(:storage_id)
|
91
91
|
|
92
92
|
request = Web::Request.new(
|
93
93
|
self,
|
@@ -3,11 +3,9 @@
|
|
3
3
|
module Crowdin
|
4
4
|
module ApiResources
|
5
5
|
module TranslationStatus
|
6
|
-
def get_branch_progress(branch_id = nil, query = {})
|
7
|
-
|
8
|
-
|
9
|
-
branch_id || raise(ArgumentError, ':file_id is required')
|
10
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
6
|
+
def get_branch_progress(branch_id = nil, query = {}, project_id = config.project_id)
|
7
|
+
branch_id || raise_parameter_is_required_error(:branch_id)
|
8
|
+
project_id || raise_project_id_is_required_error
|
11
9
|
|
12
10
|
request = Web::Request.new(
|
13
11
|
self,
|
@@ -19,11 +17,9 @@ module Crowdin
|
|
19
17
|
request.perform
|
20
18
|
end
|
21
19
|
|
22
|
-
def get_directory_progress(directory_id = nil, query = {})
|
23
|
-
|
24
|
-
|
25
|
-
directory_id || raise(ArgumentError, ':directory_id is required')
|
26
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
20
|
+
def get_directory_progress(directory_id = nil, query = {}, project_id = config.project_id)
|
21
|
+
directory_id || raise_parameter_is_required_error(:directory_id)
|
22
|
+
project_id || raise_project_id_is_required_error
|
27
23
|
|
28
24
|
request = Web::Request.new(
|
29
25
|
self,
|
@@ -35,11 +31,9 @@ module Crowdin
|
|
35
31
|
request.perform
|
36
32
|
end
|
37
33
|
|
38
|
-
def get_file_progress(file_id = nil, query = {})
|
39
|
-
|
40
|
-
|
41
|
-
file_id || raise(ArgumentError, ':file_id is required')
|
42
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
34
|
+
def get_file_progress(file_id = nil, query = {}, project_id = config.project_id)
|
35
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
36
|
+
project_id || raise_project_id_is_required_error
|
43
37
|
|
44
38
|
request = Web::Request.new(
|
45
39
|
self,
|
@@ -51,11 +45,9 @@ module Crowdin
|
|
51
45
|
request.perform
|
52
46
|
end
|
53
47
|
|
54
|
-
def get_language_progress(language_id = nil, query = {})
|
55
|
-
|
56
|
-
|
57
|
-
language_id || raise(ArgumentError, ':language_id is required')
|
58
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
48
|
+
def get_language_progress(language_id = nil, query = {}, project_id = config.project_id)
|
49
|
+
language_id || raise_parameter_is_required_error(:language_id)
|
50
|
+
project_id || raise_project_id_is_required_error
|
59
51
|
|
60
52
|
request = Web::Request.new(
|
61
53
|
self,
|
@@ -68,7 +60,7 @@ module Crowdin
|
|
68
60
|
end
|
69
61
|
|
70
62
|
def get_project_progress(query = {}, project_id = config.project_id)
|
71
|
-
project_id ||
|
63
|
+
project_id || raise_project_id_is_required_error
|
72
64
|
|
73
65
|
request = Web::Request.new(
|
74
66
|
self,
|
@@ -81,7 +73,7 @@ module Crowdin
|
|
81
73
|
end
|
82
74
|
|
83
75
|
def get_qa_progress(query = {}, project_id = config.project_id)
|
84
|
-
project_id ||
|
76
|
+
project_id || raise_project_id_is_required_error
|
85
77
|
|
86
78
|
request = Web::Request.new(
|
87
79
|
self,
|
@@ -4,8 +4,8 @@ module Crowdin
|
|
4
4
|
module ApiResources
|
5
5
|
module Translations
|
6
6
|
def pre_translation_status(pre_translation_id = nil, project_id = config.project_id)
|
7
|
-
pre_translation_id ||
|
8
|
-
project_id ||
|
7
|
+
pre_translation_id || raise_parameter_is_required_error(:pre_translation_id)
|
8
|
+
project_id || raise_project_id_is_required_error
|
9
9
|
|
10
10
|
request = Web::Request.new(
|
11
11
|
self,
|
@@ -17,7 +17,7 @@ module Crowdin
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def apply_pre_translation(query = {}, project_id = config.project_id)
|
20
|
-
project_id ||
|
20
|
+
project_id || raise_project_id_is_required_error
|
21
21
|
|
22
22
|
request = Web::Request.new(
|
23
23
|
self,
|
@@ -29,11 +29,9 @@ module Crowdin
|
|
29
29
|
request.perform
|
30
30
|
end
|
31
31
|
|
32
|
-
def build_project_directory_translation(directory_id = nil, query = {})
|
33
|
-
|
34
|
-
|
35
|
-
directory_id || raise(ArgumentError, ':directory_id is required')
|
36
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
32
|
+
def build_project_directory_translation(directory_id = nil, query = {}, project_id = config.project_id)
|
33
|
+
directory_id || raise_parameter_is_required_error(:directory_id)
|
34
|
+
project_id || raise_project_id_is_required_error
|
37
35
|
|
38
36
|
request = Web::Request.new(
|
39
37
|
self,
|
@@ -45,11 +43,9 @@ module Crowdin
|
|
45
43
|
request.perform
|
46
44
|
end
|
47
45
|
|
48
|
-
def build_project_file_translation(file_id = nil, query = {})
|
49
|
-
|
50
|
-
|
51
|
-
file_id || raise(ArgumentError, ':file_id is required')
|
52
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
46
|
+
def build_project_file_translation(file_id = nil, query = {}, project_id = config.project_id)
|
47
|
+
file_id || raise_parameter_is_required_error(:file_id)
|
48
|
+
project_id || raise_project_id_is_required_error
|
53
49
|
|
54
50
|
headers = query[:eTag] ? { 'If-None-Match' => query[:eTag] } : {}
|
55
51
|
|
@@ -65,7 +61,7 @@ module Crowdin
|
|
65
61
|
end
|
66
62
|
|
67
63
|
def list_project_builds(query = {}, project_id = config.project_id)
|
68
|
-
project_id ||
|
64
|
+
project_id || raise_project_id_is_required_error
|
69
65
|
|
70
66
|
request = Web::Request.new(
|
71
67
|
self,
|
@@ -78,7 +74,7 @@ module Crowdin
|
|
78
74
|
end
|
79
75
|
|
80
76
|
def build_project_translation(query = {}, project_id = config.project_id)
|
81
|
-
project_id ||
|
77
|
+
project_id || raise_project_id_is_required_error
|
82
78
|
|
83
79
|
request = Web::Request.new(
|
84
80
|
self,
|
@@ -90,11 +86,9 @@ module Crowdin
|
|
90
86
|
request.perform
|
91
87
|
end
|
92
88
|
|
93
|
-
def upload_translations(language_id = nil, query = {})
|
94
|
-
|
95
|
-
|
96
|
-
language_id || raise(ArgumentError, ':language_id is required')
|
97
|
-
project_id || raise(ArgumentError, ':project_id is required in parameters or when initialize Client')
|
89
|
+
def upload_translations(language_id = nil, query = {}, project_id = config.project_id)
|
90
|
+
language_id || raise_parameter_is_required_error(:language_id)
|
91
|
+
project_id || raise_project_id_is_required_error
|
98
92
|
|
99
93
|
request = Web::Request.new(
|
100
94
|
self,
|
@@ -106,10 +100,10 @@ module Crowdin
|
|
106
100
|
request.perform
|
107
101
|
end
|
108
102
|
|
109
|
-
def download_project_translations(
|
110
|
-
|
111
|
-
build_id
|
112
|
-
project_id
|
103
|
+
def download_project_translations(destination = nil, build_id = nil, project_id = config.project_id)
|
104
|
+
destination || raise_parameter_is_required_error(:destination)
|
105
|
+
build_id || raise_parameter_is_required_error(:build_id)
|
106
|
+
project_id || raise_project_id_is_required_error
|
113
107
|
|
114
108
|
request = Web::Request.new(
|
115
109
|
self,
|
@@ -117,15 +111,15 @@ module Crowdin
|
|
117
111
|
"/projects/#{project_id}/translations/builds/#{build_id}/download",
|
118
112
|
{},
|
119
113
|
{},
|
120
|
-
|
114
|
+
destination
|
121
115
|
)
|
122
116
|
|
123
117
|
request.perform
|
124
118
|
end
|
125
119
|
|
126
120
|
def check_project_build_status(build_id = nil, project_id = config.project_id)
|
127
|
-
build_id ||
|
128
|
-
project_id ||
|
121
|
+
build_id || raise_parameter_is_required_error(:build_id)
|
122
|
+
project_id || raise_project_id_is_required_error
|
129
123
|
|
130
124
|
request = Web::Request.new(
|
131
125
|
self,
|
@@ -137,8 +131,8 @@ module Crowdin
|
|
137
131
|
end
|
138
132
|
|
139
133
|
def cancel_build(build_id = nil, project_id = config.project_id)
|
140
|
-
build_id ||
|
141
|
-
project_id ||
|
134
|
+
build_id || raise_parameter_is_required_error(:build_id)
|
135
|
+
project_id || raise_project_id_is_required_error
|
142
136
|
|
143
137
|
request = Web::Request.new(
|
144
138
|
self,
|
@@ -150,7 +144,7 @@ module Crowdin
|
|
150
144
|
end
|
151
145
|
|
152
146
|
def export_project_translation(query = {}, project_id = config.project_id)
|
153
|
-
project_id ||
|
147
|
+
project_id || raise_project_id_is_required_error
|
154
148
|
|
155
149
|
request = Web::Request.new(
|
156
150
|
self,
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Workflows
|
6
|
+
def list_workflow_steps(query = {}, project_id = config.project_id)
|
7
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
8
|
+
project_id || raise_project_id_is_required_error
|
9
|
+
|
10
|
+
request = Web::Request.new(
|
11
|
+
self,
|
12
|
+
:get,
|
13
|
+
"/projects/#{project_id}/workflow-steps",
|
14
|
+
query
|
15
|
+
)
|
16
|
+
|
17
|
+
request.perform
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_workflow_step(step_id = nil, project_id = config.project_id)
|
21
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
22
|
+
step_id || raise_parameter_is_required_error(:step_id)
|
23
|
+
project_id || raise_project_id_is_required_error
|
24
|
+
|
25
|
+
request = Web::Request.new(
|
26
|
+
self,
|
27
|
+
:get,
|
28
|
+
"/projects/#{project_id}/workflow-steps/#{step_id}"
|
29
|
+
)
|
30
|
+
|
31
|
+
request.perform
|
32
|
+
end
|
33
|
+
|
34
|
+
def list_workflow_templates(query = {})
|
35
|
+
request = Web::Request.new(
|
36
|
+
self,
|
37
|
+
:get,
|
38
|
+
'/workflow-templates',
|
39
|
+
query
|
40
|
+
)
|
41
|
+
|
42
|
+
request.perform
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_workflow_template(template_id = nil)
|
46
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
47
|
+
template_id || raise_parameter_is_required_error(:template_id)
|
48
|
+
|
49
|
+
request = Web::Request.new(
|
50
|
+
self,
|
51
|
+
:get,
|
52
|
+
"/workflow-templates/#{template_id}"
|
53
|
+
)
|
54
|
+
|
55
|
+
request.perform
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|