Sha256: 9b71826788e3460180df85e1d11d291fdf0fc5cf9dc16f94f951e3740686feaa

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

var aatVar = [];

function aatAPIQuery(query) {
    cleanQuery = query.replace(/[^a-zA-Z0-9]\s/g, '');
    cleanQuery = cleanQuery.replace(" ", "+");
    cleanQuery = cleanQuery.replace('%20', "");
    cleanQuery = cleanQuery.replace("AAT", "");
    cleanQuery = cleanQuery.replace("aat", "");
    console.log(cleanQuery);
    aatVar = [];
    Rails.ajax({
        url: "/vaultify/aat.json",
        async: false,
        type: "GET",
        data: "cleanQuery=" + cleanQuery,
        success: function (result) {
            var dup = [];
            result.forEach(function (element) {
                console.log(element);
                if (!dup.includes(element.preferred_term)) {
                    dup.push(element.preferred_term);
                    aatVar.push(JSON.parse('{"text":"' + element.preferred_term + '", "url":"' + element.subject_id + '"}'));
                }
            });
        }
    });


    const options = {
        hostname: 'vocabsservices.getty.edu',
        path: '/AATService.asmx/AATGetTermMatch?term=' + cleanQuery + '&logop=&notes=',
        //headers: {
        //    'Authorization': 'Basic ' + 'user' + ':' + 'pass'
        //},
        method: 'GET',
    };
    console.log(options);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vaultify-0.1.3 app/assets/javascripts/vaultify/aat.js
vaultify-0.1.1 app/assets/javascripts/vaultify/aat.js
vaultify-0.1.0 app/assets/javascripts/vaultify/aat.js