New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

goodreads

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goodreads

Wrapper for the Goodreads API

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Goodreads - Use NodeJS to tap into the Goodreads API

This is a dead simple wrapper for the Goodreads API when using NodeJS. I've only exposed a few GR API functions so far but would be happy to entertain adding more if there's demand.

  • Goodreads API: http://goodreads.com/api
  • Github: https://github.com/bdickason/node-goodreads
  • Twitter: @bdickason
  • E-mail: dickason@gmail.com

Installation

  • Install npm: curl http://npmjs.org/install.sh | sh
  • Grab this module from npm: npm install goodreads
  • Include it in your program:
  • Coffeescript: goodreads = require 'goodreads'
  • Javascript: goodreads = require('goodreads');
  • create a new instance of the Goodreads client:
  • Coffeescript: gr = new goodreads.client { 'key': key, 'secret': secret }
  • Javascript: gr = new goodreads.client({ 'key': key, 'secret': secret });
  • Go get a goodreads developer key/secret from http://www.goodreads.com/api/keys
  • (optional) Add your key/secret to your environment variables so Nodejs can access them
  • Key: export GOODREADS_KEY=yourkey
  • Secret: export GOODREADS_SECRET=yoursecret
  • Try it out! Maybe do a node examples/booklist.js to get an idea how things work

Functions

showUser - get user info with userName

  • input - valid userName
  • output - json (as callback)
  • Example: getShelves 'your_username', (json) ->
  • You must have created a username. You can do so here.

getShelves - Get all shelves for a given user

  • Input: userId
  • Output: json (as callback)
  • Example: getShelves '4085451', (json) ->

getSingleShelf - Get a specific list by ID

  • Input: shelfOptions object with userID (required), shelf (required), page (optional), and per_page (optional) properties.
  • Output: json (as callback)
  • Example: getSingleShelf {'userID': '4085451', 'shelf': 'web', 'page': 1, 'per_page': 200}, (json) ->

requestToken - OAUTH: calls back an object with oauthToken, oauthTokenSecret, and the URL!

  • Input: none
  • Output: json { oauthToken: 'iu1iojij14141411414', oauthTokenSecret: 'j1kljklsajdklf132141', url: 'http://goodreads.com/blah'}
  • Example: requestToken (callback) ->

processCallback - expects: oauthToken, oauthTokenSecret, authorize (from the query string) Note: call this after requestToken!

  • Input: oauthToken, oauthTokenSecret, authorize
  • Output: json { 'username': 'Brad Dickason', 'userid': '404168', 'success': 1, 'accessToken': '04ajdfkja', 'accessTokenSecret': 'i14k31j41jkm' }
  • Example: processCallback oauthToken, oauthTokenSecret, params.query.authorize, (callback) ->

More to come!

Help, I need an adult!

First step: Check out the /examples folder. It's decently documented.

If you're still having issues, you can submit them here: https://github.com/bdickason/node-goodreads/issues

Changelog

v0.0.5 - Removed OAuth workarounds

  • {showUser} method added - can get user information given their username.

v0.0.2 - Removed OAuth workarounds

  • OAuth Callback (processCallback) now properly returns an Access Token (accessToken) and Access Token Secret (accessTokenSecret)

v0.0.1 - First release! Woohoo!!

  • Added support getting a list of a user's shelves (getShelves)
  • Added support for getting all books on a single shelf (getSingleShelf)
  • Added support for an OAuth round trip via requestToken and processCallback
  • Started this ugly manual

Keywords

goodreads

FAQs

Package last updated on 01 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts