ddy_remote_resource 1.2.1 → 1.2.2

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: 72cede4abb216272f1f22c2e8c2509bc832a77ecfc1b10435c462206f56294de
4
- data.tar.gz: d4fb9fa5d7515de365d5115e9652c27ece767f588ac99f458cb6cb367af947f0
3
+ metadata.gz: b75b31568bd5a246694f34d65c20226e97c2620f7afd6f11750af62ed594b458
4
+ data.tar.gz: 3bdce3777b2ea4fc6a72371ec9e117a3f41bd304316cd0f8eb064e8fa3c0fa8e
5
5
  SHA512:
6
- metadata.gz: 518d4d673aed4390fc3b46bf190905da19566b31e86f2d20b82b7cc3efa1f4120244d69b6aaf2dafd2aecc6e90529df0362864b53511d218406d85ea33a8db98
7
- data.tar.gz: 07621f0c66b4efb19536e34a08ca6a38ed3ae8bf2e760843363ff2ab9e0fcb8c5cf0b1b5626063856710378bfc09ca40f06f58d421e44a02fa432b547dc7cd7a
6
+ metadata.gz: d0c20de26d1ae69f00878158fa2730fffa0cf43a1b6981a55faec3e435950009700fee9d600160698b45b235d9ffa42c8ee8848bb8e5a8eaab6935461976d554
7
+ data.tar.gz: 9cd8475b745edad03b039567d5353b7a7b5077ad4d2721bd91b6b114a35d4a44554d417b060f3a069e20fa911232e5ec080183c1328f09e4e2ea1301713d3025
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.5.3
3
+ - 2.6.8
@@ -42,6 +42,12 @@ module RemoteResource
42
42
  @response.code
43
43
  end
44
44
 
45
+ # The return code can contain additional information when response_code=0
46
+ # see https://curl.se/libcurl/c/libcurl-errors.html for the full list
47
+ def return_code
48
+ @response.return_code
49
+ end
50
+
45
51
  def response_body
46
52
  @response.body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params
47
53
  end
@@ -53,6 +59,7 @@ module RemoteResource
53
59
  def to_s
54
60
  message = "HTTP request failed for #{resource_klass}"
55
61
  message << " with response_code=#{response_code}" if response_code.present?
62
+ message << " with return_code=#{return_code}" if return_code.present? && response_code.zero?
56
63
  message << " with http_action=#{http_action}"
57
64
  message << " with request_url=#{request_url}"
58
65
  message
@@ -28,7 +28,11 @@ module RemoteResource
28
28
  @response_code ||= @connection_response.response_code
29
29
  end
30
30
 
31
- alias_method :code, :response_code
31
+ alias code response_code
32
+
33
+ def return_code
34
+ @return_code ||= @connection_response.return_code
35
+ end
32
36
 
33
37
  def headers
34
38
  @headers ||= @connection_response.headers
@@ -1,3 +1,3 @@
1
1
  module RemoteResource
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
@@ -682,6 +682,17 @@ RSpec.describe RemoteResource::Request do
682
682
  end
683
683
  end
684
684
 
685
+ context 'when the response code is 0 and no other error is raised' do
686
+ it 'raises a RemoteResource::HTTPError with correct error message' do
687
+ allow(response).to receive(:response_code) { 0 }
688
+ allow(connection_response).to receive(:return_code) { :ssl_connect }
689
+ allow(connection_response).to receive(:response_code) { 0 }
690
+
691
+ error_message = 'HTTP request failed for RemoteResource::RequestDummy with response_code=0 with return_code=ssl_connect with http_action=get with request_url=http://www.foobar.com/request_dummy.json'
692
+ expect { request.send(:raise_http_error, request, response) }.to raise_error RemoteResource::HTTPError, error_message
693
+ end
694
+ end
695
+
685
696
  context 'when the response code is nothing and no other error is raised' do
686
697
  it 'raises a RemoteResource::HTTPError' do
687
698
  allow(response).to receive(:response_code) { nil }
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe RemoteResource::VERSION do
4
- it { is_expected.to eql '1.2.0' }
4
+ it { is_expected.to eql '1.2.2' }
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddy_remote_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Digidentity
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-10 00:00:00.000000000 Z
12
+ date: 2021-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler