Class: Clickwrap::Presentation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Clickwrap::Presentation
- Defined in:
- lib/clickwrap/models/presentation.rb
Overview
A record of one presentation manifest.
Most presentations never become rows. The default path signs the manifest into a short-lived token and writes nothing on GET, because a render is not evidence and a row per page view is both slower and more personal data than the job needs.
Rows appear in two cases. A policy can explicitly retain pre-submit presentations for a documented reason, which some high-assurance flows want so that display attempts are visible. And every successful capture persists the manifest it accepted, because that one is part of the evidence.
The state vocabulary is deliberately careful. presented_by_server means
the server generated and offered this manifest — not that anyone saw it, not
that anyone read it, and certainly not that anyone accepted it.
Constant Summary collapse
- STATES =
%w[presented_by_server accepted rejected expired].freeze
Instance Method Summary collapse
- #accepted? ⇒ Boolean
- #expired?(at = Clickwrap.now) ⇒ Boolean
- #mark_accepted!(at: Clickwrap.now) ⇒ Object
- #mark_rejected!(at: Clickwrap.now) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#accepted? ⇒ Boolean
47 |
# File 'lib/clickwrap/models/presentation.rb', line 47 def accepted? = state == "accepted" |
#expired?(at = Clickwrap.now) ⇒ Boolean
46 |
# File 'lib/clickwrap/models/presentation.rb', line 46 def expired?(at = Clickwrap.now) = expires_at <= at |
#mark_accepted!(at: Clickwrap.now) ⇒ Object
49 50 51 |
# File 'lib/clickwrap/models/presentation.rb', line 49 def mark_accepted!(at: Clickwrap.now) update!(state: "accepted", submitted_at: at) end |
#mark_rejected!(at: Clickwrap.now) ⇒ Object
53 54 55 |
# File 'lib/clickwrap/models/presentation.rb', line 53 def mark_rejected!(at: Clickwrap.now) update!(state: "rejected", submitted_at: at) end |
#to_s ⇒ Object
57 |
# File 'lib/clickwrap/models/presentation.rb', line 57 def to_s = "presentation #{nonce} for #{policy_key}" |