Class: A2::Subcommand::User::Create
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- A2::Subcommand::User::Create
- Defined in:
- lib/a2/subcommands/user.rb
Instance Method Summary collapse
- #execute(id, display_name = id, password) ⇒ Object
-
#initialize ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize ⇒ Create
Returns a new instance of Create.
14 15 16 |
# File 'lib/a2/subcommands/user.rb', line 14 def initialize super('create-user', takes_commands: false) end |
Instance Method Details
#execute(id, display_name = id, password) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/a2/subcommands/user.rb', line 18 def execute(id, display_name = id, password) json = { 'id' => id, 'name' => display_name, 'password' => password }.to_json puts JSON.pretty_generate(A2::Client.new(command_parser.data).create_user(json)) end |