dispatch-rider 2.0.0 → 2.1.0

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: 04bd4129729bcc4dde07208deabe117e052c1eb4fa22231932b12a244f9023eb
4
- data.tar.gz: 9235bd4599a819cd6e1b62a95a90e06e28970e6594a361628c64542005486cca
3
+ metadata.gz: b8cefb6d56d04893f7ce7a4fc75dbd57f1c1148efac30e40ebd415190c480be6
4
+ data.tar.gz: 84f3c1c18b51123a08434e6c389521d6ea30760bf5823d72178c699d36de38b4
5
5
  SHA512:
6
- metadata.gz: 4dc3ad18550e07953004269e63c4d377bd462435c4e8653ba40fcd03e4a9df1d462fe9bbc43f1b8718ee0788e4e550d5975a6cc08cf4662f7b0884c140bb2541
7
- data.tar.gz: 8fafaafe38c362712a164509a608d74cf76b063e1a8a86de25eff5f227883b0067131d5f8bcbd9b4cb08bfb058a498215a032b11b1d4adde3c3201dfa4ddc027
6
+ metadata.gz: a52539c08456b5296f16cb02ce3e4c324307d23ae5bf4805a25ce1c5e437b0127dca7619a77f7957311657b16387d8d267f14fd0b85399b29a868f8ea7101727
7
+ data.tar.gz: 49b41b85fb54f6454cef746095291484533f44cf8eaab3f536b63d2ab130279cacb3219b2aec6286cf50818fc71ec6f15f59f87d94043157e5700754fefde0d9
@@ -16,8 +16,9 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  ruby:
19
+ - 3.1
20
+ - '3.0'
19
21
  - 2.7
20
- - 2.6
21
22
  awssdk:
22
23
  - v1
23
24
  - v3
@@ -27,10 +28,10 @@ jobs:
27
28
  - Gemfile-6-1
28
29
  - Gemfile-7-0
29
30
  exclude:
30
- - gemfile: Gemfile-7-0
31
- ruby: 2.6
32
31
  - gemfile: Gemfile-5-2
33
- ruby: 3.0
32
+ ruby: 3.1
33
+ - gemfile: Gemfile-5-2
34
+ ruby: '3.0'
34
35
 
35
36
  env:
36
37
  AWS_SDK_VER: ${{ matrix.awssdk }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.1.0](https://github.com/payrollhero/dispatch-rider/tree/v2.1.0) (2022-09-20)
4
+ [Full Changelog](https://github.com/payrollhero/dispatch-rider/compare/v2.0.0...v2.1.0)
5
+
6
+ * Added support for ruby 3.0 and 3.1
7
+ * Require ruby 2.7 at the very minimum, there is a meta-programming class with kwards between 2.6 and 3.0
8
+ since 2.6 is not unsupported, support is removed
9
+
3
10
  ## [v2.0.0](https://github.com/payrollhero/dispatch-rider/tree/v2.0.0) (2022-09-20)
4
11
  [Full Changelog](https://github.com/payrollhero/dispatch-rider/compare/v1.9.0...v2.0.0)
5
12
 
@@ -38,7 +38,7 @@ Gem::Specification.new do |gem|
38
38
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
39
39
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
40
40
  gem.require_paths = ['lib']
41
- gem.required_ruby_version = '>= 2.6.5'
41
+ gem.required_ruby_version = '>= 2.7.2'
42
42
 
43
43
 
44
44
  gem.add_runtime_dependency 'activesupport', '>= 5.2.0'
@@ -72,7 +72,7 @@ module DispatchRider
72
72
  end
73
73
 
74
74
  def translated_message
75
- translator.translate(message, kind, options)
75
+ translator.translate(message, kind, **options)
76
76
  end
77
77
 
78
78
  def interjected_message
@@ -2,7 +2,7 @@ module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
4
  class BaseTranslator
5
- def initialize(message, **)
5
+ def initialize(message)
6
6
  @message = message
7
7
  end
8
8
 
@@ -11,7 +11,7 @@ module DispatchRider
11
11
 
12
12
  def configure_notification_services(notification_services, publisher)
13
13
  notification_services.each do |service|
14
- publisher.register_notification_service(service.name, service.options)
14
+ publisher.register_notification_service(service.name, **service.options)
15
15
  end
16
16
  end
17
17
 
@@ -35,23 +35,17 @@ module DispatchRider
35
35
  self
36
36
  end
37
37
 
38
- # @param [Hash] original_options should contain `:destinations` and `:message` keys
39
- def publish(original_options = {})
40
- options = build_publish_options(original_options)
41
-
42
- callbacks.invoke(:publish, options) do
38
+ def publish(message:, destinations:)
39
+ options = { message: build_message(message), destinations: destinations }
40
+ callbacks.invoke(:publish, **options) do
43
41
  service_channel_mapper.map(options.delete(:destinations)).each do |(service, channels)|
44
- notification_service_registrar.fetch(service).publish(options.merge to: channels)
42
+ notification_service_registrar.fetch(service).publish(**(options.merge to: channels))
45
43
  end
46
44
  end
47
45
  end
48
46
 
49
47
  private
50
48
 
51
- def build_publish_options(message:, destinations:)
52
- { message: build_message(message), destinations: destinations }
53
- end
54
-
55
49
  def build_message(attributes)
56
50
  DispatchRider::Message.new(attributes).tap do |message|
57
51
  message.body[:guid] ||= generate_new_message_id
@@ -1,4 +1,4 @@
1
1
  # This file specifies the current version of the gem.
2
2
  module DispatchRider
3
- VERSION = '2.0.0'
3
+ VERSION = '2.1.0'
4
4
  end
@@ -55,7 +55,11 @@ describe DispatchRider::Publisher::ConfigurationReader do
55
55
  end
56
56
 
57
57
  it "calls register_notification_service with :file_system and {}" do
58
- expect(publisher).to receive(:register_notification_service).with("file_system", {})
58
+ if RUBY_VERSION > '3'
59
+ expect(publisher).to receive(:register_notification_service).with("file_system").once
60
+ else
61
+ expect(publisher).to receive(:register_notification_service).with("file_system", {}).once
62
+ end
59
63
  subject.load_config(configuration, publisher)
60
64
  end
61
65
  end
@@ -71,8 +75,13 @@ describe DispatchRider::Publisher::ConfigurationReader do
71
75
  end
72
76
 
73
77
  it "calls register_notification_service with :file_system and {}, as well as :foo, {bar: '123'}" do
74
- expect(publisher).to receive(:register_notification_service).with("file_system", {})
75
- expect(publisher).to receive(:register_notification_service).with("foo", "bar" => "123")
78
+ if RUBY_VERSION > '3'
79
+ expect(publisher).to receive(:register_notification_service).with("file_system").once
80
+ expect(publisher).to receive(:register_notification_service).with("foo", bar: "123").once
81
+ else
82
+ expect(publisher).to receive(:register_notification_service).with("file_system", {}).once
83
+ expect(publisher).to receive(:register_notification_service).with("foo", "bar" => "123").once
84
+ end
76
85
  subject.load_config(configuration, publisher)
77
86
  end
78
87
  end
@@ -135,25 +135,16 @@ describe DispatchRider::Publisher do
135
135
  describe "calls publish callback" do
136
136
  describe "calls the publish callback" do
137
137
  let(:publish_callback) { double :callback }
138
- let(:expected_message) {
139
- DispatchRider::Message.new(
140
- subject: "bar_handler",
141
- body: {
142
- "bar" => "baz",
143
- guid: "test-mode-not-random-guid"
144
- }
145
- )
146
- }
147
138
 
148
139
  before { DispatchRider.config.callbacks.for(:publish) << publish_callback }
149
140
 
150
141
  after { DispatchRider.config.callbacks.for(:publish).delete publish_callback }
151
142
 
152
143
  example do
153
- expect(publish_callback).to receive(:call).with any_args, # first argument is the inner job
154
- destinations: [:fs_foo],
155
- message: expected_message
156
-
144
+ expect(publish_callback).to receive(:call).with(
145
+ an_instance_of(Proc), # first argument is the inner job
146
+ { destinations: [:fs_foo],
147
+ message: an_instance_of(DispatchRider::Message) })
157
148
  publisher.publish destinations: [:fs_foo],
158
149
  message: {
159
150
  subject: "bar_handler",
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'bundler/setup'
4
4
 
5
5
  require 'simplecov'
6
+ SimpleCov.minimum_coverage 85
6
7
  require 'coveralls'
7
8
 
8
9
  if RUBY_VERSION < "3.1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dispatch-rider
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suman Mukherjee
@@ -469,14 +469,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
469
469
  requirements:
470
470
  - - ">="
471
471
  - !ruby/object:Gem::Version
472
- version: 2.6.5
472
+ version: 2.7.2
473
473
  required_rubygems_version: !ruby/object:Gem::Requirement
474
474
  requirements:
475
475
  - - ">="
476
476
  - !ruby/object:Gem::Version
477
477
  version: '0'
478
478
  requirements: []
479
- rubygems_version: 3.3.5
479
+ rubygems_version: 3.2.33
480
480
  signing_key:
481
481
  specification_version: 4
482
482
  summary: Messaging system that is customizable based on which queueing system we are