crowdin-api 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/README.md +49 -31
- data/lib/crowdin-api/methods.rb +25 -0
- data/lib/crowdin-api/version.rb +1 -1
- metadata +31 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b76f37189de2a8cde395736ad317b4e8ef2bc269667991472947e77afc513f79
|
4
|
+
data.tar.gz: 610af0f467d9872503d84b55444797549d9d1f7989c918d49ba489b4b1832d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eacd28cfff8970ae14ac0658cc1605b9939684b5b52eec0b6eb3c064f198fe932ed61e45818c3e8b64ae1f88610893cdff621523ed6059e2b3da75c48cea038
|
7
|
+
data.tar.gz: be4342ea720e23228001533357011923b46326ddf6e85e12cfe7777e62ea7433cc7b86164163f46d31eb798481661ca8ece3c4418702f8b40c670963602da722
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A Ruby interface to the Crowdin API.
|
4
4
|
|
5
|
-
For more about the Crowdin API see <https://crowdin.com/
|
5
|
+
For more about the Crowdin API see <https://support.crowdin.com/api/api-integration-setup/>.
|
6
6
|
|
7
7
|
To experiment with that code, run `bin/console` for an interactive prompt.
|
8
8
|
|
@@ -12,18 +12,20 @@ To experiment with that code, run `bin/console` for an interactive prompt.
|
|
12
12
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
|
-
```
|
15
|
+
```gemfile
|
16
16
|
gem 'crowdin-api'
|
17
17
|
```
|
18
18
|
|
19
19
|
And then execute:
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
```console
|
22
|
+
bundle
|
22
23
|
```
|
23
24
|
|
24
25
|
Or install it yourself as:
|
25
|
-
|
26
|
-
|
26
|
+
|
27
|
+
```console
|
28
|
+
gem install crowdin-api
|
27
29
|
```
|
28
30
|
|
29
31
|
## Usage
|
@@ -52,16 +54,18 @@ Now you can make requests to the api.
|
|
52
54
|
|
53
55
|
Add new file to Crowdin project.
|
54
56
|
|
55
|
-
Documentation: <https://crowdin.com/
|
57
|
+
Documentation: <https://support.crowdin.com/api/add-file/>.
|
56
58
|
|
57
59
|
First parameter is array of files that should be added to Crowdin project.
|
58
60
|
Every file is hash:
|
61
|
+
|
59
62
|
* `:dest` - file name with path in Crowdin project (required)
|
60
63
|
* `:source` - file that should be added (required)
|
61
64
|
* `:title` - string that defines title for uploaded file (optional)
|
62
65
|
* `:export_pattern` - string that defines name of resulted file (optional)
|
63
66
|
|
64
67
|
Optional params:
|
68
|
+
|
65
69
|
* `:branch` - a branch name (optional)
|
66
70
|
|
67
71
|
**NOTE!** 20 files max are allowed to upload per one time file transfer.
|
@@ -78,16 +82,18 @@ crowdin.add_file(
|
|
78
82
|
|
79
83
|
Upload fresh version of your localization file.
|
80
84
|
|
81
|
-
Documentation <https://crowdin.com/
|
85
|
+
Documentation <https://support.crowdin.com/api/update-file/>
|
82
86
|
|
83
87
|
First parameter is array of files that should be updated in Crowdin project.
|
84
88
|
Every file is hash:
|
89
|
+
|
85
90
|
* `:dest` - file name with path in Crowdin project (required)
|
86
91
|
* `:source` - uploaded file (required)
|
87
92
|
* `:title` - title for uploaded file (optional)
|
88
93
|
* `:export_pattern` - string that defines name of resulted file (optional)
|
89
94
|
|
90
95
|
Optional params:
|
96
|
+
|
91
97
|
* `:branch` - a branch name (optional)
|
92
98
|
|
93
99
|
**NOTE!** 20 files max are allowed to upload per one time file transfer.
|
@@ -105,7 +111,7 @@ crowdin.update_file(
|
|
105
111
|
|
106
112
|
Remove file from Crowdin project.
|
107
113
|
|
108
|
-
Documentation <https://crowdin.com/
|
114
|
+
Documentation <https://support.crowdin.com/api/delete-file/>
|
109
115
|
|
110
116
|
```ruby
|
111
117
|
crowdin.delete_file('strings.xml')
|
@@ -118,10 +124,11 @@ Create a new directory in Crowdin project.
|
|
118
124
|
First parameter `name` - full directory path that should be created (e.g. /MainPage/AboutUs) (required)
|
119
125
|
|
120
126
|
Optional params:
|
127
|
+
|
121
128
|
* `:is_branch` - create new branch. Valid values - `'0'`, `'1'`. Only when create root directory.
|
122
129
|
* `:branch` - a branch name.
|
123
130
|
|
124
|
-
Documentation: <https://crowdin.com/
|
131
|
+
Documentation: <https://support.crowdin.com/api/add-directory/>
|
125
132
|
|
126
133
|
```ruby
|
127
134
|
crowdin.add_directory('dirname')
|
@@ -138,9 +145,10 @@ crowdin.add_directory('master', is_branch: '1')
|
|
138
145
|
Remove directory with nested files from Crowdin project.
|
139
146
|
|
140
147
|
Optional params:
|
148
|
+
|
141
149
|
* `:branch` - a branch name (optional)
|
142
150
|
|
143
|
-
Documentation: <https://crowdin.com/
|
151
|
+
Documentation: <https://support.crowdin.com/api/delete-directory/>
|
144
152
|
|
145
153
|
```ruby
|
146
154
|
crowdin.delete_directory('dirname')
|
@@ -150,11 +158,12 @@ crowdin.delete_directory('dirname')
|
|
150
158
|
|
151
159
|
Rename or change directory attributes.
|
152
160
|
|
153
|
-
Documentation: <https://crowdin.com/
|
161
|
+
Documentation: <https://support.crowdin.com/api/change-directory/>
|
154
162
|
|
155
163
|
First parameter `name` - full directory path that should be modified (e.g. /MainPage/AboutUs) (required)
|
156
164
|
|
157
165
|
Optional params:
|
166
|
+
|
158
167
|
* `:new_name` - new directory name
|
159
168
|
* `:title` - new directory title to be displayed in Crowdin UI
|
160
169
|
* `:export_pattern` - new direcrory export pattern. Is used to create directory name and path in resulted translations bundle.
|
@@ -171,18 +180,20 @@ crowdin.change_directory('/MainPage/AboutUs', new_name: 'AboutCompany')
|
|
171
180
|
|
172
181
|
Upload existing translations to your Crowdin project.
|
173
182
|
|
174
|
-
Documentation: <https://crowdin.com/
|
183
|
+
Documentation: <https://support.crowdin.com/api/upload-translation/>
|
175
184
|
|
176
185
|
First parameter is array of translated files that should be added to Crowdin project.
|
177
186
|
Every file is hash:
|
187
|
+
|
178
188
|
* `:dest` - file names in Crowdin (required)
|
179
189
|
* `:source` - uploaded translation (required)
|
180
190
|
|
181
191
|
Second parameter is target language.
|
182
192
|
With a single call it's possible to upload translations for several files but only into one of the languages.
|
183
|
-
Check [complete list of Crowdin language codes](https://crowdin.com/
|
193
|
+
Check [complete list of Crowdin language codes](https://support.crowdin.com/api/language-codes/) that can be used.
|
184
194
|
|
185
195
|
Optional params:
|
196
|
+
|
186
197
|
* `:import_duplicates` - defines whether to add translation if there is the same translation previously added (default: false)
|
187
198
|
* `:import_eq_suggestions` - defines whether to add translation if it is equal to source string at Crowdin (default: false)
|
188
199
|
* `:auto_approve_imported` - mark uploaded translations as approved (default: false)
|
@@ -205,15 +216,15 @@ crowdin.upload_translation(
|
|
205
216
|
|
206
217
|
Download last exported translation package (one target language or all languages as one zip file).
|
207
218
|
|
208
|
-
Documentation: <https://crowdin.com/
|
219
|
+
Documentation: <https://support.crowdin.com/api/download/>
|
209
220
|
|
210
221
|
First parameter is the language of translation you need or download `all` of them at once.
|
211
222
|
|
212
223
|
Optional params:
|
224
|
+
|
213
225
|
* `:output` - a name of ZIP file with translations
|
214
226
|
* `:branch` - a branch name (default: nil)
|
215
227
|
|
216
|
-
|
217
228
|
```ruby
|
218
229
|
crowdin.download_translation('ru', :output => '/path/to/download/ru_RU.zip')
|
219
230
|
```
|
@@ -222,7 +233,7 @@ crowdin.download_translation('ru', :output => '/path/to/download/ru_RU.zip')
|
|
222
233
|
|
223
234
|
Track overall translation and proofreading progress of each target language.
|
224
235
|
|
225
|
-
Documentation: <https://crowdin.com/
|
236
|
+
Documentation: <https://support.crowdin.com/api/status/>
|
226
237
|
|
227
238
|
```ruby
|
228
239
|
crowdin.translations_status
|
@@ -232,12 +243,18 @@ crowdin.translations_status
|
|
232
243
|
|
233
244
|
Shows project details and meta information (last translations date, currently uploaded files, target languages etc..).
|
234
245
|
|
235
|
-
Documentation: <https://crowdin.com/
|
246
|
+
Documentation: <https://support.crowdin.com/api/info/>
|
236
247
|
|
237
248
|
```ruby
|
238
249
|
crowdin.project_info
|
239
250
|
```
|
240
251
|
|
252
|
+
### Export File
|
253
|
+
|
254
|
+
Export a single translated file from Crowdin.
|
255
|
+
|
256
|
+
Documentation: <https://support.crowdin.com/api/export-file/>
|
257
|
+
|
241
258
|
### Export Translations
|
242
259
|
|
243
260
|
Build ZIP archive with the latest translations.
|
@@ -248,9 +265,10 @@ Also API call will be ignored if there were no changes in the project since prev
|
|
248
265
|
You can see whether ZIP archive with latest translations was actually build by status attribute (`built` or `skipped`) returned in response.
|
249
266
|
|
250
267
|
Optional params:
|
268
|
+
|
251
269
|
* `:branch` - a branch name (default: nil)
|
252
270
|
|
253
|
-
Documentation: <https://crowdin.com/
|
271
|
+
Documentation: <https://support.crowdin.com/api/export/>
|
254
272
|
|
255
273
|
```ruby
|
256
274
|
crowdin.export_translations
|
@@ -262,7 +280,7 @@ Get Crowdin Project details.
|
|
262
280
|
|
263
281
|
**Important:** This API method requires `Account API Key`. This key can not be found on your profile pages.
|
264
282
|
|
265
|
-
Documentation: <https://crowdin.com/
|
283
|
+
Documentation: <https://support.crowdin.com/api/get-projects/>
|
266
284
|
|
267
285
|
```ruby
|
268
286
|
crowdin = Crowdin::API.new(account_key: ACCOUNT_KEY)
|
@@ -275,42 +293,42 @@ Create Crowdin project.
|
|
275
293
|
|
276
294
|
**Important:** This API method requires `Account API Key`. This key can not be found on your profile pages.
|
277
295
|
|
278
|
-
Documentation: <https://crowdin.com/
|
296
|
+
Documentation: <https://support.crowdin.com/api/create-project/>
|
279
297
|
|
280
298
|
### Edit Project
|
281
299
|
|
282
|
-
Documentation: <https://crowdin.com/
|
300
|
+
Documentation: <https://support.crowdin.com/api/edit-project/>
|
283
301
|
|
284
302
|
### Delete Project
|
285
303
|
|
286
|
-
Documentation: <https://crowdin.com/
|
304
|
+
Documentation: <https://support.crowdin.com/api/delete-project/>
|
287
305
|
|
288
306
|
### Download Glossary
|
289
307
|
|
290
|
-
Documentation: <https://crowdin.com/
|
308
|
+
Documentation: <https://support.crowdin.com/api/download-glossary/>
|
291
309
|
|
292
310
|
### Upload Glossary
|
293
311
|
|
294
|
-
Documentation: <https://crowdin.com/
|
312
|
+
Documentation: <https://support.crowdin.com/api/upload-glossary/>
|
295
313
|
|
296
314
|
### Download TM
|
297
315
|
|
298
|
-
Documentation: <https://crowdin.com/
|
316
|
+
Documentation: <https://support.crowdin.com/api/download-tm/>
|
299
317
|
|
300
318
|
### Upload TM
|
301
319
|
|
302
|
-
Documentation: <https://crowdin.com/
|
320
|
+
Documentation: <https://support.crowdin.com/api/upload-tm/>
|
303
321
|
|
304
322
|
### Supported Languages
|
305
323
|
|
306
|
-
Documentation: <https://crowdin.com/
|
324
|
+
Documentation: <https://support.crowdin.com/api/supported-languages/>
|
307
325
|
|
308
326
|
## Supported Rubies
|
309
327
|
|
310
328
|
Tested with the following Ruby versions:
|
311
329
|
|
312
|
-
|
313
|
-
|
330
|
+
* MRI 2.2.1
|
331
|
+
* JRuby 9.0.0.0
|
314
332
|
|
315
333
|
## Contributing
|
316
334
|
|
@@ -324,6 +342,6 @@ Tested with the following Ruby versions:
|
|
324
342
|
|
325
343
|
Author: Anton Maminov (anton.maminov@gmail.com)
|
326
344
|
|
327
|
-
Copyright: 2012-
|
345
|
+
Copyright: 2012-2019 [crowdin.com](https://crowdin.com/)
|
328
346
|
|
329
347
|
This library is distributed under the MIT license. Please see the LICENSE file.
|
data/lib/crowdin-api/methods.rb
CHANGED
@@ -306,6 +306,31 @@ module Crowdin
|
|
306
306
|
)
|
307
307
|
end
|
308
308
|
|
309
|
+
# Export a single translated file from Crowdin.
|
310
|
+
#
|
311
|
+
# == Parameters
|
312
|
+
#
|
313
|
+
# file - File name with path in Crowdin project. (required)
|
314
|
+
# language - Target language. (required)
|
315
|
+
#
|
316
|
+
# Optional:
|
317
|
+
# * :branch - a branch name
|
318
|
+
#
|
319
|
+
# == Request
|
320
|
+
#
|
321
|
+
# GET https://api.crowdin.com/api/project/{project-identifier}/export-file?key={project-key}
|
322
|
+
#
|
323
|
+
def export_file(file, language, params = {})
|
324
|
+
params[:file] = file
|
325
|
+
params[:language] = language
|
326
|
+
request(
|
327
|
+
:method => :get,
|
328
|
+
:path => "/api/project/#{@project_id}/export-file",
|
329
|
+
:output => params.delete(:output),
|
330
|
+
:query => params,
|
331
|
+
)
|
332
|
+
end
|
333
|
+
|
309
334
|
# Build ZIP archive with the latest translations.
|
310
335
|
#
|
311
336
|
# Please note that this method can be invoked only every 30 minutes.
|
data/lib/crowdin-api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdin-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -25,95 +25,101 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.9'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 1.4.7
|
61
|
+
version: '3.6'
|
65
62
|
type: :development
|
66
63
|
prerelease: false
|
67
64
|
version_requirements: !ruby/object:Gem::Requirement
|
68
65
|
requirements:
|
69
66
|
- - "~>"
|
70
67
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 1.4.7
|
68
|
+
version: '3.6'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
70
|
+
name: sinatra
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
73
|
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
75
|
+
version: '2.0'
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 2.0.5
|
82
79
|
type: :development
|
83
80
|
prerelease: false
|
84
81
|
version_requirements: !ruby/object:Gem::Requirement
|
85
82
|
requirements:
|
86
83
|
- - "~>"
|
87
84
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
85
|
+
version: '2.0'
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.0.5
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '11.2'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 11.2.2
|
96
99
|
type: :development
|
97
100
|
prerelease: false
|
98
101
|
version_requirements: !ruby/object:Gem::Requirement
|
99
102
|
requirements:
|
100
103
|
- - "~>"
|
101
104
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
105
|
+
version: '11.2'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 11.2.2
|
103
109
|
- !ruby/object:Gem::Dependency
|
104
110
|
name: pry
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
106
112
|
requirements:
|
107
113
|
- - "~>"
|
108
114
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
115
|
+
version: 0.12.2
|
110
116
|
type: :development
|
111
117
|
prerelease: false
|
112
118
|
version_requirements: !ruby/object:Gem::Requirement
|
113
119
|
requirements:
|
114
120
|
- - "~>"
|
115
121
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0.
|
122
|
+
version: 0.12.2
|
117
123
|
description: Ruby Client for the Crowdin API
|
118
124
|
email:
|
119
125
|
- support@crowdin.net
|
@@ -148,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
154
|
- !ruby/object:Gem::Version
|
149
155
|
version: '0'
|
150
156
|
requirements: []
|
151
|
-
|
152
|
-
rubygems_version: 2.5.2
|
157
|
+
rubygems_version: 3.0.3
|
153
158
|
signing_key:
|
154
159
|
specification_version: 4
|
155
160
|
summary: Client library to manage translations on Crowdin
|