Class: OSCRuby::QueryResults

Inherits:
Object
  • Object
show all
Includes:
QueryModule, ValidationsModule
Defined in:
lib/osc_ruby/classes/query_results.rb

Instance Method Summary collapse

Methods included from ValidationsModule

attr_hash_exists_and_is_type_of, check_attributes, check_attributes_request, check_client, check_for_id, check_for_names, check_for_parents, check_interfaces, check_obj_for_errors, check_object_for_id, check_query, extract_attributes

Methods included from QueryModule

create, destroy, find, nested_find, update

Methods included from NormalizeModule

nested_normalize, normalize, query_injection, remove_new_lines

Constructor Details

#initializeQueryResults

Returns a new instance of QueryResults.



14
# File 'lib/osc_ruby/classes/query_results.rb', line 14

def initialize; end

Instance Method Details

#query(client, query, return_json = false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/osc_ruby/classes/query_results.rb', line 16

def query(client,query,return_json = false)

	ValidationsModule::check_client(client)

	ValidationsModule::check_query(query,"query")

	@query = URI.escape("queryResults/?query=#{query}")

   	response = QueryModule::find(client,@query)

   	json_response = JSON.parse(response) 

   	json_response.unshift("\n")

   	if return_json == true
   		json_response_final = NormalizeModule::query_injection(query,json_response)
   		puts json_response_final
   	end

   	NormalizeModule::remove_new_lines(json_response)
 
end