measures 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/measures/transports/http.rb +15 -8
- data/lib/measures/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eb0595ec25d36acf478b600a21631094bb9560a4bfe6b30b21e0af0e4aef3cc4
|
4
|
+
data.tar.gz: '02180667c0ae4dda2d30b85dd5d4f8f7b9a647df9e5911e32501d6e61b577afa'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5acdcecad5ab2dddc812eb2eb2befa43c87c69a2e5b35d831b5389eaba13c80b06ecb0a6875973d31be1ba540c9a3c0185e61ea12c49e1342cb18e0cdfe35cb4
|
7
|
+
data.tar.gz: 54f1fa67878974c9e9278fa5045267e5e8def6d8b51b98cbd1253b23fbc003b388d2523e01a3acd066f30a1b1c295c4d986be97d4d461853a88eebb230a0ee62
|
@@ -5,26 +5,33 @@ require "uri"
|
|
5
5
|
module Measures
|
6
6
|
module Transports
|
7
7
|
class HTTP
|
8
|
-
def initialize(host, port = 80, url = "/")
|
8
|
+
def initialize(host, port = 80, url = "/", open_timeout = 30, timeout = 30)
|
9
9
|
@host = host
|
10
10
|
@port = port
|
11
11
|
@url = url
|
12
|
+
@open_timeout = open_timeout
|
13
|
+
@timeout = timeout
|
12
14
|
end
|
13
15
|
|
14
16
|
def send(data)
|
15
|
-
client = Faraday.new(url: URI::HTTP.build(host: @host, port: @port)) do |c|
|
16
|
-
c.request :json
|
17
|
-
|
18
|
-
c.response :raise_error
|
19
|
-
c.adapter Faraday.default_adapter
|
20
|
-
end
|
21
|
-
|
22
17
|
client.post do |req|
|
23
18
|
req.url @url
|
24
19
|
req.headers["Content-Type"] = "application/json"
|
25
20
|
req.body = data
|
26
21
|
end
|
27
22
|
end
|
23
|
+
|
24
|
+
def client
|
25
|
+
Faraday.new(url: URI::HTTP.build(host: @host, port: @port)) do |c|
|
26
|
+
c.request :json
|
27
|
+
|
28
|
+
c.options[:open_timeout] = @open_timeout
|
29
|
+
c.options[:timeout] = @timeout
|
30
|
+
|
31
|
+
c.response :raise_error
|
32
|
+
c.adapter Faraday.default_adapter
|
33
|
+
end
|
34
|
+
end
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
data/lib/measures/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: measures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Boeira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -166,9 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
169
|
+
rubygems_version: 2.7.10
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Measures ruby client
|
173
173
|
test_files: []
|
174
|
-
has_rdoc:
|