zenaton 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6a9c77b434d1e5d39b2360c9d5580653820c9a6ed7d0e4cbecc8adc7e1f6dea
4
- data.tar.gz: 4c1ac27216af901b760dd663007f79e6b57b56787fbc2cb6cbc7166eb0173abe
3
+ metadata.gz: f5cce9b70fd66d65689088c10c1d83006828eb43b46cd3dbb4be204a71cea03e
4
+ data.tar.gz: 472e812fd74694cec984751063ee6bd45101427b624fb5e682cc878e3f819f64
5
5
  SHA512:
6
- metadata.gz: aa0e97fa56d7ddf29855763660213f9fb40eda55af32b91984161fcb8d1b8ee3e2c427b18af86b4c2f47902a52f0777125975eaefe4feb87752882526d42432a
7
- data.tar.gz: 7e68f8714d40d9c8fdf52c222dd449c6950e98bf71ab709b0272c1816e871a6a1172537363a72d21d8db0b93d184d63738c476ae9de99c32ba3e49c7552d5872
6
+ metadata.gz: 1d11faf842c2d97c1eb3332acb62f6a0e948fa45bbfbb21cd97c976a9f1d5201281f35799c81f36e90b5ad1785e2a16a7ff9bb9117b022ac0815d544710348ae
7
+ data.tar.gz: 1f080e9eeacd16d09c7b87dfbfbdb846c70fb573990e4721c084be4ec41a5a735b1f6efeb1eae9d332aa63db0765bda7f7443f1a5fae2c7d346d5760d53c32ef
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.0] - 2018-09-24
10
+ ### Changed
11
+ - Rename `on_day` method to `day_of_month`
12
+ - Improve error messages by using the message contained in the API response when
13
+ available.
14
+ - Rescue from new engine error when finding non existing workflow
15
+
9
16
  ## [0.2.3] - 2018-08-13
10
17
  ### Added
11
18
  - Introduce this changelog file.
@@ -47,7 +54,8 @@ serializing.
47
54
  ### Added
48
55
  - Initial release.
49
56
 
50
- [Unreleased]: https://github.com/zenaton/zenaton-ruby/compare/v0.2.3...HEAD
57
+ [Unreleased]: https://github.com/zenaton/zenaton-ruby/compare/v0.3.0...HEAD
58
+ [0.3.0]: https://github.com/zenaton/zenaton-ruby/compare/v0.2.3...v0.3.0
51
59
  [0.2.3]: https://github.com/zenaton/zenaton-ruby/compare/v0.2.2...v0.2.3
52
60
  [0.2.2]: https://github.com/zenaton/zenaton-ruby/compare/v0.2.1...v0.2.2
53
61
  [0.2.1]: https://github.com/zenaton/zenaton-ruby/compare/v0.2.0...v0.2.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zenaton (0.2.3)
4
+ zenaton (0.3.0)
5
5
  activesupport
6
6
  tzinfo-data
7
7
 
@@ -120,17 +120,18 @@ module Zenaton
120
120
 
121
121
  # Finds a workflow
122
122
  # @param workflow_name [String] the class name of the workflow
123
- # @param custom_id [String] the custom ID of the workflow (if any)
124
- # @return [Zenaton::Interfaces::Workflow]
123
+ # @param custom_id [String] the custom ID of the workflow
124
+ # @return [Zenaton::Interfaces::Workflow, nil]
125
125
  def find_workflow(workflow_name, custom_id)
126
- # rubocop:disable Metrics/LineLength
127
- params = "#{ATTR_ID}=#{custom_id}&#{ATTR_NAME}=#{workflow_name}&#{ATTR_PROG}=#{PROG}"
128
- # rubocop:enable Metrics/LineLength
126
+ params = "#{ATTR_ID}=#{custom_id}&#{ATTR_NAME}=#{workflow_name}&#{ATTR_PROG}=#{PROG}" # rubocop:disable Metrics/LineLength
129
127
  data = @http.get(instance_website_url(params))['data']
130
128
  data && @properties.object_from(
131
129
  data['name'],
132
130
  @serializer.decode(data['properties'])
133
131
  )
132
+ rescue Zenaton::InternalError => exception
133
+ return nil if exception.message =~ /No workflow instance found/
134
+ raise exception
134
135
  end
135
136
 
136
137
  # Sends an event to a workflow
@@ -94,7 +94,8 @@ module Zenaton
94
94
  end
95
95
 
96
96
  def format_error(response)
97
- "#{response.code}: #{response.message}"
97
+ message = JSON.parse(response.read_body)['error']
98
+ "#{response.code}: #{message}"
98
99
  end
99
100
 
100
101
  def default_options
@@ -37,7 +37,7 @@ module Zenaton
37
37
  end
38
38
 
39
39
  %i[
40
- timestamp at on_day monday tuesday wednesday thursday
40
+ timestamp at day_of_month monday tuesday wednesday thursday
41
41
  friday saturday sunday
42
42
  ]. each do |method_name|
43
43
  define_method method_name do |value = 1|
@@ -56,8 +56,8 @@ module Zenaton
56
56
  _timestamp(value)
57
57
  elsif method == :at
58
58
  _at(value, now, now_dup)
59
- elsif method == :on_day
60
- _on_day(value, now, now_dup)
59
+ elsif method == :day_of_month
60
+ _day_of_month(value, now, now_dup)
61
61
  else
62
62
  _apply_duration(method, value, now_dup)
63
63
  end
@@ -96,7 +96,7 @@ module Zenaton
96
96
  end
97
97
  end
98
98
 
99
- def _on_day(day, now, now_dup)
99
+ def _day_of_month(day, now, now_dup)
100
100
  _set_mode(MODE_MONTH_DAY)
101
101
  now_dup = now_dup.change(day: day)
102
102
  now_dup += 1.month if now > now_dup
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zenaton
4
4
  # This gem's current version
5
- VERSION = '0.2.3'
5
+ VERSION = '0.3.0'
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.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zenaton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-13 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport