network-client 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/network-client/core.rb +11 -3
- data/lib/network-client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2948c33239606721a0bab258f94eb7ef32c42441
|
4
|
+
data.tar.gz: 897d29f3df3617533a1279843b7a113865c337a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a646e593e940cf06c3b96e232238dc574f7baf75ba4c6f1a668d25c2d169626ab91211ba086eb615cabac64ee9934fb89cd17f2ee93c9bf133dbb12a4d2a5a6
|
7
|
+
data.tar.gz: 89d53050f65e8a84e7fad544b09bf50677e6218c4dc3288b12fca5a0ad60342ec3792ba230578ec01545902572f56347868c38f3546562b48d911b989f605bc1
|
data/Gemfile.lock
CHANGED
data/lib/network-client/core.rb
CHANGED
@@ -47,6 +47,14 @@ module NetworkClient
|
|
47
47
|
request_json :delete, path, params, headers
|
48
48
|
end
|
49
49
|
|
50
|
+
def post_form(path, params = {}, headers = {})
|
51
|
+
raise NotImplementedError
|
52
|
+
end
|
53
|
+
|
54
|
+
def put_form(path, params = {}, headers = {})
|
55
|
+
raise NotImplementedError
|
56
|
+
end
|
57
|
+
|
50
58
|
def set_logger
|
51
59
|
@logger = if defined?(Rails)
|
52
60
|
Rails.logger
|
@@ -96,7 +104,7 @@ module NetworkClient
|
|
96
104
|
request = HTTP_VERBS[http_method].new(full_path, headers)
|
97
105
|
else
|
98
106
|
request = HTTP_VERBS[http_method].new(path, headers)
|
99
|
-
request.
|
107
|
+
request.body = params.to_s
|
100
108
|
end
|
101
109
|
|
102
110
|
response = http_request(request)
|
@@ -104,7 +112,7 @@ module NetworkClient
|
|
104
112
|
when Net::HTTPSuccess
|
105
113
|
true
|
106
114
|
else
|
107
|
-
@logger.error "endpoint responded with a non-success #{code} code."
|
115
|
+
@logger.error "endpoint responded with a non-success #{response.code} code."
|
108
116
|
end
|
109
117
|
|
110
118
|
response
|
@@ -114,7 +122,7 @@ module NetworkClient
|
|
114
122
|
begin
|
115
123
|
tries_count ||= @tries
|
116
124
|
response = @http.request(request)
|
117
|
-
rescue errors_to_recover_by_retry => error
|
125
|
+
rescue *errors_to_recover_by_retry => error
|
118
126
|
@logger.warn(error.message)
|
119
127
|
(tries_count -= 1).zero? ? raise : retry
|
120
128
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: network-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdullah Barrak (abarrak)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|