Class: Google::Auth::Stores::FileTokenStore
- Inherits:
-
TokenStore
- Object
- TokenStore
- Google::Auth::Stores::FileTokenStore
- Defined in:
- lib/googleauth/stores/file_token_store.rb
Overview
Implementation of user token storage backed by a local YAML file
Instance Method Summary collapse
- #delete(id) ⇒ Object
-
#initialize(options = {}) ⇒ FileTokenStore
constructor
Create a new store with the supplied file.
- #load(id) ⇒ Object
- #store(id, token) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FileTokenStore
Create a new store with the supplied file.
42 43 44 45 |
# File 'lib/googleauth/stores/file_token_store.rb', line 42 def initialize( = {}) path = [:file] @store = YAML::Store.new(path) end |
Instance Method Details
#delete(id) ⇒ Object
58 59 60 |
# File 'lib/googleauth/stores/file_token_store.rb', line 58 def delete(id) @store.transaction { @store.delete(id) } end |
#load(id) ⇒ Object
48 49 50 |
# File 'lib/googleauth/stores/file_token_store.rb', line 48 def load(id) @store.transaction { @store[id] } end |
#store(id, token) ⇒ Object
53 54 55 |
# File 'lib/googleauth/stores/file_token_store.rb', line 53 def store(id, token) @store.transaction { @store[id] = token } end |