crowdin-api 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff9548440dd2a2a312ae867def3cdcfd0fccd70c2bb1341380483a94776a09f1
|
4
|
+
data.tar.gz: 67f2e731d323f60d9af9cd917b535fece3524e3467802be69ecaad1a377fae7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bd609157edfa0b5368266142ba8b905d1ff032f237fc73227fd4d25d0ff34098190957bea2840f3278570cf5d8010f5b34e2623d98dce3a2abf49127bf9b79a
|
7
|
+
data.tar.gz: 73dc2a5962b51193fc9376d0644ee3daef308a0f2bfc797e3fcbb6a28ca8c3e26ce40107863ff4b3dda8598e715eb5405467640bcbdf6b2b2cf133053ad9b435
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -35,7 +35,7 @@ Crowdin API is a full-featured RESTful API that helps you to integrate localizat
|
|
35
35
|
Add this line to your application's Gemfile:
|
36
36
|
|
37
37
|
```gemfile
|
38
|
-
gem 'crowdin-api', '~> 1.8.
|
38
|
+
gem 'crowdin-api', '~> 1.8.1'
|
39
39
|
```
|
40
40
|
|
41
41
|
And then execute:
|
@@ -120,8 +120,8 @@ storage = crowdin.add_storage('YourFilename.extension')
|
|
120
120
|
|
121
121
|
# Download file
|
122
122
|
file = crowdin.download_file(your_file_id, your_destination, your_project_id)
|
123
|
-
# your_destination - filename or absolute path to file, optional
|
124
|
-
# Without destination option file will be saved
|
123
|
+
# your_destination - filename or absolute path to the file, optional
|
124
|
+
# Without a destination option, the file will not be saved automatically
|
125
125
|
# project_id is optional, as it can be initialized with a Crowdin Client
|
126
126
|
|
127
127
|
# File revisions
|
@@ -44,7 +44,8 @@ module Crowdin
|
|
44
44
|
file_id || raise_parameter_is_required_error(:file_id)
|
45
45
|
project_id || raise_project_id_is_required_error
|
46
46
|
|
47
|
-
|
47
|
+
etag = query.delete(:eTag)
|
48
|
+
headers = etag ? { 'If-None-Match' => etag } : {}
|
48
49
|
|
49
50
|
request = Web::Request.new(
|
50
51
|
connection,
|
@@ -31,12 +31,49 @@ describe Crowdin::ApiResources::Translations do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '#build_project_file_translation' do
|
34
|
+
subject(:build_project_file_translation) do
|
35
|
+
@crowdin.build_project_file_translation(file_id, query, destination, project_id)
|
36
|
+
end
|
37
|
+
|
34
38
|
let(:file_id) { 1 }
|
39
|
+
let(:query) { { targetLanguageId: target_language_id } }
|
40
|
+
let(:destination) { nil }
|
41
|
+
|
42
|
+
let(:target_language_id) { 'expected_language_id' }
|
43
|
+
|
44
|
+
it 'builds project file translation', :default do
|
45
|
+
expected_response = 'expected_response'
|
35
46
|
|
36
|
-
it 'when request are valid', :default do
|
37
47
|
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/files/#{file_id}")
|
38
|
-
|
39
|
-
|
48
|
+
.with(
|
49
|
+
body: JSON.dump(query)
|
50
|
+
)
|
51
|
+
.to_return(
|
52
|
+
body: JSON.dump(expected_response)
|
53
|
+
)
|
54
|
+
|
55
|
+
is_expected.to eq(expected_response)
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when the `eTag` query param is passed' do
|
59
|
+
let(:query) { { targetLanguageId: 'expected_language_id', eTag: etag } }
|
60
|
+
|
61
|
+
let(:etag) { 'expected_etag' }
|
62
|
+
|
63
|
+
it 'builds project file translation for new changes after the passed `eTag`', :default do
|
64
|
+
expected_response = 'expected_response'
|
65
|
+
|
66
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/files/#{file_id}")
|
67
|
+
.with(
|
68
|
+
body: JSON.dump({ targetLanguageId: target_language_id }),
|
69
|
+
headers: { 'If-None-Match' => etag }
|
70
|
+
)
|
71
|
+
.to_return(
|
72
|
+
body: JSON.dump(expected_response)
|
73
|
+
)
|
74
|
+
|
75
|
+
is_expected.to eq(expected_response)
|
76
|
+
end
|
40
77
|
end
|
41
78
|
end
|
42
79
|
|
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: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open-uri
|