berbix 0.0.7 → 0.0.8
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/lib/berbix.rb +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ca2b2ab54b6feeb8b5541a0ffcc09b1dbe8a8f654ddbe0084229090f6ef486
|
4
|
+
data.tar.gz: 32e96587ed52dcc545e4a1d2577da4ac42c0438bbf1fdaf14ace9a48d1f6c999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b32079aaa304876ee08115b1af4def5ff1a47f54d3418ece08880261a30fed30dfde219ddfe7abd01972552fdb0049d4a785872c46e7494829a54b33544920e6
|
7
|
+
data.tar.gz: abf4c1c34bfde3f072d0f935a933845cab6097c4e0f97daecfa6d0eb30040a9f8a3f1378d0a433db77ce8c2faed287422bbb0366c8482a6eec98bd7014d0d739
|
data/lib/berbix.rb
CHANGED
@@ -3,7 +3,7 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Berbix
|
5
5
|
|
6
|
-
SDK_VERSION = '0.0.
|
6
|
+
SDK_VERSION = '0.0.8'
|
7
7
|
CLOCK_DRIFT = 300
|
8
8
|
|
9
9
|
class HTTPClient
|
@@ -13,6 +13,15 @@ module Berbix
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class NetHTTPClient < HTTPClient
|
16
|
+
attr_reader :read_timeout
|
17
|
+
attr_reader :open_timeout
|
18
|
+
|
19
|
+
def initialize(opts={})
|
20
|
+
# Sets the defaults to align with the Net::HTTP defaults
|
21
|
+
@open_timeout = opts[:open_timeout] || 60
|
22
|
+
@read_timeout = opts[:read_timeout] || 60
|
23
|
+
end
|
24
|
+
|
16
25
|
def request(method, url, headers, opts={})
|
17
26
|
uri = URI(url)
|
18
27
|
klass = if method == :post
|
@@ -33,6 +42,8 @@ module Berbix
|
|
33
42
|
end
|
34
43
|
cli = Net::HTTP.new(uri.host, uri.port).tap do |http|
|
35
44
|
http.use_ssl = true
|
45
|
+
http.read_timeout = read_timeout
|
46
|
+
http.open_timeout = open_timeout
|
36
47
|
end
|
37
48
|
res = cli.request(req)
|
38
49
|
code = res.code.to_i
|