code-ruby 1.8.13 → 1.8.14

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: 3a198577db25eecafeebb990128a74e33af1a52a3eb6e403c90f8f365129a2a5
4
- data.tar.gz: 7ed8ae578905e87c60aecec4e8266018771a03adcb0f673be10ae5a96a132bed
3
+ metadata.gz: 9878b7c9982e4c6a8ce5fe805e7554146806aafbf0ab49cea8506041aa32aa9a
4
+ data.tar.gz: e8903b2ab607f7e07c703d13e4ef7737e6794498dd35ec930f90753089ed6664
5
5
  SHA512:
6
- metadata.gz: a8c17804e2268dbf8fbbf312762e3e92f9d723533a1b0f7ae382659be3932f5154d89a388388799d17e95d8c1298d2631900178bca0028d074dee9d0ccecaba6
7
- data.tar.gz: 6fb62ac0e048e1a29da2115d1a3b4c3646a4320e6e751847bdeccb8542e075c1205a18e9b51c2256d56ff777ade53564a9dbdc24badd2f2676ff923daa1f1743
6
+ metadata.gz: faab10cb784cd9bdf971cf8ad3db74e200c6367ee52c1116290f15525789d8e9d0186721b4918533352d03b9f8db0a67d63955f5019facc82036dbb100692d87
7
+ data.tar.gz: c3485d1f028729ce3bd227129e165f52e6fa261a18567d69357e4e600f44b600076406b402d81a48c2bf1ee8942220cb111fa687348f7818a408a0a84a7a7a65
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code-ruby (1.8.13)
4
+ code-ruby (1.8.14)
5
5
  activesupport
6
6
  base64
7
7
  bigdecimal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.13
1
+ 1.8.14
@@ -11,7 +11,11 @@ class Code
11
11
  body: String.maybe,
12
12
  username: String.maybe,
13
13
  password: String.maybe,
14
- data: Dictionary.maybe
14
+ data: Dictionary.maybe,
15
+ timeout: (Integer | Decimal).maybe,
16
+ open_timeout: (Integer | Decimal).maybe,
17
+ read_timeout: (Integer | Decimal).maybe,
18
+ write_timeout: (Integer | Decimal).maybe
15
19
  }
16
20
  ].freeze
17
21
 
@@ -160,6 +164,10 @@ class Code
160
164
  body = options.code_get("body").to_s
161
165
  headers = options.code_get("headers").raw || {}
162
166
  data = options.code_get("data").raw || {}
167
+ timeout = options.code_get("timeout")
168
+ open_timeout = options.code_get("open_timeout")
169
+ read_timeout = options.code_get("read_timeout")
170
+ write_timeout = options.code_get("write_timeout")
163
171
  query = options.code_get("query").raw || {}
164
172
  query = query.to_a.flatten.map(&:to_s).each_slice(2).to_h.to_query
165
173
 
@@ -174,6 +182,16 @@ class Code
174
182
  uri = ::URI.parse(url)
175
183
  http = ::Net::HTTP.new(uri.host, uri.port)
176
184
  http.use_ssl = true if uri.scheme == "https"
185
+ default_timeout = timeout.nothing? ? Float::INFINITY : timeout.to_f
186
+ open_timeout_value = open_timeout.nothing? ? default_timeout : open_timeout.to_f
187
+ read_timeout_value = read_timeout.nothing? ? default_timeout : read_timeout.to_f
188
+ write_timeout_value = write_timeout.nothing? ? default_timeout : write_timeout.to_f
189
+
190
+ http.open_timeout = open_timeout_value if open_timeout_value
191
+ http.read_timeout = read_timeout_value if read_timeout_value
192
+ if http.respond_to?(:write_timeout=) && write_timeout_value
193
+ http.write_timeout = write_timeout_value
194
+ end
177
195
 
178
196
  request_class =
179
197
  case verb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.13
4
+ version: 1.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié