Class: Pickpocket::Authentication::TokenHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/pickpocket/authentication/token_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTokenHandler

Returns a new instance of TokenHandler.



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

def initialize
  @logger = Pickpocket::Logger
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/pickpocket/authentication/token_handler.rb', line 4

def logger
  @logger
end

Instance Method Details

#read_authObject



22
23
24
# File 'lib/pickpocket/authentication/token_handler.rb', line 22

def read_auth
  read_token(path: Pickpocket.config.authorization_token_file, error_message: 'Authorization Token file does not exist. Make sure you request authorization before proceeding.')
end

#read_oauthObject



18
19
20
# File 'lib/pickpocket/authentication/token_handler.rb', line 18

def read_oauth
  read_token(path: Pickpocket.config.oauth_token_file, error_message: 'OAuth Token file does not exist. Make sure you request authorization before proceeding.')
end

#save_auth(token) ⇒ Object



14
15
16
# File 'lib/pickpocket/authentication/token_handler.rb', line 14

def save_auth(token)
  save_token(token: token, path: Pickpocket.config.authorization_token_file)
end

#save_oauth(token) ⇒ Object



10
11
12
# File 'lib/pickpocket/authentication/token_handler.rb', line 10

def save_oauth(token)
  save_token(token: token, path: Pickpocket.config.oauth_token_file)
end