class ThreeScaleToolbox::Commands::ActiveDocsCommand::List::ListSubcommand
Constants
- ACTIVEDOCS_FIELDS_TO_SHOW
Public Class Methods
command()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 8 def self.command Cri::Command.define do name 'list' usage 'list <remote>' summary 'List ActiveDocs' description 'List all defined ActiveDocs' ThreeScaleToolbox::CLI.output_flag(self) param :remote option :s, :'service-ref', "Filter the ActiveDocs by Service reference", argument: :required runner ListSubcommand end end
Public Instance Methods
run()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 23 def run printer.print_collection filtered_activedocs end
Private Instance Methods
filtered_activedocs()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 55 def filtered_activedocs filters.reduce(remote.list_activedocs) do |current_list, filter| filter.filter(current_list) end end
filters()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 47 def filters res = [] if !service_ref_filter.nil? res << AttributeFilters::ServiceIDFilterFromServiceRef.new(remote, service_ref_filter, "service_id") end res end
printer()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 38 def printer # keep backwards compatibility options.fetch(:output, CLI::CustomTablePrinter.new(ACTIVEDOCS_FIELDS_TO_SHOW)) end
remote()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 34 def remote @remote ||= threescale_client(arguments[:remote]) end
service_ref_filter()
click to toggle source
# File lib/3scale_toolbox/commands/activedocs_command/list_command.rb, line 43 def service_ref_filter options[:'service-ref'] end