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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b87af903c38d1e3c2e654750badc4eac551177f0
4
- data.tar.gz: 435ae2a3ba9288673f3773a7cdec993117eba6a6
3
+ metadata.gz: e12573391086ba018391de63e2703189fa21f7bf
4
+ data.tar.gz: b376a64d0723349675512b8e8d926dccaed3fa15
5
5
  SHA512:
6
- metadata.gz: 77fa759d80d7357d7f597fe1d1e8987f3f0155af567bbb39eb2ac1fd4514b2a247e7e27cb2d41dc6e2c9135ee7bf16221d4ec388247fd487098d07e9e8e38a32
7
- data.tar.gz: 69125321d1a8de3c3a48a9fe92539c9fb632f62f562d5a88dc62ba72d61380682ab213960f5b83f7965b835e1e36e2011334757747eb42641331bc538a6d51c5
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 # -> { _total_price: 50 }
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[:_product]
245
+ product = event.extras[:product]
246
246
  product.update(quantity: product.quantity - event.payload[:quantity])
247
247
  end
248
248
 
@@ -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.
@@ -5,6 +5,6 @@ module Evnt
5
5
  ##
6
6
  # Constant containing the current gem version.
7
7
  ##
8
- VERSION = '2.1.1'
8
+ VERSION = '2.1.2'
9
9
 
10
10
  end
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.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-08 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler