Class: ThreeScaleToolbox::Commands::ActiveDocsCommand::Apply::ApplySubcommand
- Inherits:
-
Cri::CommandRunner
- Object
- Cri::CommandRunner
- ThreeScaleToolbox::Commands::ActiveDocsCommand::Apply::ApplySubcommand
- Includes:
- ThreeScaleToolbox::Command, ResourceReader
- Defined in:
- lib/3scale_toolbox/commands/activedocs_command/apply_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ResourceReader
#load_resource, #read_content, #read_file, #read_stdin, #read_url
Methods included from ThreeScaleToolbox::Command
#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl
Class Method Details
.command ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/3scale_toolbox/commands/activedocs_command/apply_command.rb', line 27 def self.command Cri::Command.define do name 'apply' usage 'apply <remote> <activedocs_id_or_system_name>' summary 'Update activedocs' description 'Create or update an ActiveDocs' option :i, :'service-id', "Specify the Service ID associated to the ActiveDocs", argument: :required option :p, :'publish', "Specify it to publish the ActiveDocs on the Developer Portal. Otherwise it will be hidden", argument: :forbidden option nil, :'hide', "Specify it to hide the ActiveDocs on the Developer Portal", argument: :forbidden option nil, :'skip-swagger-validations', "Skip validation of the Swagger specification. true or false", argument: :required, transform: ThreeScaleToolbox::Helper::BooleanTransformer.new option :d, :'description', "Specify the description of the ActiveDocs", argument: :required option :s, :'name', "Specify the name of the ActiveDocs", argument: :required option nil, :'openapi-spec', "Specify the swagger spec. Can be a file, an URL or '-' to read from stdin. This option is mandatory when applying the ActiveDoc for the first time", argument: :required param :remote param :activedocs_id_or_system_name ThreeScaleToolbox::CLI.output_flag(self) runner ApplySubcommand end end |
Instance Method Details
#run ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/3scale_toolbox/commands/activedocs_command/apply_command.rb', line 51 def run validate_option_params res = activedocs if !res res = Entities::ActiveDocs.create(remote: remote, attrs: create_activedocs_attrs) else res.update(activedocs_attrs) unless activedocs_attrs.empty? end printer.print_record res.attrs end |