<commit_before>require 'rest-open-uri'
require 'nokogiri'
require './config_module'

include ConfigModule
args = get_vars('util.conf')
username = args['username']
password = args['password']

auth_json = "{\"UserId\":\"#{username}\",\"Password\":\"<PASSWORD>}\",\"InterfaceId\":\"<PASSWORD>\"}"
response = open('https://eds-api.ebscohost.com/authservice/rest/UIDAuth', :method=>:post, :body => auth_json, 'Content-Type' => 'application/json')
puts response.read
#doc = Nokogiri::XML(response.read)
#doc.remove_namespaces!
#auth_token = doc.xpath("//AuthToken").inner_text
#puts auth_token
#session_info = open("http://eds-api.ebscohost.com/edsapi/rest/createsession?WSapi", :method=>:get, "x-authenticationToken"=>auth_token)
#puts session_info
<commit_msg>Trying to get CreateSession working.<commit_after>require 'rest-open-uri'
require 'nokogiri'
require './config_module'

include ConfigModule
args = get_vars('util.conf')
username = args['username']
password = args['password']

auth_json = "{\"UserId\":\"#{username}\",\"Password\":\"<PASSWORD>}\",\"InterfaceId\":\"<PASSWORD>\"}"
response = open('https://eds-api.ebscohost.com/authservice/rest/UIDAuth', :method=>:post, :body => auth_json, 'Content-Type' => 'application/json')
#puts response.read
doc = Nokogiri::XML(response.read)
doc.remove_namespaces!
auth_token = doc.xpath("//AuthToken").inner_text
puts auth_token

session_json = '{"Profile":"api_demo","Guest":"n"}'
session_info = open("http://eds-api.ebscohost.com/edsapi/rest/CreateSession", :method=>:get, :body=>session_json, "x-authenticationToken"=>auth_token)
puts session_info.read

{'fraction_non_alphanumeric': 0.20062305295950156, 'fraction_numerical': 0.0, 'mean_word_length': 7.111111111111111, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 18, 'https://': 2, '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': '7597130', 'n_tokens_mistral': 551, 'n_tokens_neox': 553, 'n_words': 83}