Class: Clickwrap::DSL::RetentionBuilder
- Inherits:
-
Object
- Object
- Clickwrap::DSL::RetentionBuilder
- Defined in:
- lib/clickwrap/dsl/retention_builder.rb
Overview
The block passed to Clickwrap.retention.
Clickwrap.retention :ordinary_agreement_evidence do
retain_core_event_for 6.years
delete_recorded_ip_address_after 90.days
delete_recorded_browser_user_agent_after 90.days
delete_recorded_ip_geolocation_after 90.days
end
Two vocabularies on purpose. retain_..._for and retain_..._until say
how long evidence is kept; delete_..._after says when personal request
evidence goes away. They read differently because they are different
intentions, and the second one is the destructive one.
Instance Method Summary collapse
- #compile ⇒ Object
- #delete_recorded_browser_user_agent_after(duration) ⇒ Object
-
#delete_recorded_ip_address_after(duration) ⇒ Object
--- Optional request evidence -------------------------------------------.
- #delete_recorded_ip_geolocation_after(duration) ⇒ Object
-
#initialize(key) ⇒ RetentionBuilder
constructor
A new instance of RetentionBuilder.
- #keep_recorded_browser_user_agent_indefinitely ⇒ Object
-
#keep_recorded_ip_address_indefinitely ⇒ Object
Keeping the annex as long as the core event it corroborates, said in the retention class itself.
- #keep_recorded_ip_geolocation_indefinitely ⇒ Object
-
#retain_core_event_for(duration) ⇒ Object
--- The core event -------------------------------------------------------.
-
#retain_core_event_indefinitely ⇒ Object
The default, said out loud.
-
#retain_core_event_until(host_event_name) ⇒ Object
For obligations a duration cannot express — "five years, or three years after this contract is liquidated, whichever is later".
- #retain_recorded_browser_user_agent_until(host_event_name) ⇒ Object
- #retain_recorded_ip_address_until(host_event_name) ⇒ Object
- #retain_recorded_ip_geolocation_until(host_event_name) ⇒ Object
Constructor Details
#initialize(key) ⇒ RetentionBuilder
Returns a new instance of RetentionBuilder.
19 20 21 22 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 19 def initialize(key) @key = key.to_s @rules = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *_arguments, **_options) ⇒ Object (private)
102 103 104 105 106 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 102 def method_missing(name, *_arguments, **) raise DefinitionError, "Retention class #{@key} calls unknown DSL method `#{name}`. Check the spelling; " \ "Clickwrap never ignores retention declarations." end |
Instance Method Details
#compile ⇒ Object
87 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 87 def compile = RetentionClass.new(key: @key, rules: @rules) |
#delete_recorded_browser_user_agent_after(duration) ⇒ Object
52 53 54 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 52 def delete_recorded_browser_user_agent_after(duration) assign_rule!(:browser_user_agent, duration:) end |
#delete_recorded_ip_address_after(duration) ⇒ Object
--- Optional request evidence -------------------------------------------
48 49 50 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 48 def delete_recorded_ip_address_after(duration) assign_rule!(:ip_address, duration:) end |
#delete_recorded_ip_geolocation_after(duration) ⇒ Object
56 57 58 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 56 def delete_recorded_ip_geolocation_after(duration) assign_rule!(:ip_geolocation, duration:) end |
#keep_recorded_browser_user_agent_indefinitely ⇒ Object
79 80 81 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 79 def keep_recorded_browser_user_agent_indefinitely assign_rule!(:browser_user_agent, indefinite: true) end |
#keep_recorded_ip_address_indefinitely ⇒ Object
Keeping the annex as long as the core event it corroborates, said in the retention class itself. A corroboration that expires before the evidence it corroborates is a scheduled weakening of the record.
75 76 77 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 75 def keep_recorded_ip_address_indefinitely assign_rule!(:ip_address, indefinite: true) end |
#keep_recorded_ip_geolocation_indefinitely ⇒ Object
83 84 85 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 83 def keep_recorded_ip_geolocation_indefinitely assign_rule!(:ip_geolocation, indefinite: true) end |
#retain_core_event_for(duration) ⇒ Object
--- The core event -------------------------------------------------------
26 27 28 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 26 def retain_core_event_for(duration) assign_rule!(:core_event, duration:) end |
#retain_core_event_indefinitely ⇒ Object
The default, said out loud. Omitting the core-event rule means the same thing, but a retention class somebody will read in review is better off carrying the decision in words.
33 34 35 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 33 def retain_core_event_indefinitely assign_rule!(:core_event, indefinite: true) end |
#retain_core_event_until(host_event_name) ⇒ Object
For obligations a duration cannot express — "five years, or three years after this contract is liquidated, whichever is later". The named calculation is registered by the host on the configuration object, and it may legitimately return nil while the triggering event has not happened, in which case the record is simply not due yet.
42 43 44 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 42 def retain_core_event_until(host_event_name) assign_rule!(:core_event, host_event_name:) end |
#retain_recorded_browser_user_agent_until(host_event_name) ⇒ Object
64 65 66 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 64 def retain_recorded_browser_user_agent_until(host_event_name) assign_rule!(:browser_user_agent, host_event_name:) end |
#retain_recorded_ip_address_until(host_event_name) ⇒ Object
60 61 62 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 60 def retain_recorded_ip_address_until(host_event_name) assign_rule!(:ip_address, host_event_name:) end |
#retain_recorded_ip_geolocation_until(host_event_name) ⇒ Object
68 69 70 |
# File 'lib/clickwrap/dsl/retention_builder.rb', line 68 def retain_recorded_ip_geolocation_until(host_event_name) assign_rule!(:ip_geolocation, host_event_name:) end |