sidekiq-encrypted_args 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: 3d478d88a4ebaca82ad336b50e60ceebbdf9da240c4c830b3d8bc8ddb6c972d1
4
- data.tar.gz: 900d93f22766a04db7ab649b2ff7318a2dbb89cb76dd61a732f8e87807308473
3
+ metadata.gz: ec62339d07cad8c5b54a916e1744619975e8e1386aafb2b61d32e2b2dbfa5aad
4
+ data.tar.gz: 66eeea7cc622fe664296e65e684180b5dead9f29c134c34bbf2cfe5eb520a335
5
5
  SHA512:
6
- metadata.gz: ee85740768b20d08a6caf000f84bbe94c9badc46de5637b753f23420ed299b82cccb969d8a87195e9be8c4323d3dcecbe38a2c71a458eaf4864a4932e2b43362
7
- data.tar.gz: 4f7c7a5894368925e2d59cdcea8eeba6da98f2bf6c3a2cfaf24e99fea3903e203e0fab3039a338236582ae74bef6d114b70869572f1fcb5df6f0eecdd1d1b45e
6
+ metadata.gz: 4e5189778528498dfb701638d82bea3604cf77be45e4ec696462c8436f38a9ba09d52ab6765c40880cf5cf8db1d1c26b8eacb0fb0f3a33b6c565e6405b7baa8b
7
+ data.tar.gz: '0898913e5498b80f0e1911f512211bcbcad5217adaf5b10f2dd3d2e22750201f482278963c99a17a008e68884cc35f935ee9c469c86902dc42926afaa759c7d6'
@@ -1,3 +1,10 @@
1
- # 1.0.0
1
+ # Change log
2
+
3
+ ## 1.0.1
4
+
5
+ * Now works with scheduled jobs
6
+ * Scheduled jobs dispatch by class name instead of `Class`, requiring a constant lookup
7
+
8
+ ## 1.0.0
2
9
 
3
10
  * Initial release
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Brian Durand
3
+ Copyright (c) 2020 Brian Durand, Winston Durand
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -5,7 +5,9 @@ module Sidekiq
5
5
  # Sidekiq client middleware for encrypting arguments on jobs for workers
6
6
  # with `encrypted_args` set in the `sidekiq_options`.
7
7
  class ClientMiddleware
8
+ # @param [String, Class] worker_class class name or class of worker
8
9
  def call(worker_class, job, queue, redis_pool = nil)
10
+ worker_class = constantize(worker_class) if worker_class.is_a?(String)
9
11
  encrypted_args = EncryptedArgs.send(:encrypted_args_option, worker_class)
10
12
  if encrypted_args
11
13
  new_args = []
@@ -18,6 +20,19 @@ module Sidekiq
18
20
 
19
21
  yield
20
22
  end
23
+
24
+ private
25
+
26
+ # @param [String] class_name name of a class
27
+ # @return [Class] class that was referenced by name
28
+ def constantize(class_name)
29
+ names = class_name.split("::")
30
+ # Clear leading :: for root namespace since we're already calling from object
31
+ names.shift if names.empty? || names.first.empty?
32
+ # Map reduce to the constant. Use inherit=false to not accidentally search
33
+ # parent modules
34
+ names.inject(Object) { |constant, name| constant.const_get(name, false) }
35
+ end
21
36
  end
22
37
  end
23
38
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-encrypted_args
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
  - Brian Durand
8
8
  - Winston Durand
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2020-06-02 00:00:00.000000000 Z
@@ -53,7 +53,7 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '2.0'
56
- description:
56
+ description:
57
57
  email:
58
58
  - bbdurand@gmail.com
59
59
  - me@winstondurand.com
@@ -76,7 +76,7 @@ homepage: https://github.com/bdurand/sidekiq-encrypted_args
76
76
  licenses:
77
77
  - MIT
78
78
  metadata: {}
79
- post_install_message:
79
+ post_install_message:
80
80
  rdoc_options: []
81
81
  require_paths:
82
82
  - lib
@@ -91,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.0.3
95
- signing_key:
94
+ rubygems_version: 3.1.2
95
+ signing_key:
96
96
  specification_version: 4
97
97
  summary: Support for encrypting arguments that contain sensitive information in sidekiq
98
98
  jobs.