Class: PF::QiniuAccountCommand
- Inherits:
-
CommandBase
- Object
- Thor
- CommandBase
- PF::QiniuAccountCommand
- Defined in:
- lib/pf/cli/qiniu_account.rb
Constant Summary collapse
- @@myself =
"account"
Instance Method Summary collapse
Methods inherited from CommandBase
Instance Method Details
#add(name, access_key, secret_key) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pf/cli/qiniu_account.rb', line 14 def add(name, access_key, secret_key) qiniu = Profile.qiniu if qiniu.exist_account?(name) qiniu.account(name).access_key = access_key qiniu.account(name).secret_key = secret_key else account = SecretKeyAccount.new(name, access_key, secret_key) qiniu.accounts.push(account) if qiniu.accounts.size == 1 or [:default] qiniu.default_account = name end end qiniu.save end |