eac_envs-http 0.5.1 → 0.6.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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26e1482ff58e47b7a780079016d86be8ebc34f24abce6b72884490a82a2f9cdb
|
4
|
+
data.tar.gz: b8c417ee8ea17f08c445308d0a613ed0ce368836ddbf0c3737d22feaa796a023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6b78b5edb1f9bee713d93851a87ee9c9874e99ea689bb795d5726632663060bb4b6c2269e1108cdd2384db13c7d2b7bc7281c31dddd41a31a60a46c087b8830
|
7
|
+
data.tar.gz: 36b9871a50b8f8d8de845eff995955dbbeef82c12e0fbb743a47a5d5f4b8177b74ab03489feb1c0bfe7cf3d06cff5c523e218a71e618dcfe619ec4af0f475280
|
@@ -14,6 +14,7 @@ module EacEnvs
|
|
14
14
|
enable_method_class
|
15
15
|
common_constructor :request
|
16
16
|
|
17
|
+
DEFAULT_TIMEOUT = 15.seconds
|
17
18
|
SETUPS = %i[multipart authorization follow_redirect gzip retry].freeze
|
18
19
|
|
19
20
|
# @return [Faraday::Connection]
|
@@ -34,11 +35,16 @@ module EacEnvs
|
|
34
35
|
# @return [Hash]
|
35
36
|
def connection_options
|
36
37
|
{
|
37
|
-
request:
|
38
|
+
request: request_connection_options,
|
38
39
|
ssl: { verify: request.ssl_verify? }
|
39
40
|
}
|
40
41
|
end
|
41
42
|
|
43
|
+
# @return [Hash]
|
44
|
+
def request_connection_options
|
45
|
+
{ params_encoder: Faraday::FlatParamsEncoder, timeout: timeout }
|
46
|
+
end
|
47
|
+
|
42
48
|
# @param conn [Faraday::Connection]
|
43
49
|
def setup_authorization(conn)
|
44
50
|
request.auth.if_present do |v|
|
@@ -69,6 +75,11 @@ module EacEnvs
|
|
69
75
|
def setup_retry(conn)
|
70
76
|
conn.request :retry if request.retry?
|
71
77
|
end
|
78
|
+
|
79
|
+
# @return [Integer]
|
80
|
+
def timeout
|
81
|
+
request.timeout.if_present(DEFAULT_TIMEOUT).to_i
|
82
|
+
end
|
72
83
|
end
|
73
84
|
end
|
74
85
|
end
|
@@ -7,7 +7,7 @@ module EacEnvs
|
|
7
7
|
module Http
|
8
8
|
class Request
|
9
9
|
BOOLEAN_MODIFIERS = %w[follow_redirect retry ssl_verify].freeze
|
10
|
-
COMMON_MODIFIERS = %w[auth body_data response_body_data_proc url verb].freeze
|
10
|
+
COMMON_MODIFIERS = %w[auth body_data response_body_data_proc url timeout verb].freeze
|
11
11
|
HASH_MODIFIERS = %w[header].freeze
|
12
12
|
MODIFIERS = COMMON_MODIFIERS + BOOLEAN_MODIFIERS + HASH_MODIFIERS.map(&:pluralize)
|
13
13
|
|
@@ -37,12 +37,21 @@ module EacEnvs
|
|
37
37
|
performed.body
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
# @return [String]
|
41
|
+
# @raise [EacEnvs::Http::Response]
|
42
|
+
def body_str!
|
41
43
|
raise_unless_200
|
42
44
|
|
43
45
|
body_str
|
44
46
|
end
|
45
47
|
|
48
|
+
# @deprecated Use {#body_str!} instead.
|
49
|
+
# @return [Object]
|
50
|
+
# @raise [EacEnvs::Http::Response]
|
51
|
+
def body_str_or_raise
|
52
|
+
body_str!
|
53
|
+
end
|
54
|
+
|
46
55
|
# @param path [Pathname]
|
47
56
|
def write_body(path)
|
48
57
|
::File.binwrite(path, performed.body)
|
@@ -20,8 +20,8 @@ module EacEnvs
|
|
20
20
|
|
21
21
|
def performed
|
22
22
|
@performed ||= request.faraday_response
|
23
|
-
rescue ::Faraday::Error
|
24
|
-
raise ::EacEnvs::Http::Error
|
23
|
+
rescue ::Faraday::Error => e
|
24
|
+
raise ::EacEnvs::Http::Error, e.message
|
25
25
|
end
|
26
26
|
|
27
27
|
require_sub __FILE__, include_modules: true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_envs-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_fs
|
@@ -16,48 +16,54 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.18'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.18.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
29
|
+
version: '0.18'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.18.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: eac_ruby_utils
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
39
|
+
version: '0.123'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
46
|
+
version: '0.123'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: faraday
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
53
|
+
version: '2.8'
|
48
54
|
- - ">="
|
49
55
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2.
|
56
|
+
version: 2.8.1
|
51
57
|
type: :runtime
|
52
58
|
prerelease: false
|
53
59
|
version_requirements: !ruby/object:Gem::Requirement
|
54
60
|
requirements:
|
55
61
|
- - "~>"
|
56
62
|
- !ruby/object:Gem::Version
|
57
|
-
version: '2.
|
63
|
+
version: '2.8'
|
58
64
|
- - ">="
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
version: 2.
|
66
|
+
version: 2.8.1
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: faraday-follow_redirects
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,6 +119,9 @@ dependencies:
|
|
113
119
|
- - "~>"
|
114
120
|
- !ruby/object:Gem::Version
|
115
121
|
version: '2.2'
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.2.1
|
116
125
|
type: :runtime
|
117
126
|
prerelease: false
|
118
127
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -120,20 +129,23 @@ dependencies:
|
|
120
129
|
- - "~>"
|
121
130
|
- !ruby/object:Gem::Version
|
122
131
|
version: '2.2'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 2.2.1
|
123
135
|
- !ruby/object:Gem::Dependency
|
124
136
|
name: eac_ruby_gem_support
|
125
137
|
requirement: !ruby/object:Gem::Requirement
|
126
138
|
requirements:
|
127
139
|
- - "~>"
|
128
140
|
- !ruby/object:Gem::Version
|
129
|
-
version: '0.
|
141
|
+
version: '0.10'
|
130
142
|
type: :development
|
131
143
|
prerelease: false
|
132
144
|
version_requirements: !ruby/object:Gem::Requirement
|
133
145
|
requirements:
|
134
146
|
- - "~>"
|
135
147
|
- !ruby/object:Gem::Version
|
136
|
-
version: '0.
|
148
|
+
version: '0.10'
|
137
149
|
description:
|
138
150
|
email:
|
139
151
|
executables: []
|