Class: Google::APIClient::RedisStore Deprecated
- Inherits:
-
Object
- Object
- Google::APIClient::RedisStore
- Defined in:
- lib/google/api_client/auth/storages/redis_store.rb
Overview
Deprecated.
Use google-auth-library-ruby instead
Constant Summary collapse
- DEFAULT_REDIS_CREDENTIALS_KEY =
"google_api_credentials"
Instance Attribute Summary collapse
-
#redis ⇒ Object
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(redis, key = nil) ⇒ RedisStore
constructor
Initializes the RedisStore object.
-
#load_credentials ⇒ Hash
Attempt to read in credentials from redis.
- #redis_credentials_key ⇒ Object
-
#write_credentials(credentials_hash) ⇒ Object
Write the credentials to redis.
Constructor Details
#initialize(redis, key = nil) ⇒ RedisStore
Initializes the RedisStore object.
33 34 35 36 |
# File 'lib/google/api_client/auth/storages/redis_store.rb', line 33 def initialize(redis, key = nil) @redis= redis @redis_credentials_key = key end |
Instance Attribute Details
#redis ⇒ Object
Returns the value of attribute redis
24 25 26 |
# File 'lib/google/api_client/auth/storages/redis_store.rb', line 24 def redis @redis end |
Instance Method Details
#load_credentials ⇒ Hash
Attempt to read in credentials from redis.
41 42 43 44 |
# File 'lib/google/api_client/auth/storages/redis_store.rb', line 41 def load_credentials credentials = redis.get redis_credentials_key JSON.parse(credentials) if credentials end |
#redis_credentials_key ⇒ Object
46 47 48 |
# File 'lib/google/api_client/auth/storages/redis_store.rb', line 46 def redis_credentials_key @redis_credentials_key || DEFAULT_REDIS_CREDENTIALS_KEY end |
#write_credentials(credentials_hash) ⇒ Object
Write the credentials to redis.
54 55 56 |
# File 'lib/google/api_client/auth/storages/redis_store.rb', line 54 def write_credentials(credentials_hash) redis.set(redis_credentials_key, credentials_hash.to_json) end |