mimi-messaging 0.1.8 → 0.1.9

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: 571b0eb49b07f329f5c1564a600eb56b833b94d7
4
- data.tar.gz: 52e5a08ec30524364c9ed211f8093e23d5541e38
3
+ metadata.gz: 839a61eb8dc38069954026c340bdbd6a530a8542
4
+ data.tar.gz: faecf24ec54b10447d81b48ca1794438a6d3cf0c
5
5
  SHA512:
6
- metadata.gz: 131f811a3bdf75e7c59ba1aeed43a04a7fbf77eb74a45615b89007761ffa8ef38fe4454146d97b96a9a0be67c40c0de45be1d7df9c3b7a504b168cf7ab63d63b
7
- data.tar.gz: 00f4f9f5caf0fd17e85ef317ff93a1f0d8daf945abffc9238fa16ecda1d2e9965a773bc768c4edf06823f5922aa19e61937b955e9fe2b041556e69a531e4bc90
6
+ metadata.gz: b73ee235bc27d40cba7209e4049fd52f50ab8499a85243053bc12f3e7320d8730ad2072af3a91803354fa0472775ac857c21521b824fd62031d8bee7899363ba
7
+ data.tar.gz: 958de3483a20f933c134b68c0061b632533db04993608f11f75b9b02093017c6e79bee89917b196d56931bb1b52aa8308afeb298474385565450d5ac45d6d099
@@ -7,6 +7,7 @@
7
7
 
8
8
  require_relative 'mock/connection'
9
9
  require_relative 'mock/request_processor'
10
+ require_relative 'mock/request'
10
11
 
11
12
  Mimi::Messaging.send :remove_const, :Connection
12
13
  Mimi::Messaging::Connection = Mimi::Messaging::MockConnection
@@ -0,0 +1,18 @@
1
+ module Mimi
2
+ module Messaging
3
+ class Request
4
+ attr_reader :response
5
+
6
+ def send_response(data = {})
7
+ return if !get? || replied?
8
+ raise ArgumentError, 'Invalid response format, Hash is expected' unless data.is_a?(Hash)
9
+ raw_message = Mimi::Messaging::Message.encode(data)
10
+ @response = Mimi::Messaging::Message.decode(raw_message)
11
+ request_processor.connection.post(
12
+ reply_to_queue_name, raw_message, correlation_id: metadata[:correlation_id]
13
+ )
14
+ @replied = true
15
+ end
16
+ end # class Request
17
+ end # module Messaging
18
+ end # module Mimi
@@ -1,5 +1,5 @@
1
1
  module Mimi
2
2
  module Messaging
3
- VERSION = '0.1.8'.freeze
3
+ VERSION = '0.1.9'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimi-messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kukushkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-22 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -152,6 +152,7 @@ files:
152
152
  - lib/mimi/messaging/message.rb
153
153
  - lib/mimi/messaging/mock.rb
154
154
  - lib/mimi/messaging/mock/connection.rb
155
+ - lib/mimi/messaging/mock/request.rb
155
156
  - lib/mimi/messaging/mock/request_processor.rb
156
157
  - lib/mimi/messaging/model.rb
157
158
  - lib/mimi/messaging/model_provider.rb