Module: FmRest::Spyke::Model::Auth

Extended by:
ActiveSupport::Concern
Included in:
FmRest::Spyke::Model
Defined in:
lib/fmrest/spyke/model/auth.rb

Class Method Summary collapse

Class Method Details

.logoutBoolean

Logs out the database session for this model (and other models using the same credentials). Unlike logout!, no exception is raised in case of missing session token.

Returns:

  • (Boolean)

    Whether the logout request was sent (it's only sent if a session token was previously set)



25
26
27
28
29
30
# File 'lib/fmrest/spyke/model/auth.rb', line 25

def logout
  logout!
  true
rescue FmRest::V1::TokenSession::NoSessionTokenSet
  false
end

.logout!Object

Logs out the database session for this model (and other models using the same credentials).

Raises:

  • (FmRest::V1::TokenSession::NoSessionTokenSet)

    if no session token was set (and no request is sent).



15
16
17
# File 'lib/fmrest/spyke/model/auth.rb', line 15

def logout!
  connection.delete(FmRest::V1.session_path("dummy-token"))
end

.request_auth_tokenObject



32
33
34
# File 'lib/fmrest/spyke/model/auth.rb', line 32

def request_auth_token
  FmRest::V1.request_auth_token(FmRest::V1.auth_connection(fmrest_config))
end

.request_auth_token!Object



36
37
38
# File 'lib/fmrest/spyke/model/auth.rb', line 36

def request_auth_token!
  FmRest::V1.request_auth_token!(FmRest::V1.auth_connection(fmrest_config))
end