0.1.3 • Published 6 months ago

@njerig/rate-my-professors v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

🧑‍🏫 @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.

0.1.3

6 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

8 months ago