ruby-lokalise-api 4.3.0 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CONTRIBUTING.md +1 -1
- data/README.md +1 -1
- data/lib/ruby-lokalise-api/error.rb +2 -1
- data/lib/ruby-lokalise-api/request.rb +2 -2
- data/lib/ruby-lokalise-api/version.rb +1 -1
- data/spec/lib/ruby-lokalise-api/error_spec.rb +8 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4147ca27a676c98d74fa654c4244212aa7e296855d4bda492fd061a3a3a02347
|
4
|
+
data.tar.gz: 59c042db99a7f2899baef674319ec18ab9ee193f3581f35b40fd92b0c43118bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38e44afa51cb74149fb4b7aff68d958232f39d111bef8927835fc9bd012c8738ac0a4a4c175ab1bc9e7b2a846135a5f4ff5473845d562d45d408200e439abedf
|
7
|
+
data.tar.gz: 67cc5c58134b64955f65595f5b5797c72adbaa8dbe9e239fff0d434044e3a599c0eea4dd7418bbbb2834b9cd8f9e7572258f07a514f80c048508cfba408cd2d0
|
data/.github/CONTRIBUTING.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
2. [Create a topic branch.][branch]
|
5
5
|
3. Implement your feature or bug fix.
|
6
6
|
4. Don't forget to add specs and make sure they pass by running `rspec .`.
|
7
|
-
5. Make sure your code complies with the style guide by running `rubocop`. `rubocop -a` can automatically fix most issues for you.
|
7
|
+
5. Make sure your code complies with the style guide by running `rubocop`. `rubocop -a` can automatically fix most issues for you. Run `rubocop -A` to make it more aggressive.
|
8
8
|
6. If necessary, add documentation for your feature or bug fix.
|
9
9
|
7. Commit and push your changes.
|
10
10
|
8. [Submit a pull request.][pr]
|
data/README.md
CHANGED
@@ -47,4 +47,4 @@ Detailed documentation can be found at [lokalise.github.io/ruby-lokalise-api](ht
|
|
47
47
|
|
48
48
|
This gem is licensed under the [BSD 3 Clause license](https://github.com/lokalise/ruby-lokalise-api/blob/master/LICENSE). Prior to version 4 the license type was MIT.
|
49
49
|
|
50
|
-
Copyright (c) [Lokalise team](http://lokalise.co)
|
50
|
+
Copyright (c) [Lokalise team](http://lokalise.co) and [Ilya Bodrov](http://bodrovis.tech)
|
@@ -58,7 +58,7 @@ module Lokalise
|
|
58
58
|
def respond_with(response, client)
|
59
59
|
body = custom_load response.body
|
60
60
|
uri = Addressable::URI.parse response.env.url
|
61
|
-
respond_with_error
|
61
|
+
respond_with_error response.status, body if response.status.between?(400, 599) || (body.respond_to?(:has_key?) && body.key?('error'))
|
62
62
|
extract_headers_from(response).
|
63
63
|
merge('content' => body,
|
64
64
|
'client' => client,
|
@@ -74,7 +74,7 @@ module Lokalise
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def respond_with_error(code, body)
|
77
|
-
raise(Lokalise::Error, body['error']) unless Lokalise::Error::ERRORS.key? code
|
77
|
+
raise(Lokalise::Error, body['error'] || body) unless Lokalise::Error::ERRORS.key? code
|
78
78
|
|
79
79
|
raise Lokalise::Error::ERRORS[code].from_response(body)
|
80
80
|
end
|
@@ -15,6 +15,14 @@ RSpec.describe Lokalise::Error do
|
|
15
15
|
end.to raise_error(described_class)
|
16
16
|
end
|
17
17
|
|
18
|
+
it 'handles an exception when the response does not contain an error key' do
|
19
|
+
expect do
|
20
|
+
VCR.use_cassette('error_no_error_key') do
|
21
|
+
get 'projects', Lokalise.client('invalid')
|
22
|
+
end
|
23
|
+
end.to raise_error(Lokalise::Error::BadRequest)
|
24
|
+
end
|
25
|
+
|
18
26
|
it 'raises BadRequest when API token is invalid' do
|
19
27
|
expect do
|
20
28
|
VCR.use_cassette('error_invalid_token') do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lokalise-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Bodrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -348,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
348
|
- !ruby/object:Gem::Version
|
349
349
|
version: '0'
|
350
350
|
requirements: []
|
351
|
-
rubygems_version: 3.2.
|
351
|
+
rubygems_version: 3.2.26
|
352
352
|
signing_key:
|
353
353
|
specification_version: 4
|
354
354
|
summary: Ruby interface to the Lokalise API
|
@@ -370,11 +370,11 @@ test_files:
|
|
370
370
|
- spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb
|
371
371
|
- spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb
|
372
372
|
- spec/lib/ruby-lokalise-api/rest/tasks_spec.rb
|
373
|
-
- spec/lib/ruby-lokalise-api/rest/teams_spec.rb
|
374
|
-
- spec/lib/ruby-lokalise-api/rest/team_users_spec.rb
|
375
373
|
- spec/lib/ruby-lokalise-api/rest/team_user_groups_spec.rb
|
376
|
-
- spec/lib/ruby-lokalise-api/rest/
|
374
|
+
- spec/lib/ruby-lokalise-api/rest/team_users_spec.rb
|
375
|
+
- spec/lib/ruby-lokalise-api/rest/teams_spec.rb
|
377
376
|
- spec/lib/ruby-lokalise-api/rest/translation_providers_spec.rb
|
377
|
+
- spec/lib/ruby-lokalise-api/rest/translations_spec.rb
|
378
378
|
- spec/lib/ruby-lokalise-api/rest/webhooks_spec.rb
|
379
379
|
- spec/lib/ruby-lokalise-api/utils/snakecase_spec.rb
|
380
380
|
- spec/lib/ruby-lokalise-api_spec.rb
|