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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 70eaeeaaca44acefa72f3e07d7218c475c1c9f95
4
- data.tar.gz: 4488c134898b88fe1076eb539f12a08ece7560d2
2
+ SHA256:
3
+ metadata.gz: eb0595ec25d36acf478b600a21631094bb9560a4bfe6b30b21e0af0e4aef3cc4
4
+ data.tar.gz: '02180667c0ae4dda2d30b85dd5d4f8f7b9a647df9e5911e32501d6e61b577afa'
5
5
  SHA512:
6
- metadata.gz: 8ee94661fec3b5fbe4f5a61ab2ee7e2fdb4f25d755950d01c9c17c3c988f9ea6fcbc5ddff0b4fcc865b956a7e9a1241d8e2513efd5e0b571fd55976f7414367c
7
- data.tar.gz: aab1674c92d8406477f50e57e40d423dbb951acfeaca8b08460e9ffa8b015b4a1f909a5419bdfcd8a3fa15580377644bec56a9109ea124e8552d0a52ead73302
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
@@ -1,3 +1,3 @@
1
1
  module Measures
2
- VERSION = "4.0.0"
2
+ VERSION = "5.0.0"
3
3
  end
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.0.0
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: 2016-06-17 00:00:00.000000000 Z
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.5.1
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: