pub_sub_model_sync 0.5.9 → 0.5.9.1

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: cb036497d0e5f977a99a7a4b18b766ae910ed8f72775deac8b5e4d862277085b
4
- data.tar.gz: 3eac2629bf814e169199bd95fece47eaf032d10a7a2e311a81e46d50255947b2
3
+ metadata.gz: 585431eec8ef5f6f9d4b0ccea9069d03ea2849d94f7a8f43464f588da8cfae6c
4
+ data.tar.gz: 4ebf42b8ca72c0bf150f3c27a9ca9b791532954deb1663c571927324be952589
5
5
  SHA512:
6
- metadata.gz: 1e34579693469d286ed7fdb6346ac4e4bdf3c000f98d96a4a4b143a0c9c71b3d5df7c441e9069bea4661f5ac7ea8bf2db41f5ad8c55e41a66585602a4bb3d275
7
- data.tar.gz: f13e18fe535720ca299dcd65f76a24c3aae44df0dd3e2515adf5c3095f21d19ad5f16246447d7b15f4c03867495c36b18869cde78e6fbaec573493d340890db6
6
+ metadata.gz: 1f0c786ff6de119c0add336c0182158f4c5ab3b9b74d2f9e3f180b3753ac288ecc8e2c6c88149ad82a627691c924f049eeb5e02c39280ec7ce3d04831b99dd18
7
+ data.tar.gz: f7ae9286d95af747dd8bd5e21c5f4f87e8aec469077663782103738f7ae9d07fa39b4884f5741e572f17b57a1ce6c358fe8ded7334451aa703559b7367218653
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ # 0.5.9.1 (February 10, 2021)
4
+ - feat: move :key into headers
5
+
3
6
  # 0.5.9 (February 10, 2021)
4
7
  - feat: reformat :publish and :process methods to include non silence methods
5
8
  - feat: add notification key to payloads (can be used for caching strategies)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pub_sub_model_sync (0.5.9)
4
+ pub_sub_model_sync (0.5.9.1)
5
5
  rails
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ module PubSubModelSync
12
12
  # @param data (Hash): Data to be delivered
13
13
  # @param action (:symbol): action name
14
14
  def publish_data(klass, data, action)
15
- attrs = { klass: klass.to_s, action: action.to_sym, key: [klass.to_s, action].join('/') }
15
+ attrs = { klass: klass.to_s, action: action.to_sym }
16
16
  payload = PubSubModelSync::Payload.new(data, attrs)
17
17
  publish(payload)
18
18
  end
@@ -6,7 +6,8 @@ module PubSubModelSync
6
6
  attr_reader :data, :attributes, :headers
7
7
 
8
8
  # @param data (Hash: { any value }):
9
- # @param attributes (Hash: { klass*: string, action*: :sym, key?: string }):
9
+ # @param attributes (Hash: { klass*: string, action*: :sym }):
10
+ # @param headers (Hash: { key?: string, ...any_key?: anything }):
10
11
  def initialize(data, attributes, headers = {})
11
12
  @data = data
12
13
  @attributes = attributes
@@ -68,6 +69,7 @@ module PubSubModelSync
68
69
  def build_headers
69
70
  headers[:uuid] ||= SecureRandom.uuid
70
71
  headers[:app_key] ||= PubSubModelSync::Config.subscription_key
72
+ headers[:key] ||= [klass.to_s, action].join('/')
71
73
  end
72
74
 
73
75
  def validate!
@@ -13,7 +13,8 @@ module PubSubModelSync
13
13
 
14
14
  # Builds the payload with model information defined for :action (:create|:update|:destroy)
15
15
  def payload(model, action)
16
- PubSubModelSync::Payload.new(payload_data(model), payload_attrs(model, action))
16
+ headers = { key: [model.class.name, action, model.id].join('/') }
17
+ PubSubModelSync::Payload.new(payload_data(model), payload_attrs(model, action), headers)
17
18
  end
18
19
 
19
20
  private
@@ -32,8 +33,7 @@ module PubSubModelSync
32
33
  def payload_attrs(model, action)
33
34
  {
34
35
  klass: (as_klass || model.class.name).to_s,
35
- action: action.to_sym,
36
- key: [model.class.name, action, model.id].join('/')
36
+ action: action.to_sym
37
37
  }
38
38
  end
39
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PubSubModelSync
4
- VERSION = '0.5.9'
4
+ VERSION = '0.5.9.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pub_sub_model_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen