evnt 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/evnt/event.rb +5 -1
- data/lib/evnt/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: e12573391086ba018391de63e2703189fa21f7bf
|
4
|
+
data.tar.gz: b376a64d0723349675512b8e8d926dccaed3fa15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5ee8bdee8f68cfde020eb0c08586ed534739917c034e569b77df8776f78098ce89aa6e183aaf3a72fa0dddbda6778b45bb2f1ca83bd8e3bd831cca79292f1ba
|
7
|
+
data.tar.gz: c0cbbe7b83fa74c6088fb5297277b533327eaf2f730113a6e4a862e59c5c7f213984c4a7c5d1d65b1aabea474ee34be40937ce1a9a9fb0960ca5101a56697803
|
data/README.md
CHANGED
@@ -210,7 +210,7 @@ event = CreateOrderEvent.new(
|
|
210
210
|
)
|
211
211
|
|
212
212
|
puts event.payload # -> { order_id: 1, user_id: 128, product_id: 534, quantity: 10, evnt: { timestamp: 2017010101, name: 'create_order' } }
|
213
|
-
puts event.extras # -> {
|
213
|
+
puts event.extras # -> { total_price: 50 }
|
214
214
|
```
|
215
215
|
|
216
216
|
After the execution of the **to_write_event** block the event object should notify all its handlers.
|
@@ -242,7 +242,7 @@ class ProductHandler < Evnt::Handler
|
|
242
242
|
|
243
243
|
to_update_queries do
|
244
244
|
# update product quantity
|
245
|
-
product = event.extras[:
|
245
|
+
product = event.extras[:product]
|
246
246
|
product.update(quantity: product.quantity - event.payload[:quantity])
|
247
247
|
end
|
248
248
|
|
data/lib/evnt/event.rb
CHANGED
@@ -75,10 +75,14 @@ module Evnt
|
|
75
75
|
payload = params.reject { |k, _v| k[0] == '_' }
|
76
76
|
@payload = @state[:reloaded] ? payload : _generate_payload(payload)
|
77
77
|
|
78
|
+
# set extras
|
79
|
+
@extras = {}
|
80
|
+
extras = params.select { |k, _v| k[0] == '_' }
|
81
|
+
extras.each { |k, v| @extras[k[1..-1].to_sym] = v }
|
82
|
+
|
78
83
|
# set other datas
|
79
84
|
@name = self.class._name
|
80
85
|
@attributes = self.class._attributes
|
81
|
-
@extras = params.select { |k, _v| k[0] == '_' }
|
82
86
|
end
|
83
87
|
|
84
88
|
# This function generates the complete event payload.
|
data/lib/evnt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evnt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ideonetwork
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|