Class: Boomloop::Authentication::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/boomloop/authentication/credentials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, store, options) ⇒ Credentials

Returns a new instance of Credentials.



6
7
8
9
10
# File 'lib/boomloop/authentication/credentials.rb', line 6

def initialize(username, store, options)
  self.username = username
  self.store = store
  self.options = options || {}
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/boomloop/authentication/credentials.rb', line 4

def options
  @options
end

#storeObject

Returns the value of attribute store.



4
5
6
# File 'lib/boomloop/authentication/credentials.rb', line 4

def store
  @store
end

#usernameObject

Returns the value of attribute username.



4
5
6
# File 'lib/boomloop/authentication/credentials.rb', line 4

def username
  @username
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/boomloop/authentication/credentials.rb', line 24

def [](key)
  self.options[key]
end

#saveObject



20
21
22
# File 'lib/boomloop/authentication/credentials.rb', line 20

def save
  self.store.update(self)
end

#update(tosave) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/boomloop/authentication/credentials.rb', line 12

def update(tosave)
  tosave.each do |key, value|
    self.options[key] = value
  end
  
  save
end