Class: Vcloud::Query
- Inherits:
-
Object
- Object
- Vcloud::Query
- Defined in:
- lib/vcloud/core/query.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #fields ⇒ Object
- #filter ⇒ Object
- #get_all_results ⇒ Object
-
#initialize(type = nil, options = {}) ⇒ Query
constructor
A new instance of Query.
- #output_format ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(type = nil, options = {}) ⇒ Query
Returns a new instance of Query.
9 10 11 12 13 14 15 |
# File 'lib/vcloud/core/query.rb', line 9 def initialize(type=nil, ={}) @type = type @options = @options[:output_format] ||= 'tsv' Fog.mock! if ENV['FOG_MOCK'] || [:mock] @fsi = Vcloud::Fog::ServiceInterface.new end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/vcloud/core/query.rb', line 7 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/vcloud/core/query.rb', line 6 def type @type end |
Instance Method Details
#fields ⇒ Object
25 26 27 |
# File 'lib/vcloud/core/query.rb', line 25 def fields [:fields] end |
#filter ⇒ Object
17 18 19 |
# File 'lib/vcloud/core/query.rb', line 17 def filter [:filter] end |
#get_all_results ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/vcloud/core/query.rb', line 41 def get_all_results results = [] (1..get_num_pages).each do |page| results += get_results_page(page) || [] end results end |
#output_format ⇒ Object
21 22 23 |
# File 'lib/vcloud/core/query.rb', line 21 def output_format [:output_format] end |
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vcloud/core/query.rb', line 29 def run() puts "options:" if @options[:debug] pp @options if @options[:debug] if @type.nil? output_potential_query_types else output_query_results end end |