<commit_before>namespace :v1 do
	task :default do

	end

	desc "Get the directory listings updates. [uuid] if not specified, returns all."
	task :updates, [:public_key, :private_key, :uuid, :since] do |t, args|
		TrustedSearch.public_key = args.public_key
		TrustedSearch.private_key = args.private_key
		TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')
		uuid = ( args.uuid.nil? ? nil : args.uuid)
		if(uuid == "")
			uuid = nil
		end
		since = ( args.since.nil? ? nil : args.since)
		api = TrustedSearch::V1.new
		puts api.getBusinessUpdate(uuid, since).data.to_s
	end

	desc "Submit a listings to be enhanced and created."

	task :submit, [:public_key, :private_key, :file] do |t, args|
		TrustedSearch.public_key = args.public_key
		TrustedSearch.private_key = args.private_key
		TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')
		body_file = ( args.file ? args.file : nil)
		if(body_file.nil?)
			puts "You must specify a valid body file."
			next
		end

		api = TrustedSearch::V1.new
		file = File.open(body_file, "rb")
		contents = file.read
		response = api.postBusiness(JSON.parse(contents))
		file.close
		puts response.data
	end

	task :test_fulfillment, [:public_key, :private_key, :uuid] do |t, args|
		TrustedSearch.public_key = args.public_key
		TrustedSearch.private_key = args.private_key
		TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')

		location_id = args.uuid
		location_id = ( args.uuid ? args.uuid : nil)

		if(location_id.nil?)
			puts "You must specify a uuid of the business you wish to test."
			next
		end

		api = TrustedSearch::V1.new
		response = api.putTestFulfillment(location_id)
		puts response.data
	end
end<commit_msg>Add try/catch for rake tasks<commit_after>namespace :v1 do
	task :default do

	end

	desc "Get the directory listings updates. [uuid] if not specified, returns all."
	task :updates, [:public_key, :private_key, :uuid, :since] do |t, args|
		TrustedSearch.public_key = args.public_key
		TrustedSearch.private_key = args.private_key
		TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')
		uuid = ( args.uuid.nil? ? nil : args.uuid)
		if(uuid == "")
			uuid = nil
		end
		since = ( args.since.nil? ? nil : args.since)
		api = TrustedSearch::V1.new
		begin
			puts api.getBusinessUpdate(uuid, since).data.to_s
		rescue Exception => e
			puts e.message
			puts e.body
			puts e.code
		end

	end

	desc "Submit a listings to be enhanced and created."

	task :submit, [:public_key, :private_key, :file] do |t, args|
		TrustedSearch.public_key = args.public_key
		TrustedSearch.private_key = args.private_key
		TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')
		body_file = ( args.file ? args.file : nil)
		if(body_file.nil?)
			puts "You must specify a valid body file."
			next
		end

		api = TrustedSearch::V1.new
		file = File.open(body_file, "rb")
		contents = file.read

		begin
			response = api.postBusiness(JSON.parse(contents))
			puts response.data
			puts response.code
		rescue Exception => e
			puts e.body
		end

		file.close
		puts response.data
	end

	task :test_fulfillment, [:public_key, :private_key, :uuid] do |t, args|
		TrustedSearch.public_key = args.public_key
		TrustedSearch.private_key = args.private_key
		TrustedSearch.environment = ( ENV['env'] ? ENV['env'] : 'sandbox')

		location_id = args.uuid
		location_id = ( args.uuid ? args.uuid : nil)

		if(location_id.nil?)
			puts "You must specify a uuid of the business you wish to test."
			next
		end

		api = TrustedSearch::V1.new

		begin
			response = api.putTestFulfillment(location_id)
			puts response.data
			puts response.code
		rescue Exception => e
			puts e.body
		end


	end
end
{'fraction_non_alphanumeric': 0.12004316158618829, 'fraction_numerical': 0.002158079309414621, 'mean_word_length': 3.753846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '303159', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1308, 'n_words': 340}