module Fog::VcloudDirector::Query

Public Instance Methods

find_by_query(options={}) click to toggle source
# File lib/fog/vcloud_director/query.rb, line 6
def find_by_query(options={})
  type = options.fetch(:type) { self.query_type }

  results = get_all_results(type, options)
  data = results.map do |query_record|
    model_data = {}
    model_data[:id] = query_record[:href].split('/').last
    model_data[:name] = query_record.fetch(:name) if query_record.key?(:name)
    if self.methods.include?(:populate_model_from_query_record)
      model_data.merge(self.populate_model_from_query_record(query_record))
    else
      model_data
    end
  end
  load(data)
end