Class: Skala::AlephAdapter::AuthenticateUser

Inherits:
Object
  • Object
show all
Defined in:
lib/skala/aleph_adapter/authenticate_user.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ AuthenticateUser

Returns a new instance of AuthenticateUser.



5
6
7
# File 'lib/skala/aleph_adapter/authenticate_user.rb', line 5

def initialize(adapter)
  @adapter = adapter
end

Instance Method Details

#call(user_id, password) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/skala/aleph_adapter/authenticate_user.rb', line 9

def call(user_id, password)
  @adapter.x_services.post(
    op: :"bor-auth",
    bor_id: user_id,
    library: @adapter.default_user_library,
    verification: password
  )
  .try do |_response|
    if  _response.include?("<z303>")
      true
    elsif  _response.include?("error")
      false
    else
      StandardError.new
    end
  end
end