Sha256: 0c1d3d8a8a905dd1e9e2f1d1a1bc61772b4bde4917822555ce78de45e3b17033

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

require 'osc_ruby/connect'
require 'osc_ruby/modules/validations_module'
require 'osc_ruby/modules/normalize_module'
require 'osc_ruby/modules/query_module'
require 'json'

module OSCRuby

	class QueryResults

		include QueryModule
		include ValidationsModule

		def initialize; end

		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) 

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

	    	if return_json.class == Hash
	    		puts json_response.body
	    	else
		    	json_response.unshift("\n")
		    	NormalizeModule::remove_new_lines(json_response)
 			end
 			
		end
	
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
osc_ruby-1.0.3 lib/osc_ruby/classes/query_results.rb