Class: Locked::Commands::Authenticate

Inherits:
Object
  • Object
show all
Defined in:
lib/locked/commands/authenticate.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Authenticate

Returns a new instance of Authenticate.



6
7
8
# File 'lib/locked/commands/authenticate.rb', line 6

def initialize(context)
  @context = context
end

Instance Method Details

#build(options = {}) ⇒ Object



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

def build(options = {})
  Locked::Validators::Present.call(options, %i[event])
  context = Locked::Context::Merger.call(@context, options[:context])
  context = Locked::Context::Sanitizer.call(context)
  options_with_config = Locked::Configurations::Merger.call(options)

  Locked::Command.new(
    'authenticate',
    options_with_config.merge(context: context),
    :post
  )
end