Class: Castle::Failover::PrepareResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/castle/failover/prepare_response.rb

Overview

generate failover authentication response

Instance Method Summary collapse

Constructor Details

#initialize(user_id, reason:, strategy:) ⇒ PrepareResponse

Returns a new instance of PrepareResponse.



7
8
9
10
11
# File 'lib/castle/failover/prepare_response.rb', line 7

def initialize(user_id, reason:, strategy:)
  @strategy = strategy
  @reason = reason
  @user_id = user_id
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/castle/failover/prepare_response.rb', line 13

def call
  {
    # v1/risk v1/filter structure
    policy: {
      action: @strategy.to_s
    },
    # v1/authenticate structure
    action: @strategy.to_s,
    user_id: @user_id,
    failover: true,
    failover_reason: @reason
  }
end