webhook_system 1.0.3 → 1.0.4
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/webhook_system/job.rb +27 -2
- data/lib/webhook_system/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: ab92b0226e4fcb3e5fd0b51f7c263671a26a872d
|
4
|
+
data.tar.gz: ebec116d1079659ad550232957c62c365ac30784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d78db773737cac39123362eb472dbdbb53f2e7c8b5f157836532f023fe48d7ddc454be64f74fe9bad27c21d86afcda9dae1f9f8d5f8436b808d259a8a4faaf3
|
7
|
+
data.tar.gz: c5aa162d977732bfe5eaa91cc185643cc1db22987fbcc6afa2492e0c1a437a402acfd1b7e118f0832bf40305da911e64f5de4125cfd041c8fbe762c88bcdaa24
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.0.3](https://github.com/payrollhero/webhook_system/tree/v1.0.3) (2016-02-18)
|
4
|
+
[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v1.0.2...v1.0.3)
|
5
|
+
|
6
|
+
- Use updated 'faraday-encoding' gem. [\#7](https://github.com/payrollhero/webhook_system/pull/7) ([mykola-kyryk](https://github.com/mykola-kyryk))
|
7
|
+
|
3
8
|
## [v1.0.2](https://github.com/payrollhero/webhook_system/tree/v1.0.2) (2016-02-17)
|
4
9
|
[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v1.0.1...v1.0.2)
|
5
10
|
|
data/lib/webhook_system/job.rb
CHANGED
@@ -11,6 +11,25 @@ module WebhookSystem
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
# Represents response for an exception we get when doing Faraday http call
|
15
|
+
class ErrorResponse
|
16
|
+
def initialize(exception)
|
17
|
+
@exception = exception
|
18
|
+
end
|
19
|
+
|
20
|
+
def status
|
21
|
+
0 # no HTTP response status as we got an exception while trying to perform the request
|
22
|
+
end
|
23
|
+
|
24
|
+
def headers
|
25
|
+
{}
|
26
|
+
end
|
27
|
+
|
28
|
+
def body
|
29
|
+
[@exception.class.name, @exception.message, *@exception.backtrace].join("\n")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
14
33
|
def perform(subscription, event)
|
15
34
|
self.class.post(subscription, event)
|
16
35
|
end
|
@@ -18,7 +37,14 @@ module WebhookSystem
|
|
18
37
|
def self.post(subscription, event)
|
19
38
|
client = build_client
|
20
39
|
request = build_request(client, subscription, event)
|
21
|
-
|
40
|
+
|
41
|
+
response =
|
42
|
+
begin
|
43
|
+
client.builder.build_response(client, request)
|
44
|
+
rescue Exception => exception # we do want to catch all exceptions
|
45
|
+
ErrorResponse.new(exception)
|
46
|
+
end
|
47
|
+
|
22
48
|
log_response(subscription, event, request, response)
|
23
49
|
ensure_success(response)
|
24
50
|
end
|
@@ -63,6 +89,5 @@ module WebhookSystem
|
|
63
89
|
faraday.adapter Faraday.default_adapter
|
64
90
|
end
|
65
91
|
end
|
66
|
-
|
67
92
|
end
|
68
93
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhook_system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Banasik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-02-
|
12
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|