Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New internal api #20

Open
Glavin001 opened this issue May 22, 2015 · 4 comments
Open

New internal api #20

Glavin001 opened this issue May 22, 2015 · 4 comments
Assignees
Milestone

Comments

@Glavin001
Copy link
Owner

image

/cc @valencik

@Glavin001
Copy link
Owner Author

Look into x-ray: https://github.com/lapwinglabs/x-ray

@Glavin001 Glavin001 added this to the v1.0.0 milestone May 23, 2015
@Glavin001 Glavin001 self-assigned this May 23, 2015
@Glavin001
Copy link
Owner Author

Bluebird for Promises: https://github.com/petkaantonov/bluebird

@Glavin001
Copy link
Owner Author

Ideas for API usage, with inspiration from https://github.com/mikedeboer/node-github#example and others.

// Require
var Banner = require('self-service-banner');

// Create and configure instance
var banner = Banner({
  // Required
  "host": "https://ssb-nlive.smu.ca",
  // Optional: Required only for authenticated requests (Login)
  "username": creds.username, 
  "password": creds.password 
});

// Optional: all authenticated requests will implicitly call login before, if not already logged in
banner.login(/* optionally pass the credentials as argument to login method */)
.then(function() {
  // Is logged in.
  // All subsequent requests will use this authentication.
  // Only a single session is stored for this banner instance,
  // therefore logging in again will create a new session with Banner's server
})
.catch(function(error) {
  // Could not log in. Banner occurred...
  console.error(error);
});

// Unauthenticated request
// Does not request login or user credentials
banner.terms()
.then(function(terms) {
  console.log(terms); // Array of terms
});

// Authenticated request
// Requires user credentials
// Will login before if not previously logged in
banner.weekAtAGlance()
.then(function(weekSchedule) {
  // Courses for this week's schedule
  // For the currently logged in user
});

@Glavin001
Copy link
Owner Author

Look into using a loader such that it would automatically load new files in a directory. See http://stackoverflow.com/a/5365577/2578205http://stackoverflow.com/a/5365577/2578205
Thus we could simply add new modules to a directory and not have to register them in the main code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant