Class: A2::Subcommand::User::Create

Inherits:
CmdParse::Command
  • Object
show all
Defined in:
lib/a2/subcommands/user.rb

Instance Method Summary collapse

Constructor Details

#initializeCreate

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