psd-api

0.0.3 • Public • Published

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.

Package Sidebar

Install

npm i psd-api

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • abdallahozaifa