Class: Textus::Application::Read::Pulse::Impl

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/read/pulse.rb

Instance Method Summary collapse

Constructor Details

#initialize(ctx:, caps:, session:) ⇒ Impl

Returns a new instance of Impl.



17
18
19
20
21
22
23
24
25
26
# File 'lib/textus/application/read/pulse.rb', line 17

def initialize(ctx:, caps:, session:)
  @ctx = ctx
  @caps = caps
  @manifest   = caps.manifest
  @file_store = caps.file_store
  @audit_log  = caps.audit_log
  @root       = caps.root
  @events     = caps.events
  @session    = session
end

Instance Method Details

#call(since: 0) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/textus/application/read/pulse.rb', line 28

def call(since: 0)
  freshness_rows = freshness.call
  {
    "cursor" => @audit_log.latest_seq,
    "changed" => audit_changes_since(since),
    "stale" => freshness_rows.select { |r| r[:status] == :stale }.map { |r| r[:key] },
    "pending_review" => review_keys,
    "doctor" => doctor_summary,
    "manifest_etag" => manifest_etag,
    "next_due_at" => soonest_due(freshness_rows),
    "hook_errors" => hook_errors_since(since),
  }
end