zenaton 0.4.1 → 0.4.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
  SHA256:
3
- metadata.gz: 6e51aae796ecf047bcbc9c4b3b4e4fd971191a1ebee24075b9576df8248c9c3a
4
- data.tar.gz: a53ce602e5edeab270bebb30b11d108c568c35e1994002376989d1e9a1ce1f3d
3
+ metadata.gz: 5193a41e1e744fd9b64001ab65fdbfaa793780dddd9ba18a4e6fa4265a3ae6c7
4
+ data.tar.gz: 45c818b476ba46ffb22023015b10555a60f91528ef2d8e51770d429663213f0e
5
5
  SHA512:
6
- metadata.gz: 51cef86daef5b85dd46fbc4d98305d58ad277b4ee36360266a66268ecc86a9ec1fd5d3bc1ec0c0e1702af33c1f2998471f80828f52d9e88f5425512d2767d4f5
7
- data.tar.gz: 73230ed0fa51c178553ed28a39d24f21841b2f825d558453733de02c71a871a7ca29bfb65bd734f7d0f9db71f4e6035f24f5253bd5eec51f7dfdbd951e0e22a4
6
+ metadata.gz: bddc36983a08704fab6c903c40dc6edd8691f593e7eedca72078be15ce77d25b571fbd1ad9d4340b2277fc7f0760ab9b959a306c89f41000f55cb3ecb2e1a17f
7
+ data.tar.gz: f9019cd0975a6d8f013f7516b8df0aac07194b1bf04e3fa9ee48ca9932b94623e557796ebb2cd283393426d009a2c38434d25576b47da8c662d6e155f40fbbd4
data/.circleci/config.yml CHANGED
@@ -54,6 +54,10 @@ jobs:
54
54
  <<: *shared
55
55
  docker:
56
56
  - image: circleci/ruby:2.5
57
+ "ruby-2.6":
58
+ <<: *shared
59
+ docker:
60
+ - image: circleci/ruby:2.6
57
61
 
58
62
  workflows:
59
63
  version: 2
@@ -62,3 +66,4 @@ workflows:
62
66
  - "ruby-2.3"
63
67
  - "ruby-2.4"
64
68
  - "ruby-2.5"
69
+ - "ruby-2.6"
data/CHANGELOG.md CHANGED
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
 
10
10
  ### Added
11
11
 
12
+ ### Fixed
13
+
14
+ ## [0.4.2] - 2019-08-05
15
+ ### Added
16
+
17
+ - Added `intent_id` when dispatching workflows and tasks, sending events and
18
+ pausing/resuming/stoping workflows.
19
+
20
+ ### Fixed
21
+ - Fixed an error caused by a bad class name serialization when `as_json` is overrided (in rails for example).
22
+
12
23
  ## [0.4.1] - 2019-06-04
13
24
  ### Changes
14
25
  - Fix symbol json encoding breaking compatibility with some gems
@@ -85,7 +96,8 @@ available.
85
96
  ### Added
86
97
  - Initial release.
87
98
 
88
- [Unreleased]: https://github.com/zenaton/zenaton-ruby/compare/v0.4.1...HEAD
99
+ [Unreleased]: https://github.com/zenaton/zenaton-ruby/compare/v0.4.2...HEAD
100
+ [0.4.2]: https://github.com/zenaton/zenaton-ruby/compare/v0.4.1...v0.4.2
89
101
  [0.4.1]: https://github.com/zenaton/zenaton-ruby/compare/v0.4.0...v0.4.1
90
102
  [0.4.0]: https://github.com/zenaton/zenaton-ruby/compare/v0.3.1...v0.4.0
91
103
  [0.3.1]: https://github.com/zenaton/zenaton-ruby/compare/v0.3.0...v0.3.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zenaton (0.4.1)
4
+ zenaton (0.4.2)
5
5
  activesupport
6
6
  tzinfo-data
7
7
 
@@ -73,7 +73,7 @@ GEM
73
73
  timecop (0.9.1)
74
74
  tzinfo (1.2.5)
75
75
  thread_safe (~> 0.1)
76
- tzinfo-data (1.2019.1)
76
+ tzinfo-data (1.2019.2)
77
77
  tzinfo (>= 1.0.0)
78
78
  unicode-display_width (1.4.0)
79
79
  vcr (4.0.0)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'securerandom'
3
4
  require 'singleton'
4
5
  require 'zenaton/services/http'
5
6
  require 'zenaton/services/properties'
@@ -22,6 +23,7 @@ module Zenaton
22
23
  APP_ID = 'app_id' # Parameter name for the application ID
23
24
  API_TOKEN = 'api_token' # Parameter name for the API token
24
25
 
26
+ ATTR_INTENT_ID = 'intent_id' # Internal parameter for retries
25
27
  ATTR_ID = 'custom_id' # Parameter name for custom ids
26
28
  ATTR_NAME = 'name' # Parameter name for workflow names
27
29
  ATTR_CANONICAL = 'canonical_name' # Parameter name for version name
@@ -98,11 +100,10 @@ module Zenaton
98
100
  # Start a single task
99
101
  # @param task [Zenaton::Interfaces::Task]
100
102
  def start_task(task)
101
- max_processing_time = if task.respond_to?(:max_processing_time)
102
- task.max_processing_time
103
- end
103
+ max_processing_time = task.try(:max_processing_time)
104
104
  @http.post(
105
105
  worker_url('tasks'),
106
+ ATTR_INTENT_ID => SecureRandom.uuid,
106
107
  ATTR_PROG => PROG,
107
108
  ATTR_NAME => class_name(task),
108
109
  ATTR_DATA => @serializer.encode(@properties.from(task)),
@@ -115,6 +116,7 @@ module Zenaton
115
116
  def start_workflow(flow)
116
117
  @http.post(
117
118
  instance_worker_url,
119
+ ATTR_INTENT_ID => SecureRandom.uuid,
118
120
  ATTR_PROG => PROG,
119
121
  ATTR_CANONICAL => canonical_name(flow),
120
122
  ATTR_NAME => class_name(flow),
@@ -171,6 +173,7 @@ module Zenaton
171
173
  # @return [NilClass]
172
174
  def send_event(workflow_name, custom_id, event)
173
175
  body = {
176
+ ATTR_INTENT_ID => SecureRandom.uuid,
174
177
  ATTR_PROG => PROG,
175
178
  ATTR_NAME => workflow_name,
176
179
  ATTR_ID => custom_id,
@@ -249,6 +252,7 @@ module Zenaton
249
252
  params = { ATTR_ID => custom_id }
250
253
  url = instance_worker_url(params)
251
254
  options = {
255
+ ATTR_INTENT_ID => SecureRandom.uuid,
252
256
  ATTR_PROG => PROG,
253
257
  ATTR_NAME => workflow_name,
254
258
  ATTR_MODE => mode
@@ -26,35 +26,35 @@ module Zenaton
26
26
  # Finds a workflow
27
27
  # @return [Zenaton::Interfaces::Workflow]
28
28
  def find
29
- @client.find_workflow(@klass, @id)
29
+ @client.find_workflow(@klass.to_s, @id)
30
30
  end
31
31
 
32
32
  # Sends an event to a workflow
33
33
  # @param event [Zenaton::Interfaces::Event] the event to send
34
34
  # @return [Zenaton::Query::Builder] the current builder
35
35
  def send_event(event)
36
- @client.send_event(@klass, @id, event)
36
+ @client.send_event(@klass.to_s, @id, event)
37
37
  self
38
38
  end
39
39
 
40
40
  # Stops a workflow
41
41
  # @return [Zenaton::Query::Builder] the current builder
42
42
  def kill
43
- @client.kill_workflow(@klass, @id)
43
+ @client.kill_workflow(@klass.to_s, @id)
44
44
  self
45
45
  end
46
46
 
47
47
  # Pauses a workflow
48
48
  # @return [Zenaton::Query::Builder] the current builder
49
49
  def pause
50
- @client.pause_workflow(@klass, @id)
50
+ @client.pause_workflow(@klass.to_s, @id)
51
51
  self
52
52
  end
53
53
 
54
54
  # Resumes a workflow
55
55
  # @return [Zenaton::Query::Builder] the current builder
56
56
  def resume
57
- @client.resume_workflow(@klass, @id)
57
+ @client.resume_workflow(@klass.to_s, @id)
58
58
  self
59
59
  end
60
60
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zenaton
4
4
  # This gem's current version
5
- VERSION = '0.4.1'
5
+ VERSION = '0.4.2'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenaton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zenaton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-04 00:00:00.000000000 Z
11
+ date: 2019-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport