bbk-http 0.1.0.200749 → 0.1.0.200750
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/bbk/http/publisher.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b829ac8739e29a0fcd3e9e312df2637716cec56f023ff45784148ba3b889f36
|
4
|
+
data.tar.gz: fa6cb4d1060d584836d1af4dd5078910a5fa641896d4d176957b621cfe46c919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b7b0083da74e9dc05b3ffebe184be842a67e7a528b35a6b5b1d3948695f19a8d945f389bd8e0f3b4dfe891492f94e5c713acc1875697e285129d264bb898462
|
7
|
+
data.tar.gz: 05f94c91352f7c2ef86756c845f91401239f66c9b96df3d07fcba72c4cf00e459552c2d5b7fc3cee86d5ebeffe768875524d027bc23b70e82e1e81777e712299
|
data/Gemfile.lock
CHANGED
data/lib/bbk/http/publisher.rb
CHANGED
@@ -13,7 +13,8 @@ module BBK
|
|
13
13
|
Oj::Rails.mimic_JSON
|
14
14
|
|
15
15
|
class PublishError < StandardError
|
16
|
-
|
16
|
+
|
17
|
+
|
17
18
|
DEFAULT_MESSAGE = 'HTTP publishing error'.freeze
|
18
19
|
|
19
20
|
attr_reader :context
|
@@ -72,7 +73,9 @@ module BBK
|
|
72
73
|
headers[CONTENT_TYPE_HEADER] = content_type
|
73
74
|
options = @default_connection_options.merge(options)
|
74
75
|
logger.debug("Connection options: #{options}") if options.present?
|
75
|
-
response = Faraday.new(uri, **options.slice(Faraday::ConnectionOptions.members)).send(
|
76
|
+
response = Faraday.new(uri, **options.slice(Faraday::ConnectionOptions.members)).send(
|
77
|
+
method.to_sym, '', payload, headers
|
78
|
+
)
|
76
79
|
Concurrent::Promises.resolvable_future.tap do |f|
|
77
80
|
data = response.to_hash
|
78
81
|
if response.success?
|
@@ -84,7 +87,10 @@ module BBK
|
|
84
87
|
end
|
85
88
|
rescue Faraday::ConnectionFailed => e
|
86
89
|
logger.error "Faraday connection failed error: #{e.inspect}"
|
87
|
-
Concurrent::Promises.resolvable_future.reject(PublishError.new({cause: e}))
|
90
|
+
Concurrent::Promises.resolvable_future.reject(PublishError.new({ cause: e }))
|
91
|
+
rescue Faraday::Error => e
|
92
|
+
logger.error "Faraday error: #{e.inspect}"
|
93
|
+
Concurrent::Promises.resolvable_future.reject(PublishError.new({ cause: e }))
|
88
94
|
end
|
89
95
|
|
90
96
|
end
|