bizness 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bizness.gemspec +1 -1
- data/lib/bizness/configuration.rb +1 -1
- data/lib/bizness/filters/event_filter.rb +7 -5
- data/lib/bizness/operation.rb +4 -0
- data/lib/bizness/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7d239752f4f1dddd6b9f7a5736cd97ab75d5784
|
4
|
+
data.tar.gz: 75708929d2d69e54453d983d61f6e07a4c19384e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6f5f5a462929326e6164eefd5dc4e411502f9caca5e9dd41d8f143b1a7a2458bd83af070642923829fe8527d22bea90c77023b9f5dc56069c19dea7fb1a33c2
|
7
|
+
data.tar.gz: e496dc6e460437f046080437527e2486a46f9fcd23873191b759a3dc9d764db8bb4d5a08fba504747a8b9f190cc7fdbc5542c278f07085266eae543aa2c043dc
|
data/README.md
CHANGED
@@ -91,7 +91,7 @@ op.to_h
|
|
91
91
|
Automatically publishing operations as events via the `EventFilter` is one of the primary reasons we developed Bizness. The `EventFilter` will always publish two events. For example, if your operation class is named `CompleteRegistrationOperation`, these events will be published:
|
92
92
|
|
93
93
|
* "operations:complete_registration:executed" - This event includes the start time, end time and duration of the operation
|
94
|
-
* "operations:complete_registration:succeeded" or "operations:complete_registration:
|
94
|
+
* "operations:complete_registration:succeeded" or "operations:complete_registration:aborted" depending on if an exception was raised or not
|
95
95
|
|
96
96
|
#### Subscribing
|
97
97
|
|
data/bizness.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "activerecord"
|
22
|
-
spec.add_dependency "hey-pubsub", "~> 0.
|
22
|
+
spec.add_dependency "hey-pubsub", "~> 0.2.0"
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec"
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Bizness::Filters
|
2
2
|
class EventFilter < Bizness::Filters::BaseFilter
|
3
3
|
def call
|
4
|
-
Hey.
|
5
|
-
|
4
|
+
Hey.context(namespace: event_name) do
|
5
|
+
Hey.publish!("executed", payload) do
|
6
|
+
evented_call
|
7
|
+
end
|
6
8
|
end
|
7
9
|
end
|
8
10
|
|
@@ -10,14 +12,14 @@ module Bizness::Filters
|
|
10
12
|
|
11
13
|
def evented_call
|
12
14
|
result = filtered_operation.call
|
13
|
-
Hey.publish!(
|
15
|
+
Hey.publish!(successful? ? "succeeded" : "aborted", payload(result))
|
14
16
|
rescue => e
|
15
|
-
Hey.publish!("
|
17
|
+
Hey.publish!("aborted", payload.merge(error: e.message, stacktrace: e.backtrace, exception: e.class.name))
|
16
18
|
raise e
|
17
19
|
end
|
18
20
|
|
19
21
|
def event_name
|
20
|
-
__original_operation__.class.name.underscore.gsub("/",
|
22
|
+
__original_operation__.class.name.underscore.gsub("/", Hey.configuration.delimiter)
|
21
23
|
end
|
22
24
|
|
23
25
|
def payload(result = nil)
|
data/lib/bizness/operation.rb
CHANGED
data/lib/bizness/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bizness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShippingEasy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|