Class: Castle::Commands::Authenticate

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

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Authenticate

Returns a new instance of Authenticate.



6
7
8
# File 'lib/castle/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
# File 'lib/castle/commands/authenticate.rb', line 10

def build(options = {})
  validate!(options)
  context = ContextMerger.call(@context, options[:context])
  context = ContextSanitizer.call(context)

  Castle::Command.new('authenticate',
                      options.merge(context: context,
                                    sent_at: Castle::Utils::Timestamp.call),
                      :post)
end