From 7ba2adc75ffed58185860aba29a994a77695fce0 Mon Sep 17 00:00:00 2001 From: Mathieu Jobin Date: Mon, 11 Nov 2019 12:02:35 +0900 Subject: [PATCH] should be able to call dispatch on an event class (#16) --- CHANGELOG.md | 36 +++++++++++++++++++++++++++++++- lib/webhook_system/base_event.rb | 4 ++++ lib/webhook_system/version.rb | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d72bd52..69e05f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,42 @@ # Change Log +## [v2.2.0](https://github.com/payrollhero/webhook_system/tree/v2.2.0) (2019-11-07) +[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.6...v2.2.0) + +* Syntatic sugar: simple dispatch call to also build the event object + +## [v2.1.6](https://github.com/payrollhero/webhook_system/tree/v2.1.6) (2019-07-26) +[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.5...v2.1.6) + +* add account info to error message + +## [v2.1.5](https://github.com/payrollhero/webhook_system/tree/v2.1.5) (2019-07-24) +[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.4...v2.1.5) + +* response body error message in exception + +## [v2.1.4](https://github.com/payrollhero/webhook_system/tree/v2.1.4) (2019-05-10) +[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.3...v2.1.4) + +* Make URL display in Exception message +* Make tests pass again +* Small typo fix by Heath Attig, thank you + +## [v2.1.3](https://github.com/payrollhero/webhook_system/tree/v2.1.3) (2017-12-06) +[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.2...v2.1.3) + +by Ron + +## [v2.1.2](https://github.com/payrollhero/webhook_system/tree/v2.1.2) (2017-01-24) +[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.1...v2.1.2) + +by Piotr + ## [v2.1.1](https://github.com/payrollhero/webhook_system/tree/v2.1.1) (2016-12-20) [Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.1.0...v2.1.1) +by Piotr + ## [v2.1.0](https://github.com/payrollhero/webhook_system/tree/v2.1.0) (2016-07-20) [Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.0.0...v2.1.0) @@ -53,4 +87,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/lib/webhook_system/base_event.rb b/lib/webhook_system/base_event.rb index 9b4fa8d..b7bc16b 100644 --- a/lib/webhook_system/base_event.rb +++ b/lib/webhook_system/base_event.rb @@ -37,6 +37,10 @@ def self.key_is_reserved?(key) key.to_s.in? %w(event event_id) end + def self.dispatch(args) + WebhookSystem::Subscription.global.dispatch self.build(args) + end + private def with_caller_backtrace(exception, backtrack=2) diff --git a/lib/webhook_system/version.rb b/lib/webhook_system/version.rb index 8117b04..b119b08 100644 --- a/lib/webhook_system/version.rb +++ b/lib/webhook_system/version.rb @@ -1,3 +1,3 @@ module WebhookSystem - VERSION = '2.1.6' + VERSION = '2.2.0' end