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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f24dacf51cf8f55435942b5231ce6e6951f3ff44
4
- data.tar.gz: 1cb423b4f3bda7fcffe04c30463297671c412647
3
+ metadata.gz: f7d239752f4f1dddd6b9f7a5736cd97ab75d5784
4
+ data.tar.gz: 75708929d2d69e54453d983d61f6e07a4c19384e
5
5
  SHA512:
6
- metadata.gz: 9101af5e85d789664c8cc42bbc67f500f78fd39b03ae8c32d1e52f6b9a18e57f992d5adf86c3f09f45bf3ffd21dc0e7cd2acb273f035af5f84e6955268bb82d7
7
- data.tar.gz: 73081c0c81003c7b11b1d21be028347bfa78cd923e0ce04bcbc3f78709fd17a214f23f1573e3dcd9530421154aae8982edae35aace9ce31b9f34213f0d571bee
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:failed" depending on if an exception was raised or not
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.1.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"
@@ -2,7 +2,7 @@ class Bizness::Configuration
2
2
  attr_writer :filters
3
3
 
4
4
  def initialize
5
- @filters = []
5
+ @filters = [Bizness::Filters::ActiveRecordTransactionFilter, Bizness::Filters::EventFilter]
6
6
  end
7
7
 
8
8
  def filters
@@ -1,8 +1,10 @@
1
1
  module Bizness::Filters
2
2
  class EventFilter < Bizness::Filters::BaseFilter
3
3
  def call
4
- Hey.publish!("#{event_name}:executed", payload) do
5
- evented_call
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!("#{event_name}:#{successful? ? "succeeded" : "failed"}", payload(result))
15
+ Hey.publish!(successful? ? "succeeded" : "aborted", payload(result))
14
16
  rescue => e
15
- Hey.publish!("#{event_name}:failed", payload.merge(error: e.message))
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)
@@ -14,6 +14,10 @@ module Bizness::Operation
14
14
  error.nil?
15
15
  end
16
16
 
17
+ def aborted?
18
+ !successful?
19
+ end
20
+
17
21
  def to_h
18
22
  {}
19
23
  end
@@ -1,3 +1,3 @@
1
1
  module Bizness
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.1
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-08-14 00:00:00.000000000 Z
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.1.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.1.0
40
+ version: 0.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement