loggable_activity 0.5.6 → 0.5.7
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/CHANGELOG.md +3 -0
- data/GETTING-STARTED.md +1 -0
- data/docker-compose.yml +27 -0
- data/docs/CHANGELOG_md.html +318 -0
- data/docs/CHEAT_SHEET_md.html +168 -0
- data/docs/CODE_OF_CONDUCT_md.html +250 -0
- data/docs/CreateLoggableActivities.html +175 -0
- data/docs/CreateLoggableActivityTables.html +173 -0
- data/docs/GETTING-STARTED_md.html +211 -0
- data/docs/Gemfile.html +153 -0
- data/docs/Gemfile_lock.html +438 -0
- data/docs/LoggableActivity/ActivitiesController.html +160 -0
- data/docs/LoggableActivity/ActivitiesHelper.html +158 -0
- data/docs/LoggableActivity/Activity.html +565 -0
- data/docs/LoggableActivity/ApplicationController.html +97 -0
- data/docs/LoggableActivity/ApplicationHelper.html +91 -0
- data/docs/LoggableActivity/ApplicationJob.html +97 -0
- data/docs/LoggableActivity/ApplicationMailer.html +97 -0
- data/docs/LoggableActivity/ApplicationRecord.html +97 -0
- data/docs/LoggableActivity/Configuration.html +237 -0
- data/docs/LoggableActivity/ConfigurationError.html +142 -0
- data/docs/LoggableActivity/CurrentActor.html +166 -0
- data/docs/LoggableActivity/DataOwner.html +138 -0
- data/docs/LoggableActivity/Encryption.html +321 -0
- data/docs/LoggableActivity/EncryptionError.html +142 -0
- data/docs/LoggableActivity/EncryptionKey.html +399 -0
- data/docs/LoggableActivity/Engine.html +108 -0
- data/docs/LoggableActivity/Error.html +142 -0
- data/docs/LoggableActivity/Generators/InstallGenerator.html +212 -0
- data/docs/LoggableActivity/Generators.html +91 -0
- data/docs/LoggableActivity/Hooks.html +841 -0
- data/docs/LoggableActivity/Payload.html +430 -0
- data/docs/LoggableActivity/Sanitizer.html +134 -0
- data/docs/LoggableActivity/Services/BasePayloadsBuilder.html +472 -0
- data/docs/LoggableActivity/Services/CustomPayloadsBuilder.html +225 -0
- data/docs/LoggableActivity/Services/DestroyPayloadsBuilder.html +396 -0
- data/docs/LoggableActivity/Services/PayloadsBuilder.html +348 -0
- data/docs/LoggableActivity/Services/UpdatePayloadsBuilder.html +540 -0
- data/docs/LoggableActivity/Services.html +93 -0
- data/docs/LoggableActivity.html +173 -0
- data/docs/MIT-LICENSE.html +132 -0
- data/docs/Object.html +110 -0
- data/docs/README_md.html +186 -0
- data/docs/Rakefile.html +134 -0
- data/docs/app/assets/config/loggable_activity_manifest_js.html +126 -0
- data/docs/app/assets/javascripts/loggable_activity/application_js.html +124 -0
- data/docs/app/assets/stylesheets/loggable_activity/activities_scss.html +154 -0
- data/docs/app/assets/stylesheets/loggable_activity/application_scss.html +142 -0
- data/docs/app/views/layouts/loggable_activity/application_html_slim.html +145 -0
- data/docs/app/views/loggable_activity/activities/_activities_html_slim.html +159 -0
- data/docs/created.rid +74 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +687 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/git-org/HEAD.html +126 -0
- data/docs/git-org/config.html +128 -0
- data/docs/git-org/description.html +126 -0
- data/docs/git-org/hooks/applypatch-msg_sample.html +128 -0
- data/docs/git-org/hooks/commit-msg_sample.html +138 -0
- data/docs/git-org/hooks/fsmonitor-watchman_sample.html +302 -0
- data/docs/git-org/hooks/post-update_sample.html +128 -0
- data/docs/git-org/hooks/pre-applypatch_sample.html +128 -0
- data/docs/git-org/hooks/pre-commit_sample.html +174 -0
- data/docs/git-org/hooks/pre-merge-commit_sample.html +133 -0
- data/docs/git-org/hooks/pre-push_sample.html +161 -0
- data/docs/git-org/hooks/pre-rebase_sample.html +282 -0
- data/docs/git-org/hooks/pre-receive_sample.html +144 -0
- data/docs/git-org/hooks/prepare-commit-msg_sample.html +136 -0
- data/docs/git-org/hooks/push-to-checkout_sample.html +178 -0
- data/docs/git-org/hooks/update_sample.html +226 -0
- data/docs/git-org/info/exclude.html +126 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +166 -0
- data/docs/js/darkfish.js +97 -0
- data/docs/js/navigation.js +105 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +110 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/lib/loggable_activity/config_schema_json.html +205 -0
- data/docs/lib/tasks/loggable_activity_tasks_rake.html +128 -0
- data/docs/table_of_contents.html +954 -0
- data/lib/loggable_activity/concerns/current_actor.rb +25 -0
- data/lib/loggable_activity/hooks.rb +41 -19
- data/lib/loggable_activity/version.rb +1 -1
- data/lib/loggable_activity.rb +1 -1
- metadata +114 -3
- data/lib/loggable_activity/concerns/current_user.rb +0 -26
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<title>class LoggableActivity::Services::BasePayloadsBuilder - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<script type="text/javascript">
|
|
10
|
+
var rdoc_rel_prefix = "../../";
|
|
11
|
+
var index_rel_prefix = "../../";
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script src="../../js/navigation.js" defer></script>
|
|
15
|
+
<script src="../../js/search.js" defer></script>
|
|
16
|
+
<script src="../../js/search_index.js" defer></script>
|
|
17
|
+
<script src="../../js/searcher.js" defer></script>
|
|
18
|
+
<script src="../../js/darkfish.js" defer></script>
|
|
19
|
+
|
|
20
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
|
21
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<body id="top" role="document" class="class">
|
|
25
|
+
<nav role="navigation">
|
|
26
|
+
<div id="project-navigation">
|
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
28
|
+
<h2>
|
|
29
|
+
<a href="../../index.html" rel="home">Home</a>
|
|
30
|
+
</h2>
|
|
31
|
+
|
|
32
|
+
<div id="table-of-contents-navigation">
|
|
33
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
|
34
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
|
35
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
41
|
+
<div id="search-field-wrapper">
|
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
44
|
+
type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
|
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
|
49
|
+
aria-busy="false" aria-expanded="false"
|
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
51
|
+
</form>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<div id="class-metadata">
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
|
62
|
+
<h3>Parent</h3>
|
|
63
|
+
|
|
64
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<!-- Method Quickref -->
|
|
71
|
+
<div id="method-list-section" class="nav-section">
|
|
72
|
+
<h3>Methods</h3>
|
|
73
|
+
|
|
74
|
+
<ul class="link-list" role="directory">
|
|
75
|
+
<li ><a href="#method-c-new">::new</a>
|
|
76
|
+
<li ><a href="#method-i-build_encrypted_payload">#build_encrypted_payload</a>
|
|
77
|
+
<li ><a href="#method-i-build_payload">#build_payload</a>
|
|
78
|
+
<li ><a href="#method-i-changes_to_save">#changes_to_save</a>
|
|
79
|
+
<li ><a href="#method-i-encrypt_attr">#encrypt_attr</a>
|
|
80
|
+
<li ><a href="#method-i-encrypt_attributes">#encrypt_attributes</a>
|
|
81
|
+
<li ><a href="#method-i-encrypt_attrs">#encrypt_attrs</a>
|
|
82
|
+
<li ><a href="#method-i-encrypt_record_name_for_record">#encrypt_record_name_for_record</a>
|
|
83
|
+
<li ><a href="#method-i-encryption_key_for_record">#encryption_key_for_record</a>
|
|
84
|
+
<li ><a href="#method-i-fetch_record_name_for_record">#fetch_record_name_for_record</a>
|
|
85
|
+
<li ><a href="#method-i-public_attributes">#public_attributes</a>
|
|
86
|
+
<li ><a href="#method-i-saved_changes">#saved_changes</a>
|
|
87
|
+
</ul>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
</div>
|
|
91
|
+
</nav>
|
|
92
|
+
|
|
93
|
+
<main role="main" aria-labelledby="class-LoggableActivity::Services::BasePayloadsBuilder">
|
|
94
|
+
<h1 id="class-LoggableActivity::Services::BasePayloadsBuilder" class="class">
|
|
95
|
+
class LoggableActivity::Services::BasePayloadsBuilder
|
|
96
|
+
</h1>
|
|
97
|
+
|
|
98
|
+
<section class="description">
|
|
99
|
+
|
|
100
|
+
<p>This service class provides the base payloads builder for the loggable activity. Other service modules related to the loggable activity will inherit from this module.</p>
|
|
101
|
+
|
|
102
|
+
</section>
|
|
103
|
+
|
|
104
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
111
|
+
<header>
|
|
112
|
+
<h3>Public Class Methods</h3>
|
|
113
|
+
</header>
|
|
114
|
+
|
|
115
|
+
<div id="method-c-new" class="method-detail ">
|
|
116
|
+
<div class="method-header">
|
|
117
|
+
<div class="method-heading">
|
|
118
|
+
<span class="method-name">new</span><span
|
|
119
|
+
class="method-args">(record, payloads, params = {})</span>
|
|
120
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div class="method-description">
|
|
125
|
+
<p>Initializes the <a href="PayloadsBuilder.html"><code>PayloadsBuilder</code></a> with a record and an initial collection of payloads,</p>
|
|
126
|
+
|
|
127
|
+
<div class="method-source-code" id="new-source">
|
|
128
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 9</span>
|
|
129
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">payloads</span>, <span class="ruby-identifier">params</span> = {})
|
|
130
|
+
<span class="ruby-ivar">@record</span> = <span class="ruby-identifier">record</span>
|
|
131
|
+
<span class="ruby-ivar">@payloads</span> = <span class="ruby-identifier">payloads</span>
|
|
132
|
+
<span class="ruby-ivar">@params</span> = <span class="ruby-identifier">params</span>
|
|
133
|
+
<span class="ruby-ivar">@loggable_attrs</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">loggable_attrs</span>
|
|
134
|
+
<span class="ruby-ivar">@public_attrs</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">public_attrs</span>
|
|
135
|
+
<span class="ruby-comment"># @relation_config = record.relation_config</span>
|
|
136
|
+
<span class="ruby-ivar">@relations</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">relations</span>
|
|
137
|
+
<span class="ruby-ivar">@auto_log</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">auto_log</span>
|
|
138
|
+
<span class="ruby-comment"># @fetch_record_name_from = record.class.fetch_record_name_from</span>
|
|
139
|
+
<span class="ruby-ivar">@route</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">route</span>
|
|
140
|
+
<span class="ruby-keyword">end</span></pre>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
</section>
|
|
148
|
+
|
|
149
|
+
<section id="private-instance-5Buntitled-5D-method-details" class="method-section">
|
|
150
|
+
<header>
|
|
151
|
+
<h3>Private Instance Methods</h3>
|
|
152
|
+
</header>
|
|
153
|
+
|
|
154
|
+
<div id="method-i-build_encrypted_payload" class="method-detail ">
|
|
155
|
+
<div class="method-header">
|
|
156
|
+
<div class="method-heading">
|
|
157
|
+
<span class="method-name">build_encrypted_payload</span><span
|
|
158
|
+
class="method-args">(record, options = {})</span>
|
|
159
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div class="method-description">
|
|
164
|
+
<p>Build a encrypted payload for a record</p>
|
|
165
|
+
|
|
166
|
+
<div class="method-source-code" id="build_encrypted_payload-source">
|
|
167
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 67</span>
|
|
168
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_encrypted_payload</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">options</span> = {})
|
|
169
|
+
<span class="ruby-identifier">encryption_key</span> = <span class="ruby-identifier">encryption_key_for_record</span>(<span class="ruby-identifier">record</span>)
|
|
170
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">encryption_key</span>.<span class="ruby-identifier">deleted?</span>
|
|
171
|
+
|
|
172
|
+
<span class="ruby-identifier">secret_key</span> = <span class="ruby-identifier">encryption_key</span>.<span class="ruby-identifier">secret_key</span>
|
|
173
|
+
<span class="ruby-identifier">encrypted_attrs</span> = <span class="ruby-identifier">encrypt_attributes</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">secret_key</span>, <span class="ruby-identifier">options</span>)
|
|
174
|
+
<span class="ruby-identifier">public_attrs</span> = <span class="ruby-identifier">public_attributes</span>(<span class="ruby-identifier">record</span>)
|
|
175
|
+
|
|
176
|
+
<span class="ruby-identifier">build_payload</span>(
|
|
177
|
+
<span class="ruby-identifier">record</span>,
|
|
178
|
+
<span class="ruby-identifier">encryption_key</span>,
|
|
179
|
+
<span class="ruby-identifier">encrypted_attrs</span>,
|
|
180
|
+
<span class="ruby-identifier">public_attrs</span>,
|
|
181
|
+
<span class="ruby-identifier">options</span>
|
|
182
|
+
)
|
|
183
|
+
{ <span class="ruby-value">encryption_key:</span>, <span class="ruby-value">encrypted_attrs:</span> }
|
|
184
|
+
<span class="ruby-keyword">end</span></pre>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div id="method-i-build_payload" class="method-detail ">
|
|
192
|
+
<div class="method-header">
|
|
193
|
+
<div class="method-heading">
|
|
194
|
+
<span class="method-name">build_payload</span><span
|
|
195
|
+
class="method-args">(record, encryption_key, encrypted_attrs, public_attrs, options = {})</span>
|
|
196
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="method-description">
|
|
201
|
+
<p>Builds the payload for a record</p>
|
|
202
|
+
|
|
203
|
+
<div class="method-source-code" id="build_payload-source">
|
|
204
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 86</span>
|
|
205
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_payload</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">encryption_key</span>, <span class="ruby-identifier">encrypted_attrs</span>, <span class="ruby-identifier">public_attrs</span>, <span class="ruby-identifier">options</span> = {})
|
|
206
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">encryption_key</span>.<span class="ruby-identifier">deleted?</span>
|
|
207
|
+
|
|
208
|
+
<span class="ruby-identifier">related_to_activity_as</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:related_to_activity_as</span>]
|
|
209
|
+
<span class="ruby-identifier">current_payload</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:current_payload</span>]
|
|
210
|
+
<span class="ruby-identifier">data_owner</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:data_owner</span>]
|
|
211
|
+
|
|
212
|
+
<span class="ruby-identifier">secret_key</span> = <span class="ruby-identifier">encryption_key</span>.<span class="ruby-identifier">secret_key</span>
|
|
213
|
+
<span class="ruby-identifier">encrypted_record_name</span> = <span class="ruby-identifier">encrypt_record_name_for_record</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">secret_key</span>)
|
|
214
|
+
<span class="ruby-identifier">payload</span> = <span class="ruby-operator">::</span><span class="ruby-constant">LoggableActivity</span><span class="ruby-operator">::</span><span class="ruby-constant">Payload</span>.<span class="ruby-identifier">new</span>(
|
|
215
|
+
<span class="ruby-value">encryption_key:</span>,
|
|
216
|
+
<span class="ruby-value">record:</span>,
|
|
217
|
+
<span class="ruby-value">encrypted_record_name:</span>,
|
|
218
|
+
<span class="ruby-value">encrypted_attrs:</span>,
|
|
219
|
+
<span class="ruby-value">related_to_activity_as:</span>,
|
|
220
|
+
<span class="ruby-value">route:</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">route</span>,
|
|
221
|
+
<span class="ruby-value">current_payload:</span>,
|
|
222
|
+
<span class="ruby-value">data_owner:</span>,
|
|
223
|
+
<span class="ruby-value">public_attrs:</span>
|
|
224
|
+
)
|
|
225
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">payload</span>.<span class="ruby-identifier">valid?</span>
|
|
226
|
+
<span class="ruby-identifier">error_message</span> = <span class="ruby-node">"Payload validation failed: #{payload.errors.full_messages.join(', ')}"</span>
|
|
227
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">LoggableActivity</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>, <span class="ruby-identifier">error_message</span>
|
|
228
|
+
<span class="ruby-keyword">end</span>
|
|
229
|
+
|
|
230
|
+
<span class="ruby-ivar">@payloads</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">payload</span>
|
|
231
|
+
<span class="ruby-keyword">end</span></pre>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<div id="method-i-changes_to_save" class="method-detail ">
|
|
239
|
+
<div class="method-header">
|
|
240
|
+
<div class="method-heading">
|
|
241
|
+
<span class="method-name">changes_to_save</span><span
|
|
242
|
+
class="method-args">(record)</span>
|
|
243
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div class="method-description">
|
|
248
|
+
<p>Fetch the previous and current values for a record.</p>
|
|
249
|
+
|
|
250
|
+
<div class="method-source-code" id="changes_to_save-source">
|
|
251
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 30</span>
|
|
252
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">changes_to_save</span>(<span class="ruby-identifier">record</span>)
|
|
253
|
+
<span class="ruby-identifier">changes</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">changes_to_save</span>
|
|
254
|
+
<span class="ruby-identifier">previous_values</span> = {}
|
|
255
|
+
<span class="ruby-identifier">current_values</span> = {}
|
|
256
|
+
|
|
257
|
+
<span class="ruby-identifier">changes</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
|
258
|
+
<span class="ruby-identifier">previous_values</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>[<span class="ruby-value">0</span>]
|
|
259
|
+
<span class="ruby-identifier">current_values</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>[<span class="ruby-value">1</span>]
|
|
260
|
+
<span class="ruby-keyword">end</span>
|
|
261
|
+
[<span class="ruby-identifier">previous_values</span>, <span class="ruby-identifier">current_values</span>]
|
|
262
|
+
<span class="ruby-keyword">end</span></pre>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
<div id="method-i-encrypt_attr" class="method-detail ">
|
|
270
|
+
<div class="method-header">
|
|
271
|
+
<div class="method-heading">
|
|
272
|
+
<span class="method-name">encrypt_attr</span><span
|
|
273
|
+
class="method-args">(value, secret_key)</span>
|
|
274
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<div class="method-description">
|
|
279
|
+
<p>Encrypt a single attribute.</p>
|
|
280
|
+
|
|
281
|
+
<div class="method-source-code" id="encrypt_attr-source">
|
|
282
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 132</span>
|
|
283
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">encrypt_attr</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">secret_key</span>)
|
|
284
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">LoggableActivity</span><span class="ruby-operator">::</span><span class="ruby-constant">Encryption</span>.<span class="ruby-identifier">encrypt</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">secret_key</span>)
|
|
285
|
+
<span class="ruby-keyword">end</span></pre>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<div id="method-i-encrypt_attributes" class="method-detail ">
|
|
293
|
+
<div class="method-header">
|
|
294
|
+
<div class="method-heading">
|
|
295
|
+
<span class="method-name">encrypt_attributes</span><span
|
|
296
|
+
class="method-args">(record, secret_key, options = {})</span>
|
|
297
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<div class="method-description">
|
|
302
|
+
<p>Encrypts the attributes for the record.</p>
|
|
303
|
+
|
|
304
|
+
<div class="method-source-code" id="encrypt_attributes-source">
|
|
305
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 115</span>
|
|
306
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">encrypt_attributes</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">secret_key</span>, <span class="ruby-identifier">options</span> = {})
|
|
307
|
+
<span class="ruby-identifier">loggable_attrs</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:loggable_attrs</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">loggable_attrs</span>
|
|
308
|
+
<span class="ruby-identifier">encrypt_attrs</span>(<span class="ruby-identifier">record</span>.<span class="ruby-identifier">attributes</span>, <span class="ruby-identifier">loggable_attrs</span>, <span class="ruby-identifier">secret_key</span>)
|
|
309
|
+
<span class="ruby-keyword">end</span></pre>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<div id="method-i-encrypt_attrs" class="method-detail ">
|
|
317
|
+
<div class="method-header">
|
|
318
|
+
<div class="method-heading">
|
|
319
|
+
<span class="method-name">encrypt_attrs</span><span
|
|
320
|
+
class="method-args">(attrs, loggable_attrs, secret_key)</span>
|
|
321
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
<div class="method-description">
|
|
326
|
+
<p>Encrypt one attributes for only loggable_attrs, configured</p>
|
|
327
|
+
|
|
328
|
+
<div class="method-source-code" id="encrypt_attrs-source">
|
|
329
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 121</span>
|
|
330
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">encrypt_attrs</span>(<span class="ruby-identifier">attrs</span>, <span class="ruby-identifier">loggable_attrs</span>, <span class="ruby-identifier">secret_key</span>)
|
|
331
|
+
<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">loggable_attrs</span>).<span class="ruby-identifier">transform_values</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
|
332
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">LoggableActivity</span><span class="ruby-operator">::</span><span class="ruby-constant">Encryption</span>.<span class="ruby-identifier">encrypt</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">secret_key</span>)
|
|
333
|
+
<span class="ruby-keyword">end</span>
|
|
334
|
+
<span class="ruby-keyword">end</span></pre>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<div id="method-i-encrypt_record_name_for_record" class="method-detail ">
|
|
342
|
+
<div class="method-header">
|
|
343
|
+
<div class="method-heading">
|
|
344
|
+
<span class="method-name">encrypt_record_name_for_record</span><span
|
|
345
|
+
class="method-args">(record, secret_key)</span>
|
|
346
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<div class="method-description">
|
|
351
|
+
<p>Encrypts the record name for the record. If the record has a fetch_record_name_from the configuration, it will use that method to fetch the record name. Otherwise, it will use the class name and the record id.</p>
|
|
352
|
+
|
|
353
|
+
<div class="method-source-code" id="encrypt_record_name_for_record-source">
|
|
354
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 46</span>
|
|
355
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">encrypt_record_name_for_record</span>(<span class="ruby-identifier">record</span>, <span class="ruby-identifier">secret_key</span>)
|
|
356
|
+
<span class="ruby-identifier">record_name</span> = <span class="ruby-identifier">fetch_record_name_for_record</span>(<span class="ruby-identifier">record</span>) <span class="ruby-operator">||</span> <span class="ruby-node">"#{record.class.name}##{record.id}"</span>
|
|
357
|
+
|
|
358
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">LoggableActivity</span><span class="ruby-operator">::</span><span class="ruby-constant">Encryption</span>.<span class="ruby-identifier">encrypt</span>(<span class="ruby-identifier">record_name</span>, <span class="ruby-identifier">secret_key</span>)
|
|
359
|
+
<span class="ruby-keyword">end</span></pre>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<div id="method-i-encryption_key_for_record" class="method-detail ">
|
|
367
|
+
<div class="method-header">
|
|
368
|
+
<div class="method-heading">
|
|
369
|
+
<span class="method-name">encryption_key_for_record</span><span
|
|
370
|
+
class="method-args">(record)</span>
|
|
371
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<div class="method-description">
|
|
376
|
+
<p>Returns the encryption key for the record.</p>
|
|
377
|
+
|
|
378
|
+
<div class="method-source-code" id="encryption_key_for_record-source">
|
|
379
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 62</span>
|
|
380
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">encryption_key_for_record</span>(<span class="ruby-identifier">record</span>)
|
|
381
|
+
<span class="ruby-operator">::</span><span class="ruby-constant">LoggableActivity</span><span class="ruby-operator">::</span><span class="ruby-constant">EncryptionKey</span>.<span class="ruby-identifier">for_record</span>(<span class="ruby-identifier">record</span>)
|
|
382
|
+
<span class="ruby-keyword">end</span></pre>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
<div id="method-i-fetch_record_name_for_record" class="method-detail ">
|
|
390
|
+
<div class="method-header">
|
|
391
|
+
<div class="method-heading">
|
|
392
|
+
<span class="method-name">fetch_record_name_for_record</span><span
|
|
393
|
+
class="method-args">(record)</span>
|
|
394
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div class="method-description">
|
|
399
|
+
<p>Return the record name for the record. If the record has a fetch_record_name_from the configuration,</p>
|
|
400
|
+
|
|
401
|
+
<div class="method-source-code" id="fetch_record_name_for_record-source">
|
|
402
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 54</span>
|
|
403
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fetch_record_name_for_record</span>(<span class="ruby-identifier">record</span>)
|
|
404
|
+
<span class="ruby-identifier">fetch_from</span> = <span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">fetch_record_name_from</span>
|
|
405
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">fetch_from</span>.<span class="ruby-identifier">nil?</span>
|
|
406
|
+
|
|
407
|
+
<span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">fetch_from</span>)
|
|
408
|
+
<span class="ruby-keyword">end</span></pre>
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
<div id="method-i-public_attributes" class="method-detail ">
|
|
416
|
+
<div class="method-header">
|
|
417
|
+
<div class="method-heading">
|
|
418
|
+
<span class="method-name">public_attributes</span><span
|
|
419
|
+
class="method-args">(record)</span>
|
|
420
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
|
|
424
|
+
<div class="method-description">
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
<div class="method-source-code" id="public_attributes-source">
|
|
428
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 127</span>
|
|
429
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">public_attributes</span>(<span class="ruby-identifier">record</span>)
|
|
430
|
+
<span class="ruby-identifier">record</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">record</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">public_attrs</span>)
|
|
431
|
+
<span class="ruby-keyword">end</span></pre>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
<div id="method-i-saved_changes" class="method-detail ">
|
|
439
|
+
<div class="method-header">
|
|
440
|
+
<div class="method-heading">
|
|
441
|
+
<span class="method-name">saved_changes</span><span
|
|
442
|
+
class="method-args">(record)</span>
|
|
443
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<div class="method-description">
|
|
448
|
+
<p>Returns saved changes for a record.</p>
|
|
449
|
+
|
|
450
|
+
<div class="method-source-code" id="saved_changes-source">
|
|
451
|
+
<pre><span class="ruby-comment"># File lib/loggable_activity/services/base_payloads_builder.rb, line 25</span>
|
|
452
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">saved_changes</span>(<span class="ruby-identifier">record</span>)
|
|
453
|
+
[<span class="ruby-identifier">record</span>.<span class="ruby-identifier">saved_changes</span>.<span class="ruby-identifier">transform_values</span>(<span class="ruby-operator">&</span><span class="ruby-value">:first</span>), <span class="ruby-identifier">record</span>.<span class="ruby-identifier">saved_changes</span>.<span class="ruby-identifier">transform_values</span>(<span class="ruby-operator">&</span><span class="ruby-value">:last</span>)]
|
|
454
|
+
<span class="ruby-keyword">end</span></pre>
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
</div>
|
|
460
|
+
|
|
461
|
+
</section>
|
|
462
|
+
|
|
463
|
+
</section>
|
|
464
|
+
</main>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
<footer id="validator-badges" role="contentinfo">
|
|
468
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
|
469
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
|
|
470
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
471
|
+
</footer>
|
|
472
|
+
|