Class: Netscaler::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/netscaler/executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(request_class) ⇒ Executor

Returns a new instance of Executor.



9
10
11
# File 'lib/netscaler/executor.rb', line 9

def initialize(request_class)
  @request_class = request_class
end

Instance Method Details

#execute!(args, options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/netscaler/executor.rb', line 13

def execute!(args, options)
  Netscaler::Logging.configure(options[:debug])

  Netscaler::Transaction.new options[:netscaler] do |client|
    @request_class.new(client).send(options[:action], args[0], options) do |response|
      if options[:json]
        puts JSON.pretty_generate(response)
      else
        STDERR.puts "Tempoararily disabled stdout. Use --json instead.  Sorry...."
        # puts Hirb::Helpers::Tree.render(response)
      end
    end
  end
end