companies-house-rest 0.4.1 → 0.4.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
  SHA1:
3
- metadata.gz: 9b1c01cfce832a9c2fb2c544a4287721b6fc1e85
4
- data.tar.gz: ad77694ac9c7a906babe0f55a8efe3e790fa51a7
3
+ metadata.gz: bddbea711091b998c7c72f0f551d84b130132c33
4
+ data.tar.gz: f38f91a6dd923ab07ef890b74052a0c84aa1a721
5
5
  SHA512:
6
- metadata.gz: c923c599922e84dd21b1fbe80eda870157db94083880d736d672fe3aae5d91929f98f1111a162c46fb75f0bc2a819f7e06d192c7d41f93fcc04f2407172b242a
7
- data.tar.gz: a98442b4069835d97c7368b6edeedc5ff0c71cca3f40b139853decba85be301b0f78cb0316c9c55848ef2845ff952b143c805d8765de6495173c8fbd8366184c
6
+ metadata.gz: ed95c52c2cd905e87a50b38306027aa0c2c1888a6e226144d3fecec0d00ad31848cb8c0394012ae5ad661ad2514cc09b2df90e5140b6a07c9705a378c9fe0c33
7
+ data.tar.gz: 2b9b9277379a8a8b40cd151f3a99127217a057adfd5e4a1bf0e1521f87a3af12cd0e2ebe9157928551c68eb59409c01c31a233cc7c48cce6e21f5a1a392314ab
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "companies_house/version"
6
6
 
@@ -22,11 +22,11 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
  spec.required_ruby_version = ">= 2.3"
24
24
 
25
- spec.add_runtime_dependency "activesupport", ">= 4.2"
25
+ spec.add_runtime_dependency "activesupport", "~> 4.2"
26
26
  spec.add_runtime_dependency "virtus", "~> 1.0", ">= 1.0.5"
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.10"
29
- spec.add_development_dependency "gc_ruboconfig", "~> 2.3.1"
29
+ spec.add_development_dependency "gc_ruboconfig", "~> 2.3"
30
30
  spec.add_development_dependency "rake", "~> 12.0"
31
31
  spec.add_development_dependency "rspec", "~> 3.5"
32
32
  spec.add_development_dependency "timecop", "~> 0.8"
@@ -16,6 +16,8 @@ module CompaniesHouse
16
16
  raise ArgumentError, "Missing API key" unless config[:api_key]
17
17
  @api_key = config[:api_key]
18
18
  @endpoint = URI(config[:endpoint] || ENDPOINT)
19
+ @open_timeout = config[:open_timeout] || 60
20
+ @read_timeout = config[:read_timeout] || 60
19
21
  raise ArgumentError, "HTTP is not supported" if @endpoint.scheme != "https"
20
22
  end
21
23
 
@@ -51,6 +53,8 @@ module CompaniesHouse
51
53
  def connection
52
54
  @connection ||= Net::HTTP.new(endpoint.host, endpoint.port).tap do |conn|
53
55
  conn.use_ssl = true
56
+ conn.open_timeout = @open_timeout
57
+ conn.read_timeout = @read_timeout
54
58
  end
55
59
  end
56
60
 
@@ -4,6 +4,7 @@ require "companies_house/api_error"
4
4
  require "companies_house/not_found_error"
5
5
  require "companies_house/authentication_error"
6
6
  require "companies_house/rate_limit_error"
7
+ require "companies_house/timeout_error"
7
8
 
8
9
  require "virtus"
9
10
  require "uri"
@@ -62,6 +63,8 @@ module CompaniesHouse
62
63
  ensure
63
64
  publish_notification
64
65
  end
66
+ rescue Net::OpenTimeout, Net::ReadTimeout
67
+ raise TimeoutError
65
68
  end
66
69
 
67
70
  private
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouse
4
+ # Raised when a request has timed out
5
+ class TimeoutError < APIError
6
+ def initialize(response = nil)
7
+ super("Request timed out", response)
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CompaniesHouse
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: companies-house-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-06 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
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 2.3.1
67
+ version: '2.3'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 2.3.1
74
+ version: '2.3'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +146,7 @@ files:
146
146
  - lib/companies_house/not_found_error.rb
147
147
  - lib/companies_house/rate_limit_error.rb
148
148
  - lib/companies_house/request.rb
149
+ - lib/companies_house/timeout_error.rb
149
150
  - lib/companies_house/version.rb
150
151
  homepage: https://github.com/gocardless/companies-house-rest
151
152
  licenses: