psd-api
v0.0.3
Published
A Penn State Directory extractor that pretends to be an API
Downloads
65
Maintainers
Readme
Penn-State-Directory-API
The Penn State Directory API.
##Installation
Node.js
$ npm install psd-api --save
To install the latest development version:
npm install git+https://github.com/Abdallahozaifa/Penn-State-Directory-API
##Usage
###Node.js
/* Creating an instance of the psd scraper */
var psd = require("psd-api");
/* Callback that will execute once the students information is received */
var callback = function(student) {
console.log(student);
};
/* Obtaining the students information */
psd.get("Hozaifa Abdalla", callback);
Output:
{
Name: 'HOZAIFA ELHAFIZ ABDALLA',
'E-mail': '[email protected]',
'Mail ID': '[email protected]',
Title: 'UNDERGRAD STUDENT',
Campus: 'PENN STATE ERIE, THE BEHREND COLLEGE',
Curriculum: 'SOFTWARE ENGINEERING'
}
API
Obtaining students
psd.get(object, callback)
var psd = require("psd-api");
/* Search with first and last names */
psd.get({firstName: "Hozaifa", lastName: "Abdalla"}, callback);
/* Search with userID */
psd.get({userID: "hea113"}, callback);
/* Search with email */
psd.get({email: "[email protected]"}, callback);
/* Search with first name, last name, userID, and email */
psd.get({firstName: "Hozaifa", lastName: "Abdalla", userID: "hea113", email: "[email protected]"}, callback);
psd.get(array, callback)
/* Defining an array of students to be searched */
var students = [{firstName:"Hozaifa", lastName: "Abdalla"}, {firstName: "Kenneth", lastName: "Schnall"}];
/* callback that will handle each student */
var callback = function(student){
console.log(student);
}
/* Search an array of students */
psd.get(students, callback);
or
/* Search multiple students using iteration */
for(var student in students){
psd.get(student,callback);
}
psd.get(string, callback)
/* Search with first and last names */
psd.get("Hozaifa Abdalla", callback);
/* Search with userID */
psd.get("hea113", callback);
/* Search with email */
psd.get("[email protected]", callback);
Authors
psd-api was created by Hozaifa Abdalla and Kenneth Schnall.
License
psd-api is copyright (c) 2016 Hozaifa Abdalla, Kenneth Schnall. psd-api is free software, licensed under the MIT License, See the file LICENSE.md
in this distribution for more details.