class PupilfirstXapi::Outbox
Attributes
lrs[R]
repository[R]
uri_for[R]
Public Class Methods
<<(payload)
click to toggle source
# File lib/pupilfirst_xapi/outbox.rb, line 24 def <<(payload) Outbox::Job.perform_later(payload) end
new(lrs:, repository:, uri_for:)
click to toggle source
# File lib/pupilfirst_xapi/outbox.rb, line 29 def initialize(lrs:, repository:, uri_for:) @lrs = lrs @repository = repository @uri_for = uri_for end
Public Instance Methods
call(**payload)
click to toggle source
# File lib/pupilfirst_xapi/outbox.rb, line 35 def call(**payload) @lrs.call(statement_for(**payload)) end
Private Instance Methods
builder_for(event_type)
click to toggle source
# File lib/pupilfirst_xapi/outbox.rb, line 52 def builder_for(event_type) Statements.builder_for(event_type).new(repository, uri_for) end
statement_args(**args)
click to toggle source
# File lib/pupilfirst_xapi/outbox.rb, line 48 def statement_args(**args) args.slice(:actor_id, :resource_id) end
statement_for(event_type:, timestamp:, **args)
click to toggle source
# File lib/pupilfirst_xapi/outbox.rb, line 42 def statement_for(event_type:, timestamp:, **args) builder_for(event_type).call(**statement_args(**args)).tap do |statement| statement&.stamp(id: nil, timestamp: timestamp) end end