Class: OSCRuby::QueryResults

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

Instance Method Summary collapse

Methods included from ValidationsModule

check_client, check_query

Methods included from NormalizeModule

iterate_through_rows, normalize

Constructor Details

#initializeQueryResults

Returns a new instance of QueryResults.



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

def initialize; end

Instance Method Details

#query(client, query) ⇒ Object



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

def query(client,query)

	ValidationsModule::check_client(client)

	ValidationsModule::check_query(query,"query")

	@query = URI.escape("queryResults/?query=#{query}")
   	
   	obj_to_find = OSCRuby::Connect.get(client,@query)

	if obj_to_find.code.to_i == 200 || obj_to_find.code.to_i == 201

		response = NormalizeModule::normalize(obj_to_find)
	else

		response = obj_to_find.body

	end

   	JSON.parse(response) 
		
end