Class: Cryptoprocessing::Api::Auth::TokenStore
- Inherits:
-
Object
- Object
- Cryptoprocessing::Api::Auth::TokenStore
- Defined in:
- lib/cryptoprocessing/authentication/token_store.rb
Constant Summary collapse
- AUTHORIZATION_URI =
'https://accounts.google.com/o/oauth2/auth'- TOKEN_CREDENTIAL_URI =
'https://accounts.google.com/o/oauth2/token'
Instance Attribute Summary collapse
-
#store ⇒ Object
Storage object.
Instance Method Summary collapse
-
#credentials_hash ⇒ Hash
With credentials.
-
#initialize(store) ⇒ TokenStore
constructor
Initializes the Storage object.
-
#load_credentials ⇒ Object
Attempt to read in credentials from the specified store.
-
#refresh_authorization ⇒ Object
refresh credentials and save them to store.
-
#write_credentials ⇒ Object
Write the credentials to the specified store.
Constructor Details
#initialize(store) ⇒ TokenStore
Initializes the Storage object.
20 21 22 |
# File 'lib/cryptoprocessing/authentication/token_store.rb', line 20 def initialize(store) @store = store end |
Instance Attribute Details
#store ⇒ Object
Returns Storage object.
13 14 15 |
# File 'lib/cryptoprocessing/authentication/token_store.rb', line 13 def store @store end |
Instance Method Details
#credentials_hash ⇒ Hash
Returns with credentials.
45 46 47 48 49 50 51 52 53 |
# File 'lib/cryptoprocessing/authentication/token_store.rb', line 45 def credentials_hash { :authorization_uri => AUTHORIZATION_URI, :token_credential_uri => TOKEN_CREDENTIAL_URI, :issued_at => .issued_at.to_i, :auth_token => '', :user_id => '', } end |
#load_credentials ⇒ Object
Attempt to read in credentials from the specified store.
39 40 41 |
# File 'lib/cryptoprocessing/authentication/token_store.rb', line 39 def load_credentials store.load_credentials end |
#refresh_authorization ⇒ Object
refresh credentials and save them to store
33 34 35 |
# File 'lib/cryptoprocessing/authentication/token_store.rb', line 33 def self.write_credentials end |
#write_credentials ⇒ Object
Write the credentials to the specified store.
27 28 29 |
# File 'lib/cryptoprocessing/authentication/token_store.rb', line 27 def write_credentials store.write_credentials(credentials_hash) end |