passfort 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a294b6d08bf000b4e3c3b76a7509bf5f55da3d0aa6f22e8108dd4f281105f6f4
4
- data.tar.gz: '0197567a2dae8961d1cf6bed577d17753148b17f5dee37036740acc4885365f1'
3
+ metadata.gz: 5832d8b7e35914667cd070932413409c72ba907a9a0f66c4f371a38ad830dfe5
4
+ data.tar.gz: 5a78b3c88b98268f33eac8d6992b170338334f80397145ad895a21d35d0ff042
5
5
  SHA512:
6
- metadata.gz: ef101eaec36d8f92d3702999aca16f1a20b1bd6286b3dcc5c75247a48f10a1d746fa3454e137dd22a9ecf3673b4150d0f5bb18c790b817b9f2400ffe9c615bf3
7
- data.tar.gz: f36f1c38db985538ea6d97c378dca856c2c864d92de9eefbb41892869dab8518ff4422da02f9b3a3260d47073bd8d3357fa593775ffcdf392773d43dbb35131c
6
+ metadata.gz: ad1b56c1c2b447e2f43d307477677892e0c711974611b023d88c089c7e4d27bf5e468750c930173d4d7e1bb8b32a4a85763bb34923a3358277cb1f6fa9f1e87f
7
+ data.tar.gz: 301c2f12b9e4d148604d3b90d8642f7a05f17979641a9d9837f97e9dfb50bcce98776342e2f15924f14b8b54046d35905854644629d3d587ddb122d2f9735ea6
@@ -1,2 +1,5 @@
1
1
  inherit_gem:
2
2
  gc_ruboconfig: rubocop.yml
3
+
4
+ Metrics/MethodLength:
5
+ Max: 15
@@ -6,6 +6,11 @@ Unreleased
6
6
 
7
7
  No changes.
8
8
 
9
+ 0.2.3
10
+ -----
11
+
12
+ - Raise `Passfort::Errors::TimeoutError` when a request times out.
13
+
9
14
  0.2.2
10
15
  ----------
11
16
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passfort (0.2.2)
4
+ passfort (0.2.3)
5
5
  activesupport (~> 5.0)
6
6
  excon (~> 0.60)
7
7
 
@@ -21,7 +21,7 @@ GEM
21
21
  crack (0.4.3)
22
22
  safe_yaml (~> 1.0.0)
23
23
  diff-lcs (1.3)
24
- excon (0.60.0)
24
+ excon (0.62.0)
25
25
  gc_ruboconfig (2.3.5)
26
26
  rubocop (~> 0.54.0)
27
27
  rubocop-rspec (~> 1.24)
@@ -31,13 +31,13 @@ GEM
31
31
  method_source (0.9.0)
32
32
  minitest (5.11.3)
33
33
  parallel (1.12.1)
34
- parser (2.5.0.4)
34
+ parser (2.5.0.5)
35
35
  ast (~> 2.4.0)
36
36
  powerpack (0.1.1)
37
37
  pry (0.11.3)
38
38
  coderay (~> 1.1.0)
39
39
  method_source (~> 0.9.0)
40
- public_suffix (3.0.1)
40
+ public_suffix (3.0.2)
41
41
  rainbow (3.0.0)
42
42
  rspec (3.7.0)
43
43
  rspec-core (~> 3.7.0)
@@ -7,6 +7,7 @@ require "passfort/errors/invalid_api_key_error"
7
7
  require "passfort/errors/invalid_input_data_error"
8
8
  require "passfort/errors/request_error"
9
9
  require "passfort/errors/unparseable_response_error"
10
+ require "passfort/errors/timeout_error"
10
11
 
11
12
  module Passfort
12
13
  module Errors
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Passfort
4
+ module Errors
5
+ # Specific error class for when an HTTP request has timed out
6
+ class TimeoutError < APIError
7
+ def initialize
8
+ super("Request timed out")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -20,6 +20,8 @@ module Passfort
20
20
  body
21
21
  rescue JSON::ParserError
22
22
  raise Passfort::Errors::UnparseableResponseError.new([], response)
23
+ rescue Excon::Errors::Timeout
24
+ raise Passfort::Errors::TimeoutError
23
25
  end
24
26
 
25
27
  def post(path, body:)
@@ -33,6 +35,8 @@ module Passfort
33
35
  body
34
36
  rescue JSON::ParserError
35
37
  raise Passfort::Errors::UnparseableResponseError.new([], response)
38
+ rescue Excon::Errors::Timeout
39
+ raise Passfort::Errors::TimeoutError
36
40
  end
37
41
 
38
42
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Passfort
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
@@ -12,7 +12,7 @@ RSpec.describe Passfort::Http do
12
12
  let(:error_code) { 0 }
13
13
  let(:body) { { errors: { code: error_code } }.to_json }
14
14
 
15
- before { stub_request(method, api_path). to_return(status: status, body: body) }
15
+ before { stub_request(method, api_path).to_return(status: status, body: body) }
16
16
 
17
17
  context "when returning a request error" do
18
18
  let(:status) { 404 }
@@ -68,6 +68,13 @@ RSpec.describe Passfort::Http do
68
68
  expect(result).to include("id" => "6c1d594a-496e-11e7-911e-acbc32b67d7b")
69
69
  end
70
70
  end
71
+
72
+ context "when the request times out" do
73
+ before { stub_request(method, api_path).to_raise(Excon::Errors::Timeout) }
74
+ let(:error_class) { Passfort::Errors::TimeoutError }
75
+
76
+ it { is_expected.to raise_error(error_class) }
77
+ end
71
78
  end
72
79
 
73
80
  describe "#get" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passfort
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -135,6 +135,7 @@ files:
135
135
  - lib/passfort/errors/invalid_api_key_error.rb
136
136
  - lib/passfort/errors/invalid_input_data_error.rb
137
137
  - lib/passfort/errors/request_error.rb
138
+ - lib/passfort/errors/timeout_error.rb
138
139
  - lib/passfort/errors/unknown_api_error.rb
139
140
  - lib/passfort/errors/unparseable_response_error.rb
140
141
  - lib/passfort/http.rb