Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including psd-api with all npm packages installed. Try it out:

var psdApi = require("psd-api")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

psd-api v0.0.3

A Penn State Directory extractor that pretends to be an API

npm version Build Status

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': 'hea113@psu.edu',
  'Mail ID': 'hea113@psu.edu',
  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: "hea113@psu.edu"}, callback);

/* Search with first name, last name, userID, and email */
psd.get({firstName: "Hozaifa", lastName: "Abdalla", userID: "hea113", email: "hea113@psu.edu"}, 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("hea113@psu.edu", 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.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free