webhook_system 1.0.3 → 1.0.4

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
  SHA1:
3
- metadata.gz: 9c0a8c510a0ff3b55dc800d604b657c19f85059b
4
- data.tar.gz: 5d165f95a27c935c7eb039724039a0e53c9203ee
3
+ metadata.gz: ab92b0226e4fcb3e5fd0b51f7c263671a26a872d
4
+ data.tar.gz: ebec116d1079659ad550232957c62c365ac30784
5
5
  SHA512:
6
- metadata.gz: 6f3730e9316cb8d8b1148d5c7f4d1dd81dc86e24b15ca009d29933aadd242ff1181062a5b8f7f89a2c7ed515c1efa94e5cc7b0d58e9473d129ec8e1188c5a43b
7
- data.tar.gz: 10a5a58ddc03c9b481377124b0346fef8656f39eb7f12dc7e2003935619f6fc23825c2c4fa40ef7b46d97b2b6bff456af8f9fb8101194832234863453b357e47
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
 
@@ -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
- response = client.builder.build_response(client, request)
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
@@ -1,3 +1,3 @@
1
1
  module WebhookSystem
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  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.3
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-18 00:00:00.000000000 Z
12
+ date: 2016-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport