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: e48386263c0d9c28eb7d659a8a35ee2b634991556f6d90794fe02edad4f76bb9
4
- data.tar.gz: dcdcfd4f4a1f9d0415d7eb8ec6e0db54adbf2e77db9da9dad40b3568aee3938e
3
+ metadata.gz: ff9548440dd2a2a312ae867def3cdcfd0fccd70c2bb1341380483a94776a09f1
4
+ data.tar.gz: 67f2e731d323f60d9af9cd917b535fece3524e3467802be69ecaad1a377fae7d
5
5
  SHA512:
6
- metadata.gz: 2702291c599443bbc8b8454bbe0755eaeaf08de6433fdf6f516014332fd262e6daa26f3944888ff42d4cf03647f840371f78cfbd5a7ada30264d30cfbb5ad214
7
- data.tar.gz: 160bada2b69cc096bca583296d8ee2d5bc390a72d0d62e633bd4f4ae7bde56ef169bf324f5b19d1d3d16ee18b906231d999198abb8cce2d6b3e99f51e3a524e5
6
+ metadata.gz: 6bd609157edfa0b5368266142ba8b905d1ff032f237fc73227fd4d25d0ff34098190957bea2840f3278570cf5d8010f5b34e2623d98dce3a2abf49127bf9b79a
7
+ data.tar.gz: 73dc2a5962b51193fc9376d0644ee3daef308a0f2bfc797e3fcbb6a28ca8c3e26ce40107863ff4b3dda8598e715eb5405467640bcbdf6b2b2cf133053ad9b435
@@ -29,7 +29,7 @@ jobs:
29
29
  bundle exec rake
30
30
 
31
31
  - name: Publish code coverage report
32
- uses: codecov/codecov-action@v3
32
+ uses: codecov/codecov-action@v4
33
33
  if: matrix.ruby-version == '3.0'
34
34
  with:
35
35
  token: ${{ secrets.CODECOV_TOKEN }}
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crowdin-api (1.8.0)
4
+ crowdin-api (1.8.1)
5
5
  open-uri (>= 0.1.0, < 0.2.0)
6
6
  rest-client (>= 2.0.0, < 2.2.0)
7
7
 
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.0'
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 to the current directory with a default filename
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
- headers = query[:eTag] ? { 'If-None-Match' => query[:eTag] } : {}
47
+ etag = query.delete(:eTag)
48
+ headers = etag ? { 'If-None-Match' => etag } : {}
48
49
 
49
50
  request = Web::Request.new(
50
51
  connection,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Crowdin
4
4
  class Client
5
- VERSION = '1.8.0'
5
+ VERSION = '1.8.1'
6
6
  end
7
7
  end
@@ -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
- build_project_file_translation = @crowdin.build_project_file_translation(file_id, {}, nil, project_id)
39
- expect(build_project_file_translation).to eq(200)
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open-uri