Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Commit c5b5a83

Browse files
François GuillotMrYawe
authored andcommitted
Add 'event_data' property when sending event
1 parent bf042b7 commit c5b5a83

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
### Changes
1010
- Fix symbol json encoding breaking compatibility with some gems
1111

12+
### Added
13+
- Added `event_data` property when sending event
14+
1215
## [0.4.0] - 2019-03-25
1316
### Added
1417
- Calling `#dispatch` on tasks now allows to process tasks asynchronously

lib/zenaton/client.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ class Client
3333

3434
PROG = 'Ruby' # The current programming language
3535

36-
EVENT_INPUT = 'event_input' # Parameter name for event data
36+
EVENT_INPUT = 'event_input' # Parameter name for event input
3737
EVENT_NAME = 'event_name' # Parameter name for event name
38+
EVENT_DATA = 'event_data' # Parameter name for event data
3839

3940
WORKFLOW_KILL = 'kill' # Worker update mode to stop a worker
4041
WORKFLOW_PAUSE = 'pause' # Worker udpate mode to pause a worker
@@ -174,7 +175,8 @@ def send_event(workflow_name, custom_id, event)
174175
ATTR_NAME => workflow_name,
175176
ATTR_ID => custom_id,
176177
EVENT_NAME => event.class.name,
177-
EVENT_INPUT => @serializer.encode(@properties.from(event))
178+
EVENT_INPUT => @serializer.encode(@properties.from(event)),
179+
EVENT_DATA => @serializer.encode(event)
178180
}
179181
@http.post(send_event_url, body)
180182
end

spec/zenaton/client_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,14 @@
418418
'name' => 'MyWorkflow',
419419
'custom_id' => 'MyCustomId',
420420
'event_name' => 'FakeEvent',
421-
'event_input' => { 'o' => '@zenaton#0', 's' => [{ 'a' => {} }] }.to_json
421+
'event_input' => {
422+
'o' => '@zenaton#0',
423+
's' => [{ 'a' => {} }]
424+
}.to_json,
425+
'event_data' => {
426+
'o' => '@zenaton#0',
427+
's' => [{ 'n' => 'FakeEvent', 'p' => {} }]
428+
}.to_json
422429
}
423430
end
424431

0 commit comments

Comments
 (0)