Class: Vcloud::QueryRunner

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

Instance Method Summary collapse

Constructor Details

#initializeQueryRunner

Returns a new instance of QueryRunner.



4
5
6
# File 'lib/vcloud/core/query_runner.rb', line 4

def initialize
  @fsi = Vcloud::Fog::ServiceInterface.new
end

Instance Method Details

#available_query_typesObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/vcloud/core/query_runner.rb', line 12

def available_query_types
  query_list = @fsi.get_execute_query()
  query_list[:Link].select do |link|
    link[:rel] == 'down'
  end.map do |link|
    href  = Nokogiri::XML.fragment(link[:href])
    query = CGI.parse(URI.parse(href.text).query)
    [query['type'].first, query['format'].first]
  end
end

#run(type = nil, options = {}) ⇒ Object



8
9
10
# File 'lib/vcloud/core/query_runner.rb', line 8

def run(type=nil, options={})
  get_all_results(type, options)
end