Instructor Tools: Common Tools

Welcome to the instructor tools Common Tools gem. This gem will exist as a dependency of Instructor-Tools.

The purpose of this gem is to provide instructors with a resource for commonly used tools, for example:

  • Building Cohort Data
  • Building Student Data

Instead of instructors re-writing the same code in their projects, CommonTools gem can be required as a dependency in projects that need these common functionalities.

The Gem sends a request to Learn API endpoint of the given batch, parses string payload into a array of student hashes.

You will be asked for your github credentials the first time you run the gem. Your Github credentials is stored in a client.yml, which is in the gem's lib directory and git-ignored.

Using the gem in another project

Public-facing code is the CommonTools module.

For inclusion in a gem:
  • add "common_tools" as a dependency in gemspec file
For inclusion in a Rails app:
  • add gem 'common_tools' to project gemfile

Functionality

This gem contains several functions. Specific details are listed below:

  • batch_id refers to the last 2 or more digits in the learn-url of a batch. For example: The url for Web-1115 is https://learn.co/batches/168. Therefore batch-id for Web-115 is 168

Two ways to run the gem:

  • bin/console

    • This drops you into an interactive irb session.
    • The command CommonTools::Generator.get_batch(batch_id) return an array of student hashes. You can use this data to build your own student or batch objects
  • exe/common-tools batch_id

    • will return an array of student hashes
    • receives batch-id as an argument and returns an array of student hashes.

Testing

Make sure all new features are built TDD first.

Contributing

To contribute to this gem:

  • Fork the repo
  • Make your contributions and set up whatever tests are necessary
  • Wrap any new functionality in CommonTools class methods
  • Submit a pull request