Class: CalendarAssistant::Config::TokenStore

Inherits:
Object
  • Object
show all
Defined in:
lib/calendar_assistant/config/token_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ TokenStore

Returns a new instance of TokenStore.



6
7
8
# File 'lib/calendar_assistant/config/token_store.rb', line 6

def initialize config
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/calendar_assistant/config/token_store.rb', line 4

def config
  @config
end

Instance Method Details

#delete(id) ⇒ Object



10
11
12
13
# File 'lib/calendar_assistant/config/token_store.rb', line 10

def delete id
  config.tokens.delete(id)
  config.persist!
end

#load(id) ⇒ Object



15
16
17
# File 'lib/calendar_assistant/config/token_store.rb', line 15

def load id
  config.tokens[id]
end

#store(id, token) ⇒ Object



19
20
21
22
# File 'lib/calendar_assistant/config/token_store.rb', line 19

def store id, token
  config.tokens[id] = token
  config.persist!
end