message_bus_client_worker 1.0.0 → 1.1.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: 985339771e8dc4677c05243329c0ad6e870ede8550419450187a7a8ae5f11cfa
4
- data.tar.gz: 1e0b8dcd09be180ef2d3c6dd01414026fbe84f82c30fb90f0ee54231cdaa98b1
3
+ metadata.gz: 560c4dac8cd9a38d137c89279e61752d8a927f4313069754ee09bf2605a31a03
4
+ data.tar.gz: 6d3006363e0daf8dbabe6d66a8884f4e9957f22b008ec3bb236a111d9ee7d313
5
5
  SHA512:
6
- metadata.gz: a40cd6e81d84ad63c7815f36cc68d6b1668dfd1251f41959b4d6e178cb7c2b1751a6425f5a58265f50cc9cd86ffe495c4b5a5bf6615c83d57a98854e3b4fc1e2
7
- data.tar.gz: d527f1486421c47f0883ead97e8776b23ee9d270492ec919ca1049a37f512229e077e63443f2eb77d464c617503369a254edf623ed5419476fba7ec14c19affd
6
+ metadata.gz: b74d6e16af245b641910cfa7f1eb168d342ea8ec8e4e63f30bee77bb95629d9047b69165ad26117372f9d922e5b67eba2f954a8648237b9b1df6da69c38b32ab
7
+ data.tar.gz: e22be9e812ec11b4f76e7d7479013b042fb1968d78e85ceff30f732fc3260b0ccef19a8bffc524dbbfd8b24ae6a0c67d24de3791738f04965aa62aed3155f942
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.1.0] - 2018-02-13
8
+ ### Added
9
+ - Add a third argument support for processor which passes the request headers.
10
+
7
11
  ## [1.0.0] - 2018-02-12
8
12
  ### Changed
9
13
  - Change structure of `subscriptions` config to include headers and channels.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- message_bus_client_worker (1.0.0)
4
+ message_bus_client_worker (1.1.0)
5
5
  activesupport
6
6
  addressable
7
7
  excon
@@ -17,7 +17,7 @@ GEM
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
19
19
  tzinfo (~> 1.1)
20
- addressable (2.5.2)
20
+ addressable (2.6.0)
21
21
  public_suffix (>= 2.0.2, < 4.0)
22
22
  byebug (10.0.2)
23
23
  coderay (1.1.2)
@@ -26,7 +26,7 @@ GEM
26
26
  diff-lcs (1.3)
27
27
  excon (0.62.0)
28
28
  gem_config (0.3.1)
29
- i18n (1.2.0)
29
+ i18n (1.5.3)
30
30
  concurrent-ruby (~> 1.0)
31
31
  light-service (0.11.0)
32
32
  activesupport (>= 3.0)
data/README.md CHANGED
@@ -64,7 +64,7 @@ The processor should look like this:
64
64
 
65
65
  ```ruby
66
66
  class ProcessMessage
67
- def self.call(data, payload)
67
+ def self.call(data, payload, headers)
68
68
  # ...
69
69
  end
70
70
  end
@@ -3,7 +3,15 @@ module MessageBusClientWorker
3
3
  class ProcessPayload
4
4
  extend LightService::Action
5
5
 
6
- expects :host, :subscriptions, :payload
6
+ expects(
7
+ :host,
8
+ :subscriptions,
9
+ :payload,
10
+ :headers
11
+ )
12
+
13
+ TWO_ARGS = 2
14
+ THREE_ARGS = 3
7
15
 
8
16
  executed do |c|
9
17
  payload = c.payload
@@ -13,9 +21,18 @@ module MessageBusClientWorker
13
21
  next c if channel_config.nil?
14
22
 
15
23
  processor_class = Kernel.const_get(channel_config[:processor])
16
-
17
24
  SetLastId.(c.host, channel, payload["message_id"])
18
- processor_class.(payload["data"], payload)
25
+
26
+ data = payload["data"]
27
+
28
+ case processor_class.method(:call).arity
29
+ when TWO_ARGS
30
+ processor_class.(data, payload)
31
+ when THREE_ARGS
32
+ processor_class.(data, payload, c.headers)
33
+ else
34
+ processor_class.(data)
35
+ end
19
36
  end
20
37
 
21
38
  end
@@ -1,3 +1,3 @@
1
1
  module MessageBusClientWorker
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_bus_client_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-12 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config