Class: Fnsapi::AuthService

Inherits:
BaseService show all
Defined in:
lib/fnsapi/auth_service.rb

Instance Method Summary collapse

Methods inherited from BaseService

#client

Instance Method Details

#reset_credentialsObject

Raises:



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fnsapi/auth_service.rb', line 5

def reset_credentials
  result = client.call(:get_message, message: message_hash)
  message = result.body.dig(:get_message_response, :message)

  raise RequestError, message[:fault][:message] if message[:fault]

  token = message.dig(:auth_response, :result, :token)
  expired_at = Time.parse(message.dig(:auth_response, :result, :expire_time))

  return if token.blank?

  put_token!(token, expired_at)
  token
end