crowdin-api 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +15 -15
- data/README.md +2 -1
- data/lib/crowdin-api/api_resources/bundles.rb +3 -2
- data/lib/crowdin-api/client/configuration.rb +2 -1
- data/lib/crowdin-api/client/version.rb +1 -1
- data/spec/api_resources/bundles_spec.rb +1 -1
- data/spec/unit/client_spec.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d44d26d0f12ba278e3199deda37ad21b26e1d977f36bb050e0b42bc98ded84bc
|
4
|
+
data.tar.gz: e86837279bc7aa8a6cfdd7a87c0e09c7764c63a0b6ac072bb1ba72c820ab5970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6798c53e8405fbc05faa84d21aaac11a780e8d945b2ebde85872b18b706c320d83ec797ba762cca02f96b568fdc460361f469cdb00440bb8aa6db7a3768cbeb4
|
7
|
+
data.tar.gz: 8c211132ea5389f49cb800d78a7cc5405663ee0cd1c12dda5a0bb687f7feb18fd34c29937f5de289c17d3f2cf5a72e86c2197c2b06c69c7fc1c7c0f1fc65279a
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
crowdin-api (1.
|
4
|
+
crowdin-api (1.10.0)
|
5
5
|
open-uri (>= 0.1.0, < 0.2.0)
|
6
6
|
rest-client (>= 2.0.0, < 2.2.0)
|
7
7
|
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
coderay (1.1.3)
|
15
15
|
crack (0.4.5)
|
16
16
|
rexml
|
17
|
-
diff-lcs (1.5.
|
17
|
+
diff-lcs (1.5.1)
|
18
18
|
docile (1.4.0)
|
19
19
|
domain_name (0.5.20190701)
|
20
20
|
unf (>= 0.0.5, < 1.0.0)
|
@@ -47,19 +47,19 @@ GEM
|
|
47
47
|
mime-types (>= 1.16, < 4.0)
|
48
48
|
netrc (~> 0.8)
|
49
49
|
rexml (3.2.6)
|
50
|
-
rspec (3.
|
51
|
-
rspec-core (~> 3.
|
52
|
-
rspec-expectations (~> 3.
|
53
|
-
rspec-mocks (~> 3.
|
54
|
-
rspec-core (3.
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-expectations (3.
|
50
|
+
rspec (3.13.0)
|
51
|
+
rspec-core (~> 3.13.0)
|
52
|
+
rspec-expectations (~> 3.13.0)
|
53
|
+
rspec-mocks (~> 3.13.0)
|
54
|
+
rspec-core (3.13.0)
|
55
|
+
rspec-support (~> 3.13.0)
|
56
|
+
rspec-expectations (3.13.0)
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
-
rspec-support (~> 3.
|
59
|
-
rspec-mocks (3.
|
58
|
+
rspec-support (~> 3.13.0)
|
59
|
+
rspec-mocks (3.13.0)
|
60
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-support (3.
|
61
|
+
rspec-support (~> 3.13.0)
|
62
|
+
rspec-support (3.13.1)
|
63
63
|
rubocop (1.50.2)
|
64
64
|
json (~> 2.3)
|
65
65
|
parallel (~> 1.10)
|
@@ -90,7 +90,7 @@ GEM
|
|
90
90
|
addressable (>= 2.8.0)
|
91
91
|
crack (>= 0.3.2)
|
92
92
|
hashdiff (>= 0.4.0, < 2.0.0)
|
93
|
-
yard (0.9.
|
93
|
+
yard (0.9.36)
|
94
94
|
|
95
95
|
PLATFORMS
|
96
96
|
arm64-darwin-23
|
@@ -106,7 +106,7 @@ DEPENDENCIES
|
|
106
106
|
simplecov (~> 0.22)
|
107
107
|
simplecov-cobertura (~> 2.1)
|
108
108
|
webmock (~> 3.14)
|
109
|
-
yard (~> 0.9.
|
109
|
+
yard (~> 0.9.36)
|
110
110
|
|
111
111
|
BUNDLED WITH
|
112
112
|
2.4.22
|
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.
|
38
|
+
gem 'crowdin-api', '~> 1.10.0'
|
39
39
|
```
|
40
40
|
|
41
41
|
And then execute:
|
@@ -78,6 +78,7 @@ crowdin = Crowdin::Client.new do |config|
|
|
78
78
|
config.organization_domain = 'YourOrganizationDomain' # [String] optional
|
79
79
|
config.project_id = 'YourProjectId' # [Integer] nil by default
|
80
80
|
config.enable_logger = true # [Boolean] false by default
|
81
|
+
config.request_timeout = 60 # [nil, Integer] disabled by default
|
81
82
|
end
|
82
83
|
# Note: Client will initialize default Logger instance if you have specify
|
83
84
|
# enable_logger to true, you can change it by crowdin.logger = YourLogger
|
@@ -70,9 +70,10 @@ module Crowdin
|
|
70
70
|
|
71
71
|
# @param bundle_id [Integer] Bundle ID
|
72
72
|
# @param export_id [String] Export ID
|
73
|
+
# @param destination [String] Destination of File
|
73
74
|
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.exports.download.get API Documentation}
|
74
75
|
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.exports.download.get Enterprise API Documentation}
|
75
|
-
def download_bundle(bundle_id, export_id, project_id = config.project_id)
|
76
|
+
def download_bundle(bundle_id, export_id, destination = nil, project_id = config.project_id)
|
76
77
|
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
77
78
|
export_id || raise_parameter_is_required_error(:export_id)
|
78
79
|
project_id || raise_project_id_is_required_error
|
@@ -82,7 +83,7 @@ module Crowdin
|
|
82
83
|
:get,
|
83
84
|
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports/#{export_id}/download"
|
84
85
|
)
|
85
|
-
Web::SendRequest.new(request).perform
|
86
|
+
Web::SendRequest.new(request, destination).perform
|
86
87
|
end
|
87
88
|
|
88
89
|
# @param bundle_id [Integer] Bundle ID
|
@@ -5,6 +5,7 @@ module Crowdin
|
|
5
5
|
attr_accessor :api_token
|
6
6
|
attr_accessor :project_id
|
7
7
|
attr_accessor :organization_domain
|
8
|
+
attr_accessor :request_timeout
|
8
9
|
|
9
10
|
attr_accessor :enable_logger
|
10
11
|
alias logger_enabled? enable_logger
|
@@ -18,7 +19,7 @@ module Crowdin
|
|
18
19
|
def options
|
19
20
|
{
|
20
21
|
headers: {},
|
21
|
-
timeout:
|
22
|
+
timeout: request_timeout,
|
22
23
|
json: true
|
23
24
|
}
|
24
25
|
end
|
@@ -44,7 +44,7 @@ describe Crowdin::ApiResources::Bundles do
|
|
44
44
|
|
45
45
|
it 'when request are valid', :default do
|
46
46
|
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports/#{export_id}/download")
|
47
|
-
download_bundle = @crowdin.download_bundle(bundle_id, export_id, project_id)
|
47
|
+
download_bundle = @crowdin.download_bundle(bundle_id, export_id, nil, project_id)
|
48
48
|
expect(download_bundle).to eq(200)
|
49
49
|
end
|
50
50
|
end
|
data/spec/unit/client_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'Crowdin Client' do
|
4
|
+
let(:crowdin_client) { Crowdin::Client.new }
|
5
|
+
|
4
6
|
it 'should have a list of API Resources' do
|
5
7
|
expect(Crowdin::API_RESOURCES_MODULES).to_not be_nil
|
6
8
|
end
|
@@ -21,6 +23,7 @@ describe 'Crowdin Client' do
|
|
21
23
|
it 'should have options and headers for RestClient', :default do
|
22
24
|
expect(@crowdin.options.class).to eq(Hash)
|
23
25
|
expect(@crowdin.options).to include(:headers)
|
26
|
+
expect(@crowdin.options).to include(timeout: nil)
|
24
27
|
end
|
25
28
|
|
26
29
|
it 'should have a Config instance', :default do
|
@@ -94,4 +97,26 @@ describe 'Crowdin Client' do
|
|
94
97
|
expect { @crowdin.fetch_all(:export_bundle).to raise_error(Crowdin::Errors::FetchAllProcessingError) }
|
95
98
|
end
|
96
99
|
end
|
100
|
+
|
101
|
+
describe 'connection' do
|
102
|
+
subject(:connection) { crowdin_client.connection }
|
103
|
+
|
104
|
+
it 'timeout is disabled by default' do
|
105
|
+
is_expected.to have_attributes(options: include(timeout: be_nil))
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'when new request timeout config is set' do
|
109
|
+
let(:new_request_timeout) { 60 }
|
110
|
+
|
111
|
+
let(:crowdin_client) do
|
112
|
+
Crowdin::Client.new do |config|
|
113
|
+
config.request_timeout = new_request_timeout
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'timeout option is changed to new value' do
|
118
|
+
is_expected.to have_attributes(options: include(timeout: new_request_timeout))
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
97
122
|
end
|
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.
|
4
|
+
version: 1.10.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-
|
11
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open-uri
|