Class: Castle::Commands::EndImpersonation

Inherits:
Object
  • Object
show all
Defined in:
lib/castle/commands/end_impersonation.rb

Overview

builder for impersonate command

Class Method Summary collapse

Class Method Details

.build(options = {}) ⇒ Castle::Command

Parameters:

  • options (Hash) (defaults to: {})

Returns:



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/castle/commands/end_impersonation.rb', line 10

def build(options = {})
  Castle::Validators::Present.call(options, %i[user_id])
  context = Castle::Context::Sanitize.call(options[:context])

  Castle::Validators::Present.call(context, %i[user_agent ip])

  Castle::Command.new(
    'impersonate',
    options.merge(context: context, sent_at: Castle::Utils::GetTimestamp.call),
    :delete
  )
end