Class: A2::Subcommand::User::Update
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- A2::Subcommand::User::Update
- Defined in:
- lib/a2/subcommands/user.rb
Instance Method Summary collapse
- #execute(id, display_name, password = nil) ⇒ Object
-
#initialize ⇒ Update
constructor
A new instance of Update.
Constructor Details
#initialize ⇒ Update
Returns a new instance of Update.
37 38 39 |
# File 'lib/a2/subcommands/user.rb', line 37 def initialize super('update-user', takes_commands: false) end |
Instance Method Details
#execute(id, display_name, password = nil) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/a2/subcommands/user.rb', line 41 def execute(id, display_name, password = nil) body = { 'name' => display_name} body['password'] = password unless password.nil? json = body.to_json puts JSON.pretty_generate(A2::Client.new(command_parser.data).update_user(id, json)) end |