Class: Vcloud::Core::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/vcloud/core/query.rb

Instance Method Summary collapse

Constructor Details

#initialize(type = nil, options = {}, query_runner = Vcloud::Core::QueryRunner.new) ⇒ Query

Returns a new instance of Query.



7
8
9
10
11
12
# File 'lib/vcloud/core/query.rb', line 7

def initialize(type=nil, options={}, query_runner = Vcloud::Core::QueryRunner.new)
  @type = type
  @options = options
  @options[:output_format] ||= 'tsv'
  @query_runner = query_runner
end

Instance Method Details

#get_all_resultsObject

DEPRECATED: Please use Vcloud::Core::QueryRunner.run instead.



23
24
25
26
# File 'lib/vcloud/core/query.rb', line 23

def get_all_results
  warn "[DEPRECATION] `Vcloud::Core::Query::get_all_results` is deprecated.  Please use `Vcloud::Core::QueryRunner.run` instead."
  @query_runner.run(@type, @options)
end

#runObject



14
15
16
17
18
19
20
# File 'lib/vcloud/core/query.rb', line 14

def run()
  if @type.nil?
    output_available_query_types
  else
    output_query_results
  end
end