Class: Vcloud::Core::QueryRunner
- Inherits:
-
Object
- Object
- Vcloud::Core::QueryRunner
- Defined in:
- lib/vcloud/core/query_runner.rb
Instance Method Summary collapse
-
#available_query_types ⇒ Array
List the available entity types which can be queried See integration test of this module for examples.
-
#initialize ⇒ QueryRunner
constructor
Create a new instance of the ServiceInterface as the @fsi global.
-
#run(type = nil, options = {}) ⇒ Array
Run a query (optionally for a particular entity type).
Constructor Details
#initialize ⇒ QueryRunner
Create a new instance of the ServiceInterface as the @fsi global
6 7 8 |
# File 'lib/vcloud/core/query_runner.rb', line 6 def initialize @fsi = Vcloud::Core::Fog::ServiceInterface.new end |
Instance Method Details
#available_query_types ⇒ Array
List the available entity types which can be queried
See integration test of this module for examples
37 38 39 40 |
# File 'lib/vcloud/core/query_runner.rb', line 37 def available_query_types query_body = @fsi.get_execute_query() get_entity_types_in_record_format(query_body) end |
#run(type = nil, options = {}) ⇒ Array
Run a query (optionally for a particular entity type)
23 24 25 26 27 28 29 30 31 |
# File 'lib/vcloud/core/query_runner.rb', line 23 def run(type=nil, ={}) raise ArgumentError, "Query API :format option is not supported" if [:format] if .has_key?(:page) || .has_key?(:pageSize) get_results_page(.fetch(:page, 1), type, ) || [] else get_all_results(type, ) end end |