crowdin-api 1.7.0 → 1.8.0

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: 48893708d5c6c19787dec33d3e7f19c87809e6ab33e17d6b54821483cae925d0
4
- data.tar.gz: 4b43a6b919c72b31da170f6d30e771faa07e85e7ebc7845d732a528262e8271d
3
+ metadata.gz: e48386263c0d9c28eb7d659a8a35ee2b634991556f6d90794fe02edad4f76bb9
4
+ data.tar.gz: dcdcfd4f4a1f9d0415d7eb8ec6e0db54adbf2e77db9da9dad40b3568aee3938e
5
5
  SHA512:
6
- metadata.gz: b99fa959c8338fb9c5557eab55e1dd76964d139eb5e4e411fee8d7cb2b352b559beec71974202c76b0e84995042152fbfe244ef1c56a4618081faa4e03c20c4f
7
- data.tar.gz: 90f971f1453892aa47fb7a1ac25bcd8a91a92273b32022b41b647a54a762f180f68d45562f8d009a8a6cd512f217cb25ebedd98927c9f714501c8a229ff1c870
6
+ metadata.gz: 2702291c599443bbc8b8454bbe0755eaeaf08de6433fdf6f516014332fd262e6daa26f3944888ff42d4cf03647f840371f78cfbd5a7ada30264d30cfbb5ad214
7
+ data.tar.gz: 160bada2b69cc096bca583296d8ee2d5bc390a72d0d62e633bd4f4ae7bde56ef169bf324f5b19d1d3d16ee18b906231d999198abb8cce2d6b3e99f51e3a524e5
@@ -30,5 +30,6 @@ jobs:
30
30
 
31
31
  - name: Publish code coverage report
32
32
  uses: codecov/codecov-action@v3
33
+ if: matrix.ruby-version == '3.0'
33
34
  with:
34
35
  token: ${{ secrets.CODECOV_TOKEN }}
data/.release-it.json CHANGED
@@ -24,6 +24,11 @@
24
24
  "file": "lib/crowdin-api/client/version.rb",
25
25
  "search": "VERSION = '\\d+\\.\\d+\\.\\d+'",
26
26
  "replace": "VERSION = '{{versionWithoutPrerelease}}'"
27
+ },
28
+ {
29
+ "file": "Gemfile.lock",
30
+ "search": "crowdin-api \\(\\d+\\.\\d+\\.\\d+\\)",
31
+ "replace": "crowdin-api ({{versionWithoutPrerelease}})"
27
32
  }
28
33
  ]
29
34
  }
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crowdin-api (1.7.0)
4
+ crowdin-api (1.8.0)
5
5
  open-uri (>= 0.1.0, < 0.2.0)
6
6
  rest-client (>= 2.0.0, < 2.2.0)
7
7
 
@@ -11,8 +11,6 @@ GEM
11
11
  addressable (2.8.6)
12
12
  public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
- codecov (0.6.0)
15
- simplecov (>= 0.15, < 0.22)
16
14
  coderay (1.1.3)
17
15
  crack (0.4.5)
18
16
  rexml
@@ -75,10 +73,13 @@ GEM
75
73
  rubocop-ast (1.30.0)
76
74
  parser (>= 3.2.1.0)
77
75
  ruby-progressbar (1.13.0)
78
- simplecov (0.21.2)
76
+ simplecov (0.22.0)
79
77
  docile (~> 1.1)
80
78
  simplecov-html (~> 0.11)
81
79
  simplecov_json_formatter (~> 0.1)
80
+ simplecov-cobertura (2.1.0)
81
+ rexml
82
+ simplecov (~> 0.19)
82
83
  simplecov-html (0.12.3)
83
84
  simplecov_json_formatter (0.1.4)
84
85
  unf (0.1.4)
@@ -92,16 +93,18 @@ GEM
92
93
  yard (0.9.34)
93
94
 
94
95
  PLATFORMS
96
+ arm64-darwin-23
95
97
  x86_64-linux
96
98
 
97
99
  DEPENDENCIES
98
100
  bundler (~> 2.2, >= 2.2.32)
99
- codecov (~> 0.6.0)
100
101
  crowdin-api!
101
102
  pry (~> 0.14.1)
102
103
  rake (~> 13.0, >= 13.0.6)
103
104
  rspec (~> 3.10)
104
105
  rubocop (~> 1.23)
106
+ simplecov (~> 0.22)
107
+ simplecov-cobertura (~> 2.1)
105
108
  webmock (~> 3.14)
106
109
  yard (~> 0.9.28)
107
110
 
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.7.0'
38
+ gem 'crowdin-api', '~> 1.8.0'
39
39
  ```
40
40
 
41
41
  And then execute:
data/crowdin-api.gemspec CHANGED
@@ -23,10 +23,11 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency 'rest-client', '>= 2.0.0', '< 2.2.0'
24
24
 
25
25
  gem.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.32'
26
- gem.add_development_dependency 'codecov', '~> 0.6.0'
27
26
  gem.add_development_dependency 'pry', '~> 0.14.1'
28
27
  gem.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
29
28
  gem.add_development_dependency 'rspec', '~> 3.10'
30
29
  gem.add_development_dependency 'rubocop', '~> 1.23'
30
+ gem.add_development_dependency 'simplecov', '~> 0.22'
31
+ gem.add_development_dependency 'simplecov-cobertura', '~> 2.1'
31
32
  gem.add_development_dependency 'webmock', '~> 3.14'
32
33
  end
@@ -22,7 +22,7 @@ module Crowdin
22
22
  def add_storage(file = nil)
23
23
  file || raise_parameter_is_required_error(:file)
24
24
 
25
- file ||= File.open(file, 'r')
25
+ file = File.open(file, 'r')
26
26
  headers = { 'Content-Type' => 'application/octet-stream', 'Crowdin-API-FileName' => File.basename(file) }
27
27
 
28
28
  request = Web::Request.new(
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Crowdin
4
4
  class Client
5
- VERSION = '1.7.0'
5
+ VERSION = '1.8.0'
6
6
  end
7
7
  end
@@ -44,7 +44,7 @@ module Crowdin
44
44
  end
45
45
 
46
46
  def fetch_response_data(doc)
47
- if doc['data'].is_a?(Hash) && doc['data']['url'] && doc['data']['url'].include?('response-content-disposition')
47
+ if @file_destination && doc['data'].is_a?(Hash) && doc['data']['url']
48
48
  download_file(doc['data']['url'])
49
49
  else
50
50
  doc
@@ -53,8 +53,7 @@ module Crowdin
53
53
 
54
54
  def download_file(url)
55
55
  download = URI.parse(url).open
56
- destination = @file_destination || download.meta['content-disposition']
57
- .match(/filename=("?)(.+)\1/)[2]
56
+ destination = @file_destination
58
57
 
59
58
  IO.copy_stream(download, destination)
60
59
 
@@ -11,10 +11,26 @@ describe Crowdin::ApiResources::Storages do
11
11
  end
12
12
 
13
13
  describe '#add_storage' do
14
- it 'when request are valid', :default do
14
+ subject(:add_storage) { @crowdin.add_storage(file) }
15
+
16
+ let(:file) { 'README.md' }
17
+
18
+ it 'uploads the file to the storage', :default do
19
+ expected_response = 'expected_response'
20
+
15
21
  stub_request(:post, "https://api.crowdin.com/#{target_api_url}/storages")
16
- add_storage = @crowdin.add_storage('README.md')
17
- expect(add_storage).to eq(200)
22
+ .with(
23
+ body: File.read(file),
24
+ headers: {
25
+ 'Content-Type' => 'application/octet-stream',
26
+ 'Crowdin-API-FileName' => File.basename(file)
27
+ }
28
+ )
29
+ .to_return(
30
+ body: JSON.dump(expected_response)
31
+ )
32
+
33
+ is_expected.to eq(expected_response)
18
34
  end
19
35
  end
20
36
 
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'simplecov'
4
- require 'codecov'
4
+ require 'simplecov-cobertura'
5
5
 
6
6
  SimpleCov.start
7
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
7
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
8
8
 
9
9
  require 'webmock/rspec'
10
10
  require 'crowdin-api'
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.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crowdin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open-uri
@@ -70,20 +70,6 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: 2.2.32
73
- - !ruby/object:Gem::Dependency
74
- name: codecov
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: 0.6.0
80
- type: :development
81
- prerelease: false
82
- version_requirements: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - "~>"
85
- - !ruby/object:Gem::Version
86
- version: 0.6.0
87
73
  - !ruby/object:Gem::Dependency
88
74
  name: pry
89
75
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +132,34 @@ dependencies:
146
132
  - - "~>"
147
133
  - !ruby/object:Gem::Version
148
134
  version: '1.23'
135
+ - !ruby/object:Gem::Dependency
136
+ name: simplecov
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '0.22'
142
+ type: :development
143
+ prerelease: false
144
+ version_requirements: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - "~>"
147
+ - !ruby/object:Gem::Version
148
+ version: '0.22'
149
+ - !ruby/object:Gem::Dependency
150
+ name: simplecov-cobertura
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '2.1'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: '2.1'
149
163
  - !ruby/object:Gem::Dependency
150
164
  name: webmock
151
165
  requirement: !ruby/object:Gem::Requirement