Class: Locked::FailoverResponse::Auth

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

Overview

generate failover authentication response

Instance Method Summary collapse

Constructor Details

#initialize(user_id, strategy: Locked.config.failover_strategy, reason:) ⇒ Auth

Returns a new instance of Auth.



7
8
9
10
11
# File 'lib/locked/failover_response.rb', line 7

def initialize(user_id, strategy: Locked.config.failover_strategy, reason:)
  @strategy = strategy
  @reason = reason
  @user_id = user_id
end

Instance Method Details

#generateObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/locked/failover_response.rb', line 13

def generate
  {
    data: {
      action: @strategy.to_s,
      user_id: @user_id,
    },
    failover: true,
    failover_reason: @reason
  }
end