interactor-sidekiq 1.0.0 → 1.0.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: 5a3f2ae3d870f43556bde3c67622cc6ef268b920aad8c9cae4dee04376d46029
4
- data.tar.gz: b34487c04f020818817c7554e447e35099690d5a7561e76bc4367adc091cd4e9
3
+ metadata.gz: f9624b382ea330778b096bba8c2f547eef88be418ee9a23fb4c51b1e42fa1c12
4
+ data.tar.gz: 79e2ebc534be606659cb06395e190c08c1a3cc0e07877189b4af803cbad4db3e
5
5
  SHA512:
6
- metadata.gz: e146bebf4e3aaf4a5867ca4096685696e1644775f89e6db37b5b77aa4045df7e9a8bbeddacd2900c186d9ebeabb700afc75f70e97f36174914ba7cef9c728629
7
- data.tar.gz: 1903783ad26f3f6fe14a0343dad485bfdf7522e3d9443443176194bb9ca277a3f51ce99a0cd5b240549c8d0e5283d4ab485e0ca3b3af9f65460e62a4fdf75322
6
+ metadata.gz: 8a9315375c3aa635d6892516f75e65d18fadcd606e0371316c052c1e998c573a3a6031ba046705250601dca8d24aa65be2c1da15da4e78df7267dd80344fbd15
7
+ data.tar.gz: 51c12fdff9946dd842742e85c8ccf57d2ffb511832b8fd75b6b840cc57952ac9c84bbcb94a47e45000b2951778e305ddbca820231a8357cbc20673024a405afa
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ ruby-version: ['2.6', '2.7', '3.0']
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby
22
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
23
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
24
+ # uses: ruby/setup-ruby@v1
25
+ uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
26
+ with:
27
+ ruby-version: ${{ matrix.ruby-version }}
28
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
29
+ - name: Rspec - Build and run tests
30
+ run: |
31
+ gem install bundler
32
+ bundle install --jobs 4 --retry 3
33
+ bundle exec rspec spec
data/README.md CHANGED
@@ -47,8 +47,7 @@ In order to be able to schedule jobs for future execution following [Scheduled J
47
47
 
48
48
  ```sh
49
49
  >> RegularAction.async_call(message: 'hello!', sidekiq_options: { queue: :low_priority }, sidekiq_schedule_options: { perform_in: 5 })
50
-
51
- Interactor::Context message: 'hello!', sidekiq_options: { queue: :low_priority }, sidekiq_schedule_options: { perform_in: 5 }
50
+ #<Interactor::Context message="hello!", sidekiq_options={ queue: :low_priority }, sidekiq_schedule_options={ perform_in: 5 }>
52
51
  ```
53
52
 
54
53
  ## Failure
@@ -70,8 +69,10 @@ Now you need an interactor to always assume asynchronous behavior using: **Inter
70
69
  #### Passing handle sidekiq exception
71
70
 
72
71
  When executing the perform method in sidekiq there may be a problem, thinking about it we have already made it possible for you to handle this error.
72
+
73
73
  **If the context is failed during invocation of the interactor in background, the Interactor::Failure is raised**.
74
74
 
75
+ Use self.method_name to customize your class: **self.sidekiq_options**, **self.sidekiq_schedule_options** and **self.handle_sidekiq_exception(error)**.
75
76
 
76
77
  ```ruby
77
78
  class AsyncAction
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Interactor
4
4
  module Sidekiq
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
@@ -25,7 +25,7 @@ module Interactor
25
25
  include ::Sidekiq::Worker
26
26
 
27
27
  def perform(context)
28
- interactor_class(context).sync_call(context.except(:interactor_class))
28
+ interactor_class(context).sync_call(context.reject { |c| ['interactor_class'].include? c.to_s })
29
29
  rescue Exception => e
30
30
  if interactor_class(context).respond_to?(:handle_sidekiq_exception)
31
31
  interactor_class(context).handle_sidekiq_exception(e)
@@ -51,7 +51,7 @@ RSpec.describe Interactor::SidekiqWorker::Worker do
51
51
 
52
52
  it { expect(result.success?).to eq true }
53
53
 
54
- it { expect(result.to_h).to eq context.except(:interactor_class) }
54
+ it { expect(result.to_h).to eq context.reject { |c| ['interactor_class'].include? c.to_s } }
55
55
 
56
56
  it_behaves_like 'there was no new sidekiq worker'
57
57
  end
@@ -98,7 +98,6 @@ RSpec.describe Interactor::SidekiqWorker do
98
98
  before { Sidekiq::Queues.clear_all }
99
99
  before { result }
100
100
 
101
-
102
101
  it { expect(respond_to?(:jobs_by_queue)).to be_truthy }
103
102
  end
104
103
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interactor-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Rocha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-26 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: interactor
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".github/ci.yml"
48
+ - ".github/workflows/ci.yml"
49
49
  - ".gitignore"
50
50
  - ".rspec"
51
51
  - Gemfile
data/.github/ci.yml DELETED
@@ -1,24 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- - '*'
6
-
7
- jobs:
8
- test:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - name: Check out repository code
12
- uses: actions/checkout@v1
13
-
14
- - name: Setup Ruby
15
- uses: ruby/setup-ruby@v1
16
- with:
17
- ruby-version: '3.0.3'
18
- bundler-cache: true
19
-
20
- - name: Rspec - Build and run tests
21
- run: |
22
- gem install bundler
23
- bundle install --jobs 4 --retry 3
24
- bundle exec rspec spec