Module: Appilf::Authentication

Included in:
Client
Defined in:
lib/appilf/authentication.rb

Constant Summary collapse

PATH =
"#{APIActions::BASE_API_URL}/oauth2/token"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



6
7
8
# File 'lib/appilf/authentication.rb', line 6

def access_token
  @access_token
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/appilf/authentication.rb', line 6

def password
  @password
end

#token_typeObject

Returns the value of attribute token_type.



6
7
8
# File 'lib/appilf/authentication.rb', line 6

def token_type
  @token_type
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/appilf/authentication.rb', line 6

def user
  @user
end

#usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/appilf/authentication.rb', line 6

def username
  @username
end

Instance Method Details

#authenticateObject



13
14
15
# File 'lib/appilf/authentication.rb', line 13

def authenticate
  auth_by_password if username && password
end

#authenticated_user_pathObject



21
22
23
# File 'lib/appilf/authentication.rb', line 21

def authenticated_user_path
  users_path(user.id)
end

#authentication_headersObject



17
18
19
# File 'lib/appilf/authentication.rb', line 17

def authentication_headers
  { Authorization: self.access_token }
end