readymade 0.4.1 → 0.4.3

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: 8f3a8c90117d3207e0e228fdc410d1799955f07bacd3753ab4b721916bd9c6a3
4
- data.tar.gz: 53c6a9b974ab6b3a70d7df5ad60031855bb1228d9a53b1b7f8915b9c28a9df24
3
+ metadata.gz: 76b10ba5747f0f419f053e590e091190bac60bbf3abf7b56b6281d39a65206c5
4
+ data.tar.gz: eb540a076609b60cff82538e0cb99273bdde57919efd4d29f9f1f681b39b15e6
5
5
  SHA512:
6
- metadata.gz: c0907befa7f6054fab2c7cbb899741fd02c4c357f2cf959c248af99c06b78666462dbb22a5aca201f0761471624847ada443187c1520c803243e0a75c38ec458
7
- data.tar.gz: 0cc7164cab6a23ef602a283ff27cd0bcc68a4c7053fa0469b52e499cbdf5ca0d5106dc1b6bd64ba79539b3862bd80c84a18763937e8feb1d2ea9ebc99dbafcfd
6
+ metadata.gz: 2eda9e59123b8730797c9fcefaa093bc9b1bcac092a5299acd7d40022c95567fd52df3981ed1e07615647f97513a56f36fd6ebfb7ab5c5dbb3b5e1ff42ddf5d8
7
+ data.tar.gz: d32d324a671e0104e91edd6e5a6e06147fe47fe34c6a5e2beb6b9f698ff5713be6775196e27e7c275f2f1be7e470c09b2d3b0852252ac56522037b1cb43b6881
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.4.2] - 2025-05-26
5
+
6
+ * Add `job_options.discard_on` argument to `Readymade::BackgroundJob` to discard job on specific exceptions
7
+ * Deprecated `queue_as` argument in `Readymade::BackgroundJob` in favor of `job_options.queue_as`
8
+
4
9
  ## [0.4.1] - 2024-07-15
5
10
 
6
11
  * Add `message` to `Reaymade::UnSuccessError` exception
data/Gemfile.lock CHANGED
@@ -1,42 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- readymade (0.4.1)
4
+ readymade (0.4.3)
5
5
  activejob
6
6
  activemodel
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activejob (7.1.3)
12
- activesupport (= 7.1.3)
11
+ activejob (8.0.2)
12
+ activesupport (= 8.0.2)
13
13
  globalid (>= 0.3.6)
14
- activemodel (7.1.3)
15
- activesupport (= 7.1.3)
16
- activesupport (7.1.3)
14
+ activemodel (8.0.2)
15
+ activesupport (= 8.0.2)
16
+ activesupport (8.0.2)
17
17
  base64
18
+ benchmark (>= 0.3)
18
19
  bigdecimal
19
- concurrent-ruby (~> 1.0, >= 1.0.2)
20
+ concurrent-ruby (~> 1.0, >= 1.3.1)
20
21
  connection_pool (>= 2.2.5)
21
22
  drb
22
23
  i18n (>= 1.6, < 2)
24
+ logger (>= 1.4.2)
23
25
  minitest (>= 5.1)
24
- mutex_m
25
- tzinfo (~> 2.0)
26
- base64 (0.2.0)
27
- bigdecimal (3.1.6)
26
+ securerandom (>= 0.3)
27
+ tzinfo (~> 2.0, >= 2.0.5)
28
+ uri (>= 0.13.1)
29
+ base64 (0.3.0)
30
+ benchmark (0.4.1)
31
+ bigdecimal (3.2.2)
28
32
  byebug (11.1.3)
29
- concurrent-ruby (1.2.3)
30
- connection_pool (2.4.1)
33
+ concurrent-ruby (1.3.5)
34
+ connection_pool (2.5.3)
31
35
  diff-lcs (1.4.4)
32
- drb (2.2.0)
33
- ruby2_keywords
36
+ drb (2.2.3)
34
37
  globalid (1.2.1)
35
38
  activesupport (>= 6.1)
36
- i18n (1.14.1)
39
+ i18n (1.14.7)
37
40
  concurrent-ruby (~> 1.0)
38
- minitest (5.22.1)
39
- mutex_m (0.2.0)
41
+ logger (1.7.0)
42
+ minitest (5.25.5)
40
43
  rake (13.0.6)
41
44
  rspec (3.10.0)
42
45
  rspec-core (~> 3.10.0)
@@ -51,9 +54,10 @@ GEM
51
54
  diff-lcs (>= 1.2.0, < 2.0)
52
55
  rspec-support (~> 3.10.0)
53
56
  rspec-support (3.10.3)
54
- ruby2_keywords (0.0.5)
57
+ securerandom (0.4.1)
55
58
  tzinfo (2.0.6)
56
59
  concurrent-ruby (~> 1.0)
60
+ uri (1.0.3)
57
61
 
58
62
  PLATFORMS
59
63
  ruby
data/README.md CHANGED
@@ -146,7 +146,10 @@ class Orders::Actions::SendNotifications < Readymade::Action
146
146
  end
147
147
 
148
148
  Orders::Actions::SendNotifications.call_async(order: order)
149
- Orders::Actions::SendNotifications.call_async!(order: order, queue_as: :my_queue) # job will be executed in 'my_queue'
149
+ Orders::Actions::SendNotifications.call_async!(order: order, job_options: { queue_as: :my_queue, discard_on: ActiveJob::DeserializationError})
150
+ ```
151
+
152
+ ```ruby
150
153
  # Important! Make sure your sidekiq configuration has 'my_queue' queue
151
154
  ```
152
155
 
@@ -3,11 +3,13 @@
3
3
  require 'active_job' unless defined?(::ActiveJob)
4
4
 
5
5
  module Readymade
6
- class BackgroundBangJob < ::ActiveJob::Base
7
- queue_as { self.arguments[0].fetch(:queue_as, :default) }
6
+ class BackgroundBangJob < ::Readymade::BackgroundJob
7
+ queue_as { self.arguments[0].dig(:queue_as) || self.arguments[0].dig(:job_options, :queue_as) || :default }
8
8
 
9
- def perform(**args)
10
- args.delete(:class_name).to_s.constantize.send(:call!, **args)
9
+ private
10
+
11
+ def callable_method
12
+ :call!
11
13
  end
12
14
  end
13
- end
15
+ end
@@ -4,10 +4,16 @@ require 'active_job' unless defined?(::ActiveJob)
4
4
 
5
5
  module Readymade
6
6
  class BackgroundJob < ::ActiveJob::Base
7
- queue_as { self.arguments[0].fetch(:queue_as, :default) }
7
+ queue_as { self.arguments[0].dig(:queue_as) || self.arguments[0].dig(:job_options, :queue_as) || :default }
8
8
 
9
9
  def perform(**args)
10
- args.delete(:class_name).to_s.constantize.send(:call, **args)
10
+ args.delete(:class_name).to_s.constantize.send(callable_method, **args)
11
+ end
12
+
13
+ private
14
+
15
+ def callable_method
16
+ :call
11
17
  end
12
18
  end
13
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Readymade
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readymade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OrestF
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-15 00:00:00.000000000 Z
11
+ date: 2025-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.3.7
138
+ rubygems_version: 3.4.19
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Set of base classes for ABDI architecture