eventq_base 1.11.0 → 1.11.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
  SHA1:
3
- metadata.gz: 55bfca8c289dc31fe34c656dd219688618f8bc9b
4
- data.tar.gz: 5f5ba0d0cc0ba58d448156b4644f0cfbb31424c0
3
+ metadata.gz: 6a3d376ae2e2fdc9f58fa988b19ad2561783525f
4
+ data.tar.gz: 4e7ebfe60ebbead6cc03571a6572e47bfa10acf1
5
5
  SHA512:
6
- metadata.gz: cc507cd5ccfaa243784e918fa205b00a1f2f97bc3c6a82d4ee6d4ee16f3bf114f7ed72ede9a01bb314a37011181a0aa7bcfe3b97ef934c97bff06e98bf58f723
7
- data.tar.gz: 5a1985feb73bddebe473e31cd31f905364a3378806cc603a29d472eb535133ffd6203bbb54e582e473dec7363713e9bd158d89f44f3ae1e3588b5aaf4241c4dc
6
+ metadata.gz: b9891d45f66b897e69b8e6fbf33b25e77d1c0ac50bc4ac4206aad0dd990b3a8128b0769ffcae69a255f7282e60e0adb652673695ab48902421d94f41ef458a95
7
+ data.tar.gz: b4f10cbd713aa9432389cefd9bd87a69d23dedc1e2c0ee9824c50fb7f05b685509054fac064be718953c44fd5928482e8643438bc0133440cdfd353df596bb1f
@@ -15,5 +15,14 @@ module EventQ
15
15
  @id = SecureRandom.uuid
16
16
  end
17
17
 
18
+ # Creates a signature for the message
19
+ #
20
+ # @param provider [EventQ::SignatureProviders::Sha256SignatureProvider] Signature provider that implements
21
+ # a write method
22
+ def sign(provider)
23
+ return unless EventQ::Configuration.signature_secret
24
+
25
+ self.signature = provider.write(message: self, secret: EventQ::Configuration.signature_secret)
26
+ end
18
27
  end
19
28
  end
@@ -8,14 +8,19 @@ module EventQ
8
8
  end
9
9
 
10
10
  def serialize(object)
11
- hash = @hash_helper.to_hash(object)
12
- return JSON.dump(hash)
11
+ JSON.dump(object_to_hash(object))
13
12
  end
14
13
 
15
14
  def deserialize(json)
16
15
  return @class_kit_helper.from_json(json: json, klass: EventQ::QueueMessage)
17
16
  end
18
17
 
18
+ private
19
+
20
+ def object_to_hash(object)
21
+ return object if object.is_a?(Hash)
22
+ @hash_helper.to_hash(object)
23
+ end
19
24
  end
20
25
  end
21
- end
26
+ end
@@ -6,7 +6,7 @@ module EventQ
6
6
  class Sha256SignatureProvider
7
7
 
8
8
  def initialize
9
- @serializer = EventQ::SerializationProviders::JsonSerializationProvider.new
9
+ @serializer = serialization_provider_manager.get_provider(EventQ::Configuration.serialization_provider)
10
10
  end
11
11
 
12
12
  #This method is called to create a signature for a message
@@ -22,6 +22,11 @@ module EventQ
22
22
  message.signature == signature
23
23
  end
24
24
 
25
+ private
26
+
27
+ def serialization_provider_manager
28
+ EventQ::SerializationProviders::Manager.new
29
+ end
25
30
  end
26
31
  end
27
- end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module EventqBase
2
- VERSION = "1.11.0"
2
+ VERSION = "1.11.1"
3
3
  end
data/lib/eventq_base.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'securerandom'
1
2
  require 'class_kit'
2
3
  require 'hash_kit'
3
4
  require 'json_kit'
@@ -22,3 +23,5 @@ require_relative 'eventq_base/nonce_manager'
22
23
  require_relative 'eventq_base/signature_providers'
23
24
  require_relative 'eventq_base/exceptions'
24
25
 
26
+
27
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-24 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler