bbk-http 0.1.0.200749 → 0.1.0.200752
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: e533966aa616093e48a4ed94e29825c1866f91c1d9a36861616dabcf11c2b61f
|
4
|
+
data.tar.gz: d51123b7ec2c312ebc3f8ef57560c62de17d816690738ee875b9db99afa80edd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 050350b29893bc47ac825c5bebb15beeebf5ca733cb725d285743294fb8c0be4e0b8a0e8061faaa25d78897db92fa10effa5fcfc25ab593ccc5ed31291748b41
|
7
|
+
data.tar.gz: b3a30670e62c9429a80e3797a28a7a48fab00b66fd59c6a1f208aabc1b5fba3dcef24e2e6acb226563965370438bd4deb41cd1a2599fd710e2ac8432907e9d9c
|
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
|