Class: ThreeScaleToolbox::Commands::ActiveDocsCommand::Create::CreateSubcommand

Inherits:
Cri::CommandRunner
  • Object
show all
Includes:
ThreeScaleToolbox::Command, ResourceReader
Defined in:
lib/3scale_toolbox/commands/activedocs_command/create_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ResourceReader

#load_resource, #read_content, #read_file, #read_stdin, #read_stringio, #read_url

Methods included from ThreeScaleToolbox::Command

#config, #config_file, #exit_with_message, #fetch_required_option, included, #keep_alive, #remotes, #threescale_client, #verbose, #verify_ssl

Class Method Details

.commandObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/3scale_toolbox/commands/activedocs_command/create_command.rb', line 17

def self.command
  Cri::Command.define do
    name        'create'
    usage       'create <remote> <activedocs-name> <spec>'
    summary     'Create an ActiveDocs'
    description 'Create an ActiveDocs'

    option :i, :'service-id', "Specify the Service ID associated to the ActiveDocs", argument: :required
    option :p, :'published', "Specify it to publish the ActiveDoc on the Developer Portal. Otherwise it will be hidden", argument: :forbidden
    option nil, :'skip-swagger-validations', "Specify it to skip validation of the Swagger specification", argument: :forbidden
    option :d, :'description', "Specify the description of the ActiveDocs", argument: :required
    option :s, :'system-name', "Specify the system-name of the ActiveDocs", argument: :required
    ThreeScaleToolbox::CLI.output_flag(self)

    param   :remote
    param   :activedocs_name
    param   :activedocs_spec

    runner CreateSubcommand
  end
end

Instance Method Details

#runObject



39
40
41
42
# File 'lib/3scale_toolbox/commands/activedocs_command/create_command.rb', line 39

def run
  res = Entities::ActiveDocs.create(remote: remote, attrs: activedocs_attrs)
  printer.print_record res.attrs
end