Class: AocCli::Commands::KeyStore

Inherits:
Object
  • Object
show all
Defined in:
lib/aoc_cli/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ KeyStore

Returns a new instance of KeyStore.



5
6
7
8
# File 'lib/aoc_cli/commands.rb', line 5

def initialize(args)
	args = defaults.merge(args).compact
	@user, @key = args[:user], args[:key]
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/aoc_cli/commands.rb', line 4

def key
  @key
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/aoc_cli/commands.rb', line 4

def user
  @user
end

Instance Method Details

#defaultsObject



16
17
18
# File 'lib/aoc_cli/commands.rb', line 16

def defaults
	{ user:"main" }
end

#execObject



9
10
11
12
# File 'lib/aoc_cli/commands.rb', line 9

def exec
	Files::Config::Cookie.store(user:user, key:key)
	self
end

#respondObject



13
14
15
# File 'lib/aoc_cli/commands.rb', line 13

def respond
	puts "Key added successfully"
end