loggable_activity 0.1.51 → 0.1.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -1
- data/lib/loggable_activity/payloads_builder.rb +33 -2
- data/lib/loggable_activity/version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12ed0c5c4e119f98ff329b14e762fafbac54bae7ee34e0acb68809843d437a68
|
4
|
+
data.tar.gz: 6d7fc9dc56592551e9388ad2c3762cd94c76b46b1afcc33866e8014e2c4b802b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b66bb24424af6a4905c4d658f9d443bdc9fa35d56453aca917bc645106a3d53a7ac8013482e5307cdd01543795ee2f1a2d7476cb1d2957d29e6bce28ec5229
|
7
|
+
data.tar.gz: f501c925354af941eda9ed03855307981eb3efbcd9e97852f98bece717d030c7ff4beb35c13a0cf3e22b8a28c2781c0d075f592e1be0adc5068cef2126471520
|
data/.rubocop.yml
CHANGED
@@ -66,6 +66,8 @@ module LoggableActivity
|
|
66
66
|
build_payload(relation_config, 'belongs_to')
|
67
67
|
when 'has_one'
|
68
68
|
build_payload(relation_config, 'has_one')
|
69
|
+
when 'has_many'
|
70
|
+
build_has_many_payloads(relation_config, 'has_many')
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
@@ -78,10 +80,39 @@ module LoggableActivity
|
|
78
80
|
associated_record = send(relation_config[relation_type])
|
79
81
|
return nil if associated_record.nil?
|
80
82
|
|
81
|
-
|
83
|
+
build_associated_payload(associated_record, relation_config)
|
82
84
|
|
83
|
-
|
85
|
+
# associated_loggable_attrs = relation_config['loggable_attrs']
|
86
|
+
|
87
|
+
# encryption_key = associated_record_encryption_key(associated_record, relation_config['data_owner'])
|
88
|
+
|
89
|
+
# encrypted_attrs =
|
90
|
+
# encrypt_attrs(
|
91
|
+
# associated_record.attributes,
|
92
|
+
# associated_loggable_attrs,
|
93
|
+
# encryption_key.key
|
94
|
+
# )
|
95
|
+
|
96
|
+
# @payloads << LoggableActivity::Payload.new(
|
97
|
+
# record: associated_record,
|
98
|
+
# encrypted_attrs:,
|
99
|
+
# payload_type: 'current_association',
|
100
|
+
# data_owner: relation_config['data_owner']
|
101
|
+
# )
|
102
|
+
end
|
84
103
|
|
104
|
+
def build_has_many_payloads(relation_config, relation_type)
|
105
|
+
associated_records = send(relation_config[relation_type])
|
106
|
+
return nil if associated_records.empty?
|
107
|
+
|
108
|
+
associated_records.each do |associated_record|
|
109
|
+
build_associated_payload(associated_record, relation_config)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def build_associated_payload(associated_record, relation_config)
|
114
|
+
associated_loggable_attrs = relation_config['loggable_attrs']
|
115
|
+
encryption_key = associated_record_encryption_key(associated_record, relation_config['data_owner'])
|
85
116
|
encrypted_attrs =
|
86
117
|
encrypt_attrs(
|
87
118
|
associated_record.attributes,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loggable_activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Max \nGroenlund"
|
@@ -28,30 +28,36 @@ dependencies:
|
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 7.1.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 7.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '6.1'
|
45
48
|
- - ">="
|
46
49
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
50
|
+
version: 6.1.1
|
51
|
+
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '6.1'
|
52
58
|
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
60
|
+
version: 6.1.1
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: generator_spec
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|