class ThreeScaleToolbox::Commands::ActiveDocsCommand::Delete::DeleteSubcommand

Public Class Methods

command() click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/delete_command.rb, line 8
def self.command
  Cri::Command.define do
    name        'delete'
    usage       'delete <remote> <activedocs-id_or-system-name>'
    summary     'Delete an ActiveDocs'
    description 'Remove an ActiveDocs'
    runner DeleteSubcommand

    param   :remote
    param   :activedocs_id_or_system_name
  end
end

Public Instance Methods

run() click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/delete_command.rb, line 21
def run
  activedocs.delete
  puts "ActiveDocs with id: #{activedocs.id} deleted"
end

Private Instance Methods

activedocs() click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/delete_command.rb, line 36
def activedocs
  @activedocs ||= find_activedocs
end
find_activedocs() click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/delete_command.rb, line 40
def find_activedocs
  Entities::ActiveDocs.find(remote: remote, ref: ref).tap do |activedoc|
    raise ThreeScaleToolbox::Error, "ActiveDocs #{ref} does not exist" if activedoc.nil?
  end
end
ref() click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/delete_command.rb, line 32
def ref
  arguments[:activedocs_id_or_system_name]
end
remote() click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/delete_command.rb, line 28
def remote
  @remote ||= threescale_client(arguments[:remote])
end