0.0.2 • Published 11 years ago

eyrolles-api v0.0.2

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

EyrollesJS

This is an unofficial JS API for Eyrolles’ website.

in development

Usage

The API has some objects (e.g. Book, Publisher, etc), each one has a .fetch method, used to populate its attributes with the informations from the website.

Each API’s function get an object with various attributes:

  • query: the query string
  • limit: the maximum number of results (e.g. for a search), default is 20
  • offset: see limit (default: 0)
  • callback: a function called with the result(s)
  • error: a function called if there’s an error

Search

var api = require( 'eyrolles-api' );

api.search({
    query: 'Foo',
    callback: function( q ) {

        console.log( q.results ); // `Book` objects

    }

});

Get a Book

  • with its ISBN code: api.getBookByISBN( opts ), put the code in the query attribute of the opts object. This return a Book object.

Get all books from a given author

If you have an Author object, its books attributes is the list of their books (you have to fetch them with the .fetch methods).

0.0.2

11 years ago

0.0.1

11 years ago