clever

Node.js library for interacting with the Clever API

clever client libraries are no longer maintained
Last updated a month ago by clever .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install clever 
SYNC missed versions from official npm registry.

Clever Javascript Library

Build Status

Installation

Via npm:

npm install clever

Usage

Clever = require('clever');
var clever = Clever({token: 'YOUR_BEARER_TOKEN'});

If you'd like to play around with our test data, please use the token: DEMO_TOKEN. See our developer guide for more information.

The clever package exposes objects corresponding to resources:

  • District
  • School
  • Section
  • Student
  • Teacher
  • Event

Each exposes a query API that closely resembles that of Mongoose. The available methods are find, findOne, and findById:

clever.District.find({}, function(error, districts) {
  assert(Array.isArray(districts));
  assert(districts[0] instanceof clever.District);
  assert.equal(district.get('name'), 'Demo District');
});

clever.School.findOne({ name: "Clever Academy" }, function(error, school) {
  assert(school instanceof clever.School);
  assert.equal(school.get('name'), 'Clever Academy');
});

clever.School.findById('4fee004cca2e43cf27000001', function(error, school) {
  assert(school instanceof clever.School);
  assert.equal(school.get('name'), 'Clever Academy');
});

When no callback is passed, the methods return a query object that allows you to build up a query over time:

clever.School
.find()
.where('name').equals('Clever Academy')
.exec(callback);

Query objects also support a stream interface for auto-pagination:

// pull sections 10 at a time
var count = 0;
var stream = clever.Section.find().limit(10).stream();
stream.on('data', function(section) {
  count += 1;
  assert(section instanceof clever.Section);
});
stream.on('end', function() {
  console.log(count, 'sections loaded');
});

Feedback

Questions, feature requests, or feedback of any kind is always welcome! We're available at tech-support@clever.com.

Current Tags

  • 0.12.1                                ...           latest (a month ago)

47 Versions

  • 0.12.1 [deprecated]           ...           a month ago
  • 0.11.1 [deprecated]           ...           3 years ago
  • 0.11.0 [deprecated]           ...           4 years ago
  • 0.9.0 [deprecated]           ...           5 years ago
  • 0.8.0 [deprecated]           ...           5 years ago
  • 0.6.6 [deprecated]           ...           5 years ago
  • 0.6.4 [deprecated]           ...           5 years ago
  • 0.6.3 [deprecated]           ...           6 years ago
  • 0.6.2 [deprecated]           ...           6 years ago
  • 0.6.1 [deprecated]           ...           6 years ago
  • 0.6.0 [deprecated]           ...           6 years ago
  • 0.5.7 [deprecated]           ...           6 years ago
  • 0.5.5 [deprecated]           ...           6 years ago
  • 0.5.3 [deprecated]           ...           6 years ago
  • 0.4.3 [deprecated]           ...           6 years ago
  • 0.4.2 [deprecated]           ...           6 years ago
  • 0.4.1 [deprecated]           ...           6 years ago
  • 0.4.0 [deprecated]           ...           6 years ago
  • 0.3.0 [deprecated]           ...           6 years ago
  • 0.2.3 [deprecated]           ...           6 years ago
  • 0.2.2 [deprecated]           ...           6 years ago
  • 0.2.1 [deprecated]           ...           6 years ago
  • 0.2.0 [deprecated]           ...           7 years ago
  • 0.1.18 [deprecated]           ...           7 years ago
  • 0.1.17 [deprecated]           ...           7 years ago
  • 0.1.16 [deprecated]           ...           7 years ago
  • 0.1.15 [deprecated]           ...           7 years ago
  • 0.1.14 [deprecated]           ...           7 years ago
  • 0.1.13 [deprecated]           ...           7 years ago
  • 0.1.12 [deprecated]           ...           7 years ago
  • 0.1.11 [deprecated]           ...           7 years ago
  • 0.1.10 [deprecated]           ...           7 years ago
  • 0.1.9 [deprecated]           ...           7 years ago
  • 0.1.8 [deprecated]           ...           7 years ago
  • 0.1.7 [deprecated]           ...           7 years ago
  • 0.1.6 [deprecated]           ...           7 years ago
  • 0.1.5 [deprecated]           ...           7 years ago
  • 0.1.4 [deprecated]           ...           7 years ago
  • 0.1.3 [deprecated]           ...           7 years ago
  • 0.1.1 [deprecated]           ...           7 years ago
  • 0.1.0 [deprecated]           ...           7 years ago
  • 0.0.7 [deprecated]           ...           7 years ago
  • 0.0.6 [deprecated]           ...           7 years ago
  • 0.0.4 [deprecated]           ...           7 years ago
  • 0.0.3 [deprecated]           ...           7 years ago
  • 0.0.2 [deprecated]           ...           7 years ago
  • 0.0.1 [deprecated]           ...           7 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 123
Dependencies (9)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |