Class: Gzr::Commands::Space::Create

Inherits:
Gzr::Command show all
Includes:
Space
Defined in:
lib/gzr/commands/space/create.rb

Instance Method Summary collapse

Methods included from Space

#all_spaces, #create_space, #delete_space, included, #process_args, #query_space, #query_space_children, #search_spaces

Methods inherited from Gzr::Command

#create_merge_query, #create_query, #field_expression, #field_names, #keys_to_keep, #merge_query, #pairs, #query, #render_csv, #run_inline_query

Methods included from Session

#build_connection_hash, #login, #logout_all, #pastel, #say_error, #say_ok, #say_warning, #v3_1_available?, #with_session

Constructor Details

#initialize(name, parent_space, options) ⇒ Create

Returns a new instance of Create.



32
33
34
35
36
37
# File 'lib/gzr/commands/space/create.rb', line 32

def initialize(name,parent_space, options)
  super()
  @name = name
  @parent_space = parent_space
  @options = options
end

Instance Method Details

#execute(input: $stdin, output: $stdout) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/gzr/commands/space/create.rb', line 39

def execute(input: $stdin, output: $stdout)
  space = nil
  with_session do
    space = create_space(@name, @parent_space)
    output.puts "Created space #{space.id}" unless @options[:plain] 
    output.puts space.id if @options[:plain] 
  end
end