bug_bunny 0.2.1 → 0.2.3

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: 5f24c30a1e78bdb83a3f2a10eeafd1c4a4fa5f194b9edd773046ae1501c5230a
4
- data.tar.gz: 9db7b2c82bca85a20c928c749c665ed5fc6ce9db4e0d53193bb106de2f61ccb1
3
+ metadata.gz: 44a4635e06b113a429bf55f1d1d9d26ecd106fdfe9bd91d2feb975352f5905a1
4
+ data.tar.gz: 1006a577430270652be5f21a8215dea9777f423b85fdc2f699c1903560ea2864
5
5
  SHA512:
6
- metadata.gz: 8e2d31f049a5fcf696ca297e2e1b27071d3574c20093ec5b04ce8cbcbb2637817032bca33c31fd5c391bc842ac109e0f75adaf5a1ac9594e8069b9f6e0e94451
7
- data.tar.gz: c471e33bd09d218aa9cbcf0b371211630aa6b1877285f8b6a275e69c4ffb47e4372e0fd4c91ef3caf2f34181e2a058c3ebba4fc378b39e4061d255f927b96673
6
+ metadata.gz: 84699963ef67a52f7c50b0e934818d17ee6fb0e177594d99d4f11fd522e88475cc3bbf229285011e9b5e6e6d92b9225fe1700d796b3778a66eb5b9d7f15badd1
7
+ data.tar.gz: 28e10b78f4def1df46779b0abac6624ee1ead627d0c992c2b3eec97cb770d8344bcce4568eb7e4f5592995fb5970fb1995606523c37a70cfd8e9992680baa590
@@ -17,10 +17,9 @@ module BugBunny
17
17
  :logger,
18
18
  :time_to_wait,
19
19
  :communication_response,
20
- :service_message,
21
- :consume_response
20
+ :service_message
22
21
 
23
- def initialize
22
+ def initialize(attrs = {})
24
23
  @logger = Logger.new('./log/bug_bunny.log', 'monthly')
25
24
  @communication_response = ::BugBunny::Response.new status: false
26
25
  @time_to_wait = 2
@@ -278,7 +277,7 @@ module BugBunny
278
277
 
279
278
  def make_response
280
279
  if communication_response.success?
281
- consume_response || communication_response
280
+ service_message || communication_response
282
281
  else
283
282
  communication_response.response = communication_response.response.to_s
284
283
  communication_response
@@ -344,41 +343,5 @@ module BugBunny
344
343
  close_connection!
345
344
  raise Exception::ComunicationRabbitError.new(COMUNICATION_ERROR, e.backtrace)
346
345
  end
347
-
348
- def self.health_check(request: nil)
349
- message_to_publish = ::BugBunny::Message.new(service_action: self::SERVICE_HEALTH_CHECK, body: {})
350
-
351
- request ||= self::ROUTING_KEY_SYNC_REQUEST
352
-
353
- begin
354
- service_adapter = new
355
- sync_queue = service_adapter.build_queue(
356
- request,
357
- self::QUEUES_PROPS[self::ROUTING_KEY_SYNC_REQUEST]
358
- )
359
- rescue ::BugBunny::Exception::ComunicationRabbitError => e
360
- (service_adapter ||= nil).try(:close_connection!)
361
- return ::BugBunny::Response.new(status: false, response: e.message)
362
- end
363
-
364
- service_adapter.publish_and_consume!(message_to_publish, sync_queue, check_consumers_count: true)
365
-
366
- service_adapter.close_connection! # ensure the adapter is close
367
-
368
- if service_adapter.communication_response.success?
369
- msg = service_adapter.service_message
370
-
371
- result = case msg.status
372
- when 'success'
373
- { status: true }
374
- when 'error', 'critical'
375
- { status: false }
376
- end
377
-
378
- service_adapter.consume_response = ::BugBunny::Response.new(result)
379
- end
380
-
381
- service_adapter.make_response
382
- end
383
346
  end
384
347
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BugBunny
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bug_bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - gabix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-23 00:00:00.000000000 Z
11
+ date: 2024-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny