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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 562b5492910176c8bc5816b7f5691ae386c015d1a969b71a33c45f708383c185
4
- data.tar.gz: 577534f63904b76ac414d1dba76aac35725892b127a3f268de650eeb4ed4629e
3
+ metadata.gz: 12ed0c5c4e119f98ff329b14e762fafbac54bae7ee34e0acb68809843d437a68
4
+ data.tar.gz: 6d7fc9dc56592551e9388ad2c3762cd94c76b46b1afcc33866e8014e2c4b802b
5
5
  SHA512:
6
- metadata.gz: 631979df293ae2f1e03125b0a900c7eb432a59f163b0ab1c3a2c7e559d5e9e75f33e7fb0f686fece6f80888264f5b703719bfe7c2d6069a2a49512424414d913
7
- data.tar.gz: 749dd6e36b9017f5c6b92572b1a9bf47e4c0e8fbe418d0d38e6ab0cd51553ccd64fa92f286ed45bc9e39d7a4dab2e5d74517093da6772578b82044379f53048d
6
+ metadata.gz: 94b66bb24424af6a4905c4d658f9d443bdc9fa35d56453aca917bc645106a3d53a7ac8013482e5307cdd01543795ee2f1a2d7476cb1d2957d29e6bce28ec5229
7
+ data.tar.gz: f501c925354af941eda9ed03855307981eb3efbcd9e97852f98bece717d030c7ff4beb35c13a0cf3e22b8a28c2781c0d075f592e1be0adc5068cef2126471520
data/.rubocop.yml CHANGED
@@ -2,8 +2,10 @@ AllCops:
2
2
  TargetRubyVersion: '3.2.0'
3
3
  NewCops: enable
4
4
  Exclude:
5
- - 'db/schema.rb'
6
5
  # - 'vendor/**/*'
6
+
7
+ Style/OpenStructUse:
8
+ Enabled: false
7
9
 
8
10
  Style/Documentation:
9
11
  Enabled: false
@@ -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
- associated_loggable_attrs = relation_config['loggable_attrs']
83
+ build_associated_payload(associated_record, relation_config)
82
84
 
83
- encryption_key = associated_record_encryption_key(associated_record, relation_config['data_owner'])
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,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LoggableActivity
4
- VERSION = '0.1.51'
4
+ VERSION = '0.1.52'
5
5
  end
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.51
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: '0'
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: '0'
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: '0'
48
- type: :runtime
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: '0'
60
+ version: 6.1.1
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: generator_spec
57
63
  requirement: !ruby/object:Gem::Requirement