anonymous 0.1.1 → 0.1.2
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 +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/anonymous.gemspec +2 -0
- data/gemfiles/4.2.gemfile.lock +1 -1
- data/gemfiles/5.0.gemfile.lock +2 -2
- data/gemfiles/5.1.gemfile.lock +9 -9
- data/gemfiles/5.2.gemfile.lock +8 -8
- data/lib/anonymous.rb +1 -1
- data/lib/anonymous/active_record.rb +12 -3
- data/lib/anonymous/not_implemented_error.rb +3 -0
- data/lib/anonymous/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40963ad833689274bbdc27c4d4d624ee22830a6e
|
4
|
+
data.tar.gz: c23c358c093b884661fcdfa0b78b5a0a56802c8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c736f7cadb09b0edcfd7bde0c688bd06eb147943dd0170a730125c170e022e117bb21101ce58bd3655f9dfe9dbcbd0c4879c3f5a9b1a73bf399297d11d40f7
|
7
|
+
data.tar.gz: bc1e69cfabe2e11fd2ca658c8d66185a10d125bb282eae3de1bcb08a28fe10600d4fed5972bb84ec728fe7bd9a1d209be5323cfee70c8505e28c2f8de40d60d1
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/anonymous.gemspec
CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
+
spec.required_ruby_version = ">= 2.3"
|
26
|
+
|
25
27
|
spec.add_development_dependency "bundler", "~> 1.17"
|
26
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
data/gemfiles/4.2.gemfile.lock
CHANGED
data/gemfiles/5.0.gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
anonymous (0.
|
4
|
+
anonymous (0.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
coderay (1.1.2)
|
26
26
|
concurrent-ruby (1.1.4)
|
27
27
|
diff-lcs (1.3)
|
28
|
-
i18n (1.
|
28
|
+
i18n (1.3.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
method_source (0.9.2)
|
31
31
|
minitest (5.11.3)
|
data/gemfiles/5.1.gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
anonymous (0.
|
4
|
+
anonymous (0.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (5.1.
|
10
|
-
activesupport (= 5.1.
|
11
|
-
activerecord (5.1.
|
12
|
-
activemodel (= 5.1.
|
13
|
-
activesupport (= 5.1.
|
9
|
+
activemodel (5.1.6.1)
|
10
|
+
activesupport (= 5.1.6.1)
|
11
|
+
activerecord (5.1.6.1)
|
12
|
+
activemodel (= 5.1.6.1)
|
13
|
+
activesupport (= 5.1.6.1)
|
14
14
|
arel (~> 8.0)
|
15
|
-
activesupport (5.1.
|
15
|
+
activesupport (5.1.6.1)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (
|
17
|
+
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
19
19
|
tzinfo (~> 1.1)
|
20
20
|
appraisal (2.2.0)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
coderay (1.1.2)
|
26
26
|
concurrent-ruby (1.1.4)
|
27
27
|
diff-lcs (1.3)
|
28
|
-
i18n (
|
28
|
+
i18n (1.3.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
method_source (0.9.2)
|
31
31
|
minitest (5.11.3)
|
data/gemfiles/5.2.gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
anonymous (0.
|
4
|
+
anonymous (0.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (5.2.
|
10
|
-
activesupport (= 5.2.
|
11
|
-
activerecord (5.2.
|
12
|
-
activemodel (= 5.2.
|
13
|
-
activesupport (= 5.2.
|
9
|
+
activemodel (5.2.2)
|
10
|
+
activesupport (= 5.2.2)
|
11
|
+
activerecord (5.2.2)
|
12
|
+
activemodel (= 5.2.2)
|
13
|
+
activesupport (= 5.2.2)
|
14
14
|
arel (>= 9.0)
|
15
|
-
activesupport (5.2.
|
15
|
+
activesupport (5.2.2)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
coderay (1.1.2)
|
26
26
|
concurrent-ruby (1.1.4)
|
27
27
|
diff-lcs (1.3)
|
28
|
-
i18n (1.
|
28
|
+
i18n (1.3.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
method_source (0.9.2)
|
31
31
|
minitest (5.11.3)
|
data/lib/anonymous.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require_relative './anonymizer'
|
2
|
+
require_relative './not_implemented_error'
|
2
3
|
|
3
4
|
module Anonymous
|
4
5
|
# This module handles anonymization for ActiveRecord models. In order to
|
5
|
-
#
|
6
|
+
# implement this module you must define a private #anonymization_definitions
|
6
7
|
# method in your model.
|
7
8
|
#
|
8
9
|
# Retry Functionality:
|
@@ -13,7 +14,7 @@ module Anonymous
|
|
13
14
|
module ActiveRecord
|
14
15
|
def anonymize!
|
15
16
|
anonymizer = Anonymizer.new(attributes, anonymization_definitions)
|
16
|
-
|
17
|
+
update_attributes!(anonymizer.anonymized_attributes)
|
17
18
|
rescue ::ActiveRecord::RecordNotUnique => e
|
18
19
|
@anonymization_attempts ||= 0
|
19
20
|
max_retries = Anonymous.configuration.max_anonymize_retries
|
@@ -25,7 +26,7 @@ module Anonymous
|
|
25
26
|
|
26
27
|
def anonymize
|
27
28
|
anonymizer = Anonymizer.new(attributes, anonymization_definitions)
|
28
|
-
|
29
|
+
update_attributes(anonymizer.anonymized_attributes)
|
29
30
|
rescue ::ActiveRecord::RecordNotUnique => e
|
30
31
|
@anonymization_attempts ||= 0
|
31
32
|
max_retries = Anonymous.configuration.max_anonymize_retries
|
@@ -34,5 +35,13 @@ module Anonymous
|
|
34
35
|
@anonymization_attempts += 1
|
35
36
|
retry
|
36
37
|
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def anonymization_definitions
|
42
|
+
message = "Class #{self.class.name} must implement an #anonymization_definitions method to use the Anonymous::ActiveRecord functionality."
|
43
|
+
|
44
|
+
raise NotImplementedError, message
|
45
|
+
end
|
37
46
|
end
|
38
47
|
end
|
data/lib/anonymous/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anonymous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stonehill
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/anonymous/active_record.rb
|
140
140
|
- lib/anonymous/anonymizer.rb
|
141
141
|
- lib/anonymous/configuration.rb
|
142
|
+
- lib/anonymous/not_implemented_error.rb
|
142
143
|
- lib/anonymous/version.rb
|
143
144
|
homepage: https://github.com/jamesstonehill/anonymous
|
144
145
|
licenses:
|
@@ -152,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
153
|
requirements:
|
153
154
|
- - ">="
|
154
155
|
- !ruby/object:Gem::Version
|
155
|
-
version: '
|
156
|
+
version: '2.3'
|
156
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
158
|
requirements:
|
158
159
|
- - ">="
|