@njerig/rate-my-professors
TypeScript icon, indicating that this package has built-in type declarations

0.1.3Β β€’Β PublicΒ β€’Β Published

πŸ§‘β€πŸ« @njerig/rate-my-professors

codecov

A basic wrapper for Rate My Professors's GraphQL API. Includes TypeScript definitions.

It is possible to pull full ratings with content as well, but currently this package just returns the average.

πŸ— Usage

// Change to 
// const ratings = require('@mtucourses/rate-my-professors').default;
// if using JS instead of TS
import createRmpClient from '@njerig/rate-my-professors';

(async () => {
  const ratings = createRmpClient(10000) // timeout = 10s
  const schools = await ratings.searchSchool('michigan technological university');

  console.log(schools);
  /*
    [
      {
        city: 'Houghton',
        id: 'U2Nob29sLTYwMg==',
        name: 'Michigan Technological University',
        state: 'MI'
      }
    ]
  */

  const teachers = await ratings.searchTeacher('mtu shene');

  console.log(teachers);
  /*
    [
      {
        firstName: 'Ching-Kuang',
        id: 'VGVhY2hlci0yMjkxNjI=',
        lastName: 'Shene',
        school: {
          id: 'U2Nob29sLTYwMg==',
          name: 'Michigan Technological University'
        }
      }
    ] 
  */

  const teacher = await ratings.getTeacher('VGVhY2hlci0yMjkxNjI=');

  console.log(teacher);
  /*
    {
      avgDifficulty: 4.4,
      avgRating: 3.3,
      numRatings: 28,
      department: 'Computer Science',
      firstName: 'Ching-Kuang',
      id: 'VGVhY2hlci0yMjkxNjI=',
      lastName: 'Shene',
      school: {
        city: 'Houghton',
        id: 'U2Nob29sLTYwMg==',
        name: 'Michigan Technological University',
        state: 'MI'
      },
      legacyId: 1234567
    }
  */
})();

🧰 Development

# First:
# install dependencies
yarn install

# then:
# build in watch mode
yarn build:watch

# and you can:

# run tests
yarn test

# run tests in watch mode
yarn test:watch

To publish a new package version, run npm version [patch|minor|major] and then git push && git push --tags on the master branch.

Package Sidebar

Install

npm i @njerig/rate-my-professors

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

13.8 kB

Total Files

12

Last publish

Collaborators

  • njerig