crowdin-api 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-and-lint.yml +1 -1
- data/.gitignore +2 -2
- data/.rubocop_todo.yml +37 -30
- data/README.md +23 -12
- data/bin/crowdin-console +4 -4
- data/lib/crowdin-api/api-resources/dictionaries.rb +34 -0
- data/lib/crowdin-api/api-resources/distributions.rb +99 -0
- data/lib/crowdin-api/api-resources/glossaries.rb +217 -0
- data/lib/crowdin-api/api-resources/labels.rb +117 -0
- data/lib/crowdin-api/api-resources/languages.rb +1 -0
- data/lib/crowdin-api/api-resources/machine_translation_engines.rb +74 -0
- data/lib/crowdin-api/api-resources/projects.rb +15 -1
- data/lib/crowdin-api/api-resources/reports.rb +138 -0
- data/lib/crowdin-api/api-resources/screenshots.rb +186 -0
- data/lib/crowdin-api/api-resources/source_files.rb +3 -2
- data/lib/crowdin-api/api-resources/storages.rb +5 -1
- data/lib/crowdin-api/api-resources/string_comments.rb +73 -0
- data/lib/crowdin-api/api-resources/string_translations.rb +220 -0
- data/lib/crowdin-api/api-resources/tasks.rb +113 -0
- data/lib/crowdin-api/api-resources/teams.rb +144 -0
- data/lib/crowdin-api/api-resources/translation_memory.rb +145 -0
- data/lib/crowdin-api/api-resources/translations.rb +8 -6
- data/lib/crowdin-api/api-resources/users.rb +129 -0
- data/lib/crowdin-api/api-resources/vendors.rb +21 -0
- data/lib/crowdin-api/api-resources/webhooks.rb +73 -0
- data/lib/crowdin-api/api-resources/workflows.rb +3 -0
- data/lib/crowdin-api/client/client.rb +41 -28
- data/lib/crowdin-api/client/configuration.rb +10 -6
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/errors.rb +2 -1
- data/lib/crowdin-api/core/{api_errors_raiser.rb → errors_raisers.rb} +21 -11
- data/lib/crowdin-api/core/request.rb +8 -5
- data/lib/crowdin-api/core/utils.rb +10 -0
- data/lib/crowdin-api.rb +22 -6
- data/spec/client/client-instance_spec.rb +14 -0
- data/spec/{core/config-instance_spec.rb → client/configuration-instance_spec.rb} +7 -7
- metadata +21 -5
- data/spec/crowdin-api_spec.rb +0 -7
@@ -0,0 +1,220 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module StringTranslations
|
6
|
+
def list_translation_approvals(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}/approvals",
|
13
|
+
query
|
14
|
+
)
|
15
|
+
|
16
|
+
request.perform
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_approval(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}/approvals",
|
26
|
+
query
|
27
|
+
)
|
28
|
+
|
29
|
+
request.perform
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_approval(approval_id = nil, project_id = config.project_id)
|
33
|
+
approval_id || raise_parameter_is_required_error(:approval_id)
|
34
|
+
project_id || raise_project_id_is_required_error
|
35
|
+
|
36
|
+
request = Web::Request.new(
|
37
|
+
self,
|
38
|
+
:get,
|
39
|
+
"/projects/#{project_id}/approvals/#{approval_id}"
|
40
|
+
)
|
41
|
+
|
42
|
+
request.perform
|
43
|
+
end
|
44
|
+
|
45
|
+
def remove_approval(approval_id = nil, project_id = config.project_id)
|
46
|
+
approval_id || raise_parameter_is_required_error(:approval_id)
|
47
|
+
project_id || raise_project_id_is_required_error
|
48
|
+
|
49
|
+
request = Web::Request.new(
|
50
|
+
self,
|
51
|
+
:delete,
|
52
|
+
"/projects/#{project_id}/approvals/#{approval_id}"
|
53
|
+
)
|
54
|
+
|
55
|
+
request.perform
|
56
|
+
end
|
57
|
+
|
58
|
+
def list_language_translations(language_id = nil, query = {}, project_id = config.project_id)
|
59
|
+
language_id || raise_parameter_is_required_error(:language_id)
|
60
|
+
project_id || raise_project_id_is_required_error
|
61
|
+
|
62
|
+
request = Web::Request.new(
|
63
|
+
self,
|
64
|
+
:get,
|
65
|
+
"/projects/#{project_id}/languages/#{language_id}/translations",
|
66
|
+
query
|
67
|
+
)
|
68
|
+
|
69
|
+
request.perform
|
70
|
+
end
|
71
|
+
|
72
|
+
def list_string_translations(query = {}, project_id = config.project_id)
|
73
|
+
project_id || raise_project_id_is_required_error
|
74
|
+
|
75
|
+
request = Web::Request.new(
|
76
|
+
self,
|
77
|
+
:get,
|
78
|
+
"/projects/#{project_id}/translations",
|
79
|
+
query
|
80
|
+
)
|
81
|
+
|
82
|
+
request.perform
|
83
|
+
end
|
84
|
+
|
85
|
+
def add_translation(query = {}, project_id = config.project_id)
|
86
|
+
project_id || raise_project_id_is_required_error
|
87
|
+
|
88
|
+
request = Web::Request.new(
|
89
|
+
self,
|
90
|
+
:post,
|
91
|
+
"/projects/#{project_id}/translations",
|
92
|
+
query
|
93
|
+
)
|
94
|
+
|
95
|
+
request.perform
|
96
|
+
end
|
97
|
+
|
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
|
+
def delete_string_translations(query = {}, project_id = config.project_id)
|
101
|
+
# project_id || raise_project_id_is_required_error
|
102
|
+
#
|
103
|
+
# request = Web::Request.new(
|
104
|
+
# self,
|
105
|
+
# :delete,
|
106
|
+
# "/projects/#{project_id}/translations",
|
107
|
+
# query
|
108
|
+
# )
|
109
|
+
#
|
110
|
+
# request.perform
|
111
|
+
|
112
|
+
response = ::RestClient::Request.execute(
|
113
|
+
{
|
114
|
+
method: :delete,
|
115
|
+
url: config.base_url + config.target_api_url + "/projects/#{project_id}/translations",
|
116
|
+
payload: query.to_json
|
117
|
+
}.merge(@options)
|
118
|
+
)
|
119
|
+
|
120
|
+
begin
|
121
|
+
JSON.parse(response)
|
122
|
+
rescue
|
123
|
+
{}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def get_translation(trnslation_id = nil, query = {}, project_id = config.project_id)
|
128
|
+
trnslation_id || raise_parameter_is_required_error(:trnslation_id)
|
129
|
+
project_id || raise_project_id_is_required_error
|
130
|
+
|
131
|
+
request = Web::Request.new(
|
132
|
+
self,
|
133
|
+
:get,
|
134
|
+
"/projects/#{project_id}/translations/#{trnslation_id}",
|
135
|
+
query
|
136
|
+
)
|
137
|
+
|
138
|
+
request.perform
|
139
|
+
end
|
140
|
+
|
141
|
+
def restore_translation(trnslation_id = nil, project_id = config.project_id)
|
142
|
+
trnslation_id || raise_parameter_is_required_error(:trnslation_id)
|
143
|
+
project_id || raise_project_id_is_required_error
|
144
|
+
|
145
|
+
request = Web::Request.new(
|
146
|
+
self,
|
147
|
+
:put,
|
148
|
+
"/projects/#{project_id}/translations/#{trnslation_id}"
|
149
|
+
)
|
150
|
+
|
151
|
+
request.perform
|
152
|
+
end
|
153
|
+
|
154
|
+
def delete_translation(trnslation_id = nil, project_id = config.project_id)
|
155
|
+
trnslation_id || raise_parameter_is_required_error(:trnslation_id)
|
156
|
+
project_id || raise_project_id_is_required_error
|
157
|
+
|
158
|
+
request = Web::Request.new(
|
159
|
+
self,
|
160
|
+
:delete,
|
161
|
+
"/projects/#{project_id}/translations/#{trnslation_id}"
|
162
|
+
)
|
163
|
+
|
164
|
+
request.perform
|
165
|
+
end
|
166
|
+
|
167
|
+
def list_translation_votes(query = {}, project_id = config.project_id)
|
168
|
+
project_id || raise_project_id_is_required_error
|
169
|
+
|
170
|
+
request = Web::Request.new(
|
171
|
+
self,
|
172
|
+
:get,
|
173
|
+
"/projects/#{project_id}/votes",
|
174
|
+
query
|
175
|
+
)
|
176
|
+
|
177
|
+
request.perform
|
178
|
+
end
|
179
|
+
|
180
|
+
def add_vote(query = {}, project_id = config.project_id)
|
181
|
+
project_id || raise_project_id_is_required_error
|
182
|
+
|
183
|
+
request = Web::Request.new(
|
184
|
+
self,
|
185
|
+
:post,
|
186
|
+
"/projects/#{project_id}/votes",
|
187
|
+
query
|
188
|
+
)
|
189
|
+
|
190
|
+
request.perform
|
191
|
+
end
|
192
|
+
|
193
|
+
def get_vote(vote_id = nil, project_id = config.project_id)
|
194
|
+
vote_id || raise_parameter_is_required_error(:vote_id)
|
195
|
+
project_id || raise_project_id_is_required_error
|
196
|
+
|
197
|
+
request = Web::Request.new(
|
198
|
+
self,
|
199
|
+
:get,
|
200
|
+
"/projects/#{project_id}/votes/#{vote_id}"
|
201
|
+
)
|
202
|
+
|
203
|
+
request.perform
|
204
|
+
end
|
205
|
+
|
206
|
+
def edit_screenshot(vote_id = nil, project_id = config.project_id)
|
207
|
+
vote_id || raise_parameter_is_required_error(:vote_id)
|
208
|
+
project_id || raise_project_id_is_required_error
|
209
|
+
|
210
|
+
request = Web::Request.new(
|
211
|
+
self,
|
212
|
+
:delete,
|
213
|
+
"/projects/#{project_id}/votes/#{vote_id}"
|
214
|
+
)
|
215
|
+
|
216
|
+
request.perform
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Tasks
|
6
|
+
def list_tasks(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}/tasks",
|
13
|
+
query
|
14
|
+
)
|
15
|
+
|
16
|
+
request.perform
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_task(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}/tasks",
|
26
|
+
query
|
27
|
+
)
|
28
|
+
|
29
|
+
request.perform
|
30
|
+
end
|
31
|
+
|
32
|
+
def export_task_strings(task_id = nil, destination = nil, project_id = config.project_id)
|
33
|
+
task_id || raise_parameter_is_required_error(:task_id)
|
34
|
+
project_id || raise_project_id_is_required_error
|
35
|
+
|
36
|
+
request = Web::Request.new(
|
37
|
+
self,
|
38
|
+
:post,
|
39
|
+
"/projects/#{project_id}/tasks/#{task_id}/exports",
|
40
|
+
{},
|
41
|
+
{},
|
42
|
+
destination
|
43
|
+
)
|
44
|
+
|
45
|
+
request.perform
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_task(task_id = nil, project_id = config.project_id)
|
49
|
+
task_id || raise_parameter_is_required_error(:task_id)
|
50
|
+
project_id || raise_project_id_is_required_error
|
51
|
+
|
52
|
+
request = Web::Request.new(
|
53
|
+
self,
|
54
|
+
:get,
|
55
|
+
"/projects/#{project_id}/tasks/#{task_id}"
|
56
|
+
)
|
57
|
+
|
58
|
+
request.perform
|
59
|
+
end
|
60
|
+
|
61
|
+
def delete_task(task_id = nil, project_id = config.project_id)
|
62
|
+
task_id || raise_parameter_is_required_error(:task_id)
|
63
|
+
project_id || raise_project_id_is_required_error
|
64
|
+
|
65
|
+
request = Web::Request.new(
|
66
|
+
self,
|
67
|
+
:delete,
|
68
|
+
"/projects/#{project_id}/tasks/#{task_id}"
|
69
|
+
)
|
70
|
+
|
71
|
+
request.perform
|
72
|
+
end
|
73
|
+
|
74
|
+
def edit_task(task_id = nil, query = {}, project_id = config.project_id)
|
75
|
+
task_id || raise_parameter_is_required_error(:task_id)
|
76
|
+
project_id || raise_project_id_is_required_error
|
77
|
+
|
78
|
+
request = Web::Request.new(
|
79
|
+
self,
|
80
|
+
:patch,
|
81
|
+
"/projects/#{project_id}/tasks/#{task_id}",
|
82
|
+
query
|
83
|
+
)
|
84
|
+
|
85
|
+
request.perform
|
86
|
+
end
|
87
|
+
|
88
|
+
def list_user_tasks(query = {})
|
89
|
+
request = Web::Request.new(
|
90
|
+
self,
|
91
|
+
:get,
|
92
|
+
'/user/tasks',
|
93
|
+
query
|
94
|
+
)
|
95
|
+
|
96
|
+
request.perform
|
97
|
+
end
|
98
|
+
|
99
|
+
def edit_task_archived_status(task_id = nil, query = {})
|
100
|
+
task_id || raise_parameter_is_required_error(:task_id)
|
101
|
+
|
102
|
+
request = Web::Request.new(
|
103
|
+
self,
|
104
|
+
:get,
|
105
|
+
"/user/tasks/#{task_id}",
|
106
|
+
query
|
107
|
+
)
|
108
|
+
|
109
|
+
request.perform
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
# -- For Enterprise mode only --
|
6
|
+
module Teams
|
7
|
+
def add_team_to_project(query = {}, project_id = config.project_id)
|
8
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
9
|
+
project_id || raise_project_id_is_required_error
|
10
|
+
|
11
|
+
request = Web::Request.new(
|
12
|
+
self,
|
13
|
+
:post,
|
14
|
+
"/projects/#{project_id}/teams",
|
15
|
+
query
|
16
|
+
)
|
17
|
+
|
18
|
+
request.perform
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_teams(query = {})
|
22
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
23
|
+
|
24
|
+
request = Web::Request.new(
|
25
|
+
self,
|
26
|
+
:get,
|
27
|
+
'/teams',
|
28
|
+
query
|
29
|
+
)
|
30
|
+
|
31
|
+
request.perform
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_team(query = {})
|
35
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
36
|
+
|
37
|
+
request = Web::Request.new(
|
38
|
+
self,
|
39
|
+
:post,
|
40
|
+
'/teams',
|
41
|
+
query
|
42
|
+
)
|
43
|
+
|
44
|
+
request.perform
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_team(team_id = nil, query = {})
|
48
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
49
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
50
|
+
|
51
|
+
request = Web::Request.new(
|
52
|
+
self,
|
53
|
+
:get,
|
54
|
+
"/teams/#{team_id}",
|
55
|
+
query
|
56
|
+
)
|
57
|
+
|
58
|
+
request.perform
|
59
|
+
end
|
60
|
+
|
61
|
+
def delete_team(team_id = nil)
|
62
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
63
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
64
|
+
|
65
|
+
request = Web::Request.new(
|
66
|
+
self,
|
67
|
+
:delete,
|
68
|
+
"/teams/#{team_id}"
|
69
|
+
)
|
70
|
+
|
71
|
+
request.perform
|
72
|
+
end
|
73
|
+
|
74
|
+
def edit_team(team_id = nil, query = {})
|
75
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
76
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
77
|
+
|
78
|
+
request = Web::Request.new(
|
79
|
+
self,
|
80
|
+
:patch,
|
81
|
+
"/teams/#{team_id}",
|
82
|
+
query
|
83
|
+
)
|
84
|
+
|
85
|
+
request.perform
|
86
|
+
end
|
87
|
+
|
88
|
+
def team_members_list(team_id = nil, query = {})
|
89
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
90
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
91
|
+
|
92
|
+
request = Web::Request.new(
|
93
|
+
self,
|
94
|
+
:get,
|
95
|
+
"/teams/#{team_id}/members",
|
96
|
+
query
|
97
|
+
)
|
98
|
+
|
99
|
+
request.perform
|
100
|
+
end
|
101
|
+
|
102
|
+
def add_team_members(team_id = nil, query = {})
|
103
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
104
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
105
|
+
|
106
|
+
request = Web::Request.new(
|
107
|
+
self,
|
108
|
+
:post,
|
109
|
+
"/teams/#{team_id}/members",
|
110
|
+
query
|
111
|
+
)
|
112
|
+
|
113
|
+
request.perform
|
114
|
+
end
|
115
|
+
|
116
|
+
def delete_all_team_members(team_id = nil)
|
117
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
118
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
119
|
+
|
120
|
+
request = Web::Request.new(
|
121
|
+
self,
|
122
|
+
:delete,
|
123
|
+
"/teams/#{team_id}/members"
|
124
|
+
)
|
125
|
+
|
126
|
+
request.perform
|
127
|
+
end
|
128
|
+
|
129
|
+
def delete_team_member(team_id = nil, member_id = nil)
|
130
|
+
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
131
|
+
team_id || raise_parameter_is_required_error(:team_id)
|
132
|
+
member_id || raise_parameter_is_required_error(:member_id)
|
133
|
+
|
134
|
+
request = Web::Request.new(
|
135
|
+
self,
|
136
|
+
:delete,
|
137
|
+
"/teams/#{team_id}/members/#{member_id}"
|
138
|
+
)
|
139
|
+
|
140
|
+
request.perform
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module TranslationMemory
|
6
|
+
def list_tms(query = {})
|
7
|
+
request = Web::Request.new(
|
8
|
+
self,
|
9
|
+
:get,
|
10
|
+
'/tms',
|
11
|
+
query
|
12
|
+
)
|
13
|
+
|
14
|
+
request.perform
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_tm(query = {})
|
18
|
+
request = Web::Request.new(
|
19
|
+
self,
|
20
|
+
:post,
|
21
|
+
'/tms',
|
22
|
+
query
|
23
|
+
)
|
24
|
+
|
25
|
+
request.perform
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_tm(tm_id = nil)
|
29
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
30
|
+
|
31
|
+
request = Web::Request.new(
|
32
|
+
self,
|
33
|
+
:get,
|
34
|
+
"/tms/#{tm_id}"
|
35
|
+
)
|
36
|
+
|
37
|
+
request.perform
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete_tm(tm_id = nil)
|
41
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
42
|
+
|
43
|
+
request = Web::Request.new(
|
44
|
+
self,
|
45
|
+
:delete,
|
46
|
+
"/tms/#{tm_id}"
|
47
|
+
)
|
48
|
+
|
49
|
+
request.perform
|
50
|
+
end
|
51
|
+
|
52
|
+
def edit_tm(tm_id = nil, query = {})
|
53
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
54
|
+
|
55
|
+
request = Web::Request.new(
|
56
|
+
self,
|
57
|
+
:delete,
|
58
|
+
"/tms/#{tm_id}",
|
59
|
+
query
|
60
|
+
)
|
61
|
+
|
62
|
+
request.perform
|
63
|
+
end
|
64
|
+
|
65
|
+
def clear_tm(tm_id = nil)
|
66
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
67
|
+
|
68
|
+
request = Web::Request.new(
|
69
|
+
self,
|
70
|
+
:delete,
|
71
|
+
"/tms/#{tm_id}/segments"
|
72
|
+
)
|
73
|
+
|
74
|
+
request.perform
|
75
|
+
end
|
76
|
+
|
77
|
+
def export_tm(tm_id = nil)
|
78
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
79
|
+
|
80
|
+
request = Web::Request.new(
|
81
|
+
self,
|
82
|
+
:post,
|
83
|
+
"/tms/#{tm_id}/exports"
|
84
|
+
)
|
85
|
+
|
86
|
+
request.perform
|
87
|
+
end
|
88
|
+
|
89
|
+
def check_tm_export_status(tm_id = nil, export_id = nil)
|
90
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
91
|
+
export_id || raise_parameter_is_required_error(:export_id)
|
92
|
+
|
93
|
+
request = Web::Request.new(
|
94
|
+
self,
|
95
|
+
:get,
|
96
|
+
"/tms/#{tm_id}/exports/#{export_id}"
|
97
|
+
)
|
98
|
+
|
99
|
+
request.perform
|
100
|
+
end
|
101
|
+
|
102
|
+
def download_tm(tm_id = nil, export_id = nil, destination = nil)
|
103
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
104
|
+
export_id || raise_parameter_is_required_error(:export_id)
|
105
|
+
|
106
|
+
request = Web::Request.new(
|
107
|
+
self,
|
108
|
+
:get,
|
109
|
+
"/tms/#{tm_id}/exports/#{export_id}/download",
|
110
|
+
{},
|
111
|
+
{},
|
112
|
+
destination
|
113
|
+
)
|
114
|
+
|
115
|
+
request.perform
|
116
|
+
end
|
117
|
+
|
118
|
+
def import_tm(tm_id = nil, query = {})
|
119
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
120
|
+
|
121
|
+
request = Web::Request.new(
|
122
|
+
self,
|
123
|
+
:post,
|
124
|
+
"/tms/#{tm_id}/imports",
|
125
|
+
query
|
126
|
+
)
|
127
|
+
|
128
|
+
request.perform
|
129
|
+
end
|
130
|
+
|
131
|
+
def check_tm_import_status(tm_id = nil, import_id = nil)
|
132
|
+
tm_id || raise_parameter_is_required_error(:tm_id)
|
133
|
+
import_id || raise_parameter_is_required_error(:import_id)
|
134
|
+
|
135
|
+
request = Web::Request.new(
|
136
|
+
self,
|
137
|
+
:get,
|
138
|
+
"/tms/#{tm_id}/imports/#{import_id}"
|
139
|
+
)
|
140
|
+
|
141
|
+
request.perform
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -43,7 +43,7 @@ module Crowdin
|
|
43
43
|
request.perform
|
44
44
|
end
|
45
45
|
|
46
|
-
def build_project_file_translation(file_id = nil, query = {}, project_id = config.project_id)
|
46
|
+
def build_project_file_translation(file_id = nil, query = {}, destination = nil, project_id = config.project_id)
|
47
47
|
file_id || raise_parameter_is_required_error(:file_id)
|
48
48
|
project_id || raise_project_id_is_required_error
|
49
49
|
|
@@ -54,7 +54,8 @@ module Crowdin
|
|
54
54
|
:post,
|
55
55
|
"/projects/#{project_id}/translations/builds/files/#{file_id}",
|
56
56
|
query,
|
57
|
-
headers
|
57
|
+
headers,
|
58
|
+
destination
|
58
59
|
)
|
59
60
|
|
60
61
|
request.perform
|
@@ -100,8 +101,7 @@ module Crowdin
|
|
100
101
|
request.perform
|
101
102
|
end
|
102
103
|
|
103
|
-
def download_project_translations(
|
104
|
-
destination || raise_parameter_is_required_error(:destination)
|
104
|
+
def download_project_translations(build_id = nil, destination = nil, project_id = config.project_id)
|
105
105
|
build_id || raise_parameter_is_required_error(:build_id)
|
106
106
|
project_id || raise_project_id_is_required_error
|
107
107
|
|
@@ -143,14 +143,16 @@ module Crowdin
|
|
143
143
|
request.perform
|
144
144
|
end
|
145
145
|
|
146
|
-
def export_project_translation(query = {}, project_id = config.project_id)
|
146
|
+
def export_project_translation(query = {}, destination = nil, project_id = config.project_id)
|
147
147
|
project_id || raise_project_id_is_required_error
|
148
148
|
|
149
149
|
request = Web::Request.new(
|
150
150
|
self,
|
151
151
|
:post,
|
152
152
|
"/projects/#{project_id}/translations/exports",
|
153
|
-
query
|
153
|
+
query,
|
154
|
+
{},
|
155
|
+
destination
|
154
156
|
)
|
155
157
|
|
156
158
|
request.perform
|