• Stars
    star
    240
  • Rank 164,705 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Goodreads API wrapper

Goodreads Build Status

Ruby wrapper to communicate with Goodreads API.

NOTE: The Goodreads API is being discontinued.

Requirements

  • Ruby 1.9.3+

Installation

Install gem with rubygems:

gem install goodreads

Or manually:

rake install

Getting Started

Before using Goodreads API you must create a new application. Visit signup form for details.

Setup client:

client = Goodreads::Client.new(api_key: "KEY", api_secret: "SECRET")
client = Goodreads.new(api_key: "KEY") # short version

Global configuration

You can define client credentials on global level. Just create an initializer file (if using rails) under config/initializers:

Goodreads.configure(
  api_key: "KEY",
  api_secret: "SECRET"
)

Get global configuration:

Goodreads.configuration # => { api_key: "YOUR_KEY" }

In case you need to reset options:

Goodreads.reset_configuration

Examples

Lookup books

You can lookup a book by ISBN, ID or Title:

client.book("id")
client.book_by_isbn("ISBN")
client.book_by_title("Book title")

Search for books (by title, isbn, genre):

search = client.search_books("The Lord Of The Rings")

search.results.work.each do |book|
  book.id        # => book id
  book.title     # => book title
end

Authors

Look up an author by their Goodreads Author ID:

author = client.author("id")

author.id              # => author id
author.name            # => author's name
author.link            # => link to author's Goodreads page
author.fans_count      # => number of fans author has on Goodreads
author.image_url       # => link to image of the author
author.small_image_url # => link to smaller of the author
author.about           # => description of the author
author.influences      # => list of links to author's influences
author.works_count     # => number of works by the author in Goodreads
author.gender          # => author's gender
author.hometown        # => author's hometown
author.born_at         # => author's birthdate
author.died_at         # => date of author's death

Look up an author by name:

author = client.author_by_name("Author Name")

author.id     # => author id
author.name   # => author name
author.link   # => link to author's Goodreads page

Look up books by an author:

author = client.author_Book("id")

author.id     # => author id
author.name   # => author name
author.link   # => link to author's Goodreads page
author.books  # => array of books by this author

Reviews

Pull recent reviews:

client.recent_reviews.each do |r|
  r.id            # => review id
  r.book.title    # => review book title
  r.body          # => review message
  r.user.name     # => review user name
end

Get review details:

review = client.review("id")

review.id         # => review id
review.user       # => user information
review.book       # => uook information
review.rating     # => user rating

Shelves

Get the books on a user's shelf:

shelf = client.shelf(user_id, shelf_name)

shelf.books  # array of books on this shelf
shelf.start  # start index of this page of paginated results
shelf.end    # end index of this page of paginated results
shelf.total  # total number of books on this shelf

Groups

Get group details:

group = client.group("id")

group.id                 # => group id
group.title              # => group title
group.access             # => group's access settings
                         # => (e.g., public or private)
group.group_users_count  # => number of users in the group

List the groups a given user is a member of:

group_list = client.group_list("user_id", "sort")

group_list.total         # => total number of groups
group_list.group.count  # => number of groups returned in the request

# Loop through the list to get details for each of the groups.
group_list.group.each do |g|
  g.id                 # => group id
  g.access             # => access settings (private, public)
  g.users_count        # => number of members
  g.title              # => title
  g.image_url          # => url of the group's image
  g.last_activity_at   # => date and time of the group's last activity
end

The sort parameter is optional, and defaults to my_activity. For other sorting options, see here.

Pagination

To retrieve results for a particular page use the page param when making calls:

books = client.search_books("Term", page: 2)

OAuth

For API calls requiring permission, such as write operations or browsing friends, see our OAuth tutorial.

Testing

To run the test suite:

bundle exec rake test

Contributions

You're welcome to submit patches and new features.

  • Create a new branch for your feature of bugfix
  • Add tests so it does not break any existing code
  • Open a new pull request
  • Check official API documentation

License

The MIT License (MIT)

More Repositories

1

pgweb

Cross-platform client for PostgreSQL databases
Go
8,042
star
2

capistrano-unicorn

Capistrano integration for Unicorn! - NEEDS MAINTAINER
Ruby
403
star
3

gitkit

Git toolkit for Go: Smart HTTP server, SSH server, hook receiver
Go
260
star
4

lunchy-go

OSX Launch Manager
Go
180
star
5

opentable

Unofficial OpenTable API
Ruby
147
star
6

grooveshark

Grooveshark.com unofficial API library
Ruby
123
star
7

slack-notify

Slack.com notifier
Ruby
94
star
8

musicbot

Play music from Slack: Raspberry Pi + Mopidy + Spotify
Go
93
star
9

lxc-ruby

Linux containers (LXC) ruby wrapper
Ruby
89
star
10

xml-sitemap

Easy XML sitemap generation for Ruby/Rails/Merb/Sinatra applications
Ruby
56
star
11

munin-ruby

Munin node client for Ruby
Ruby
41
star
12

omxremote

Web frontend and API for Raspberry Pi omxplayer media player
Go
38
star
13

ansible-vault-go

Go package to interact with Ansible Vault files
Go
37
star
14

wireguard-aws-gateway

Wireguard VPN gateway or AWS
HCL
29
star
15

mail_extract

Strip email message body from quotes and signatures
Ruby
25
star
16

net-ssh-session

Shell session for Net::SSH connections
Ruby
25
star
17

travis-github

Travis CI builds tab in Github
JavaScript
24
star
18

cloudwatchlogs

Web interface for AWS CloudWatch Logs
Go
23
star
19

rackspace-clouddns

Rackspace CloudDNS Ruby Wrapper
Ruby
20
star
20

github-events

Listen to Github repository events in real time
Go
18
star
21

shuttle

Minimalistic deployment tool
Ruby
17
star
22

heroku-vegeta

Using Heroku as a distributed stress-testing platform
Go
16
star
23

nginx2influxdb

Stream Nginx logs directly into InfluxDB
Go
14
star
24

rack-revision

Rack middleware for add code revision header X-REVISION
Ruby
14
star
25

pastie

Simplified API to Pastie.org
Ruby
12
star
26

markup-editor

Web-based markup editor with on-the-fly preview
JavaScript
12
star
27

app-config

Flexible and simple in-application settings for Rails/Sinatra applications
Ruby
11
star
28

docker-router

Reverse proxy for docker containers with automatic SSL
Go
11
star
29

envd

Serve application environment variables over HTTP
Go
11
star
30

bundle_cache

Cache bundle to Amazon S3
Go
10
star
31

docify

Render your favorite markup (RDoc, Markdown, Textile) into nice-looking html.
Ruby
10
star
32

apple_push

Sinatra-based API to send Apple Push Notifications
Ruby
10
star
33

proxie

HTTP proxy server with sqlite-powered storage and web interface for debugging.
Ruby
9
star
34

lxc-server

Web API for LXC container management
Ruby
9
star
35

cxml

Ruby implementation of cXML communication protocol
Ruby
9
star
36

fakemail

Sendmail replacement to debug email output, layouts, etc.
Ruby
8
star
37

hipache-api

HTTP interface for Hipache
Go
8
star
38

munin-plugins

Some useful munin plugins
Ruby
8
star
39

wg-registry

User and device self-service portal for WireGuard
Go
8
star
40

unfuddle-cli

Console-based tool to manage Unfuddle repositories
Ruby
8
star
41

cron2

Cron2 is cron scheduler on steroids: HCL, Docker, Logs, Notifications, Etc
Go
7
star
42

grit-http

Sinatra based API for Git repositories, powered by Grit
Ruby
7
star
43

zeroconf-beacon

Spawn a simple zeroconf service over the local network
Go
7
star
44

lxc-tools

Set of tools to work with LXC containers
Ruby
6
star
45

xtract

Simple data extraction tool
Go
6
star
46

go-craigslist

Craigslist.org wrapper for Go
HTML
6
star
47

snatch

Remote database downloader based on SSH
Ruby
6
star
48

docker-gateway

Stupid simple reverse proxy for Docker
Go
6
star
49

rack-norris

X-Chuck-Norris header with a joke in your Rack app!
Ruby
5
star
50

reeder

Experimental RSS reader
CSS
5
star
51

actions

Repo for Github Actions
Shell
4
star
52

howdy

Experimental YAML-based service monitoring thingy.
Go
4
star
53

unfuddle-services

Sinatra based hook server for Unfuddle. Similar to github-services.
Ruby
3
star
54

rscale

Image scaling wrapper based on ImageMagick console utils
Ruby
3
star
55

dep-cache

Parallel dependency cache helper for running in CI environments
Go
3
star
56

gitvault

Your personal git hosting
Ruby
3
star
57

arduino-rc-receiver

Script to troubleshoot RC receiver with Arduino
Arduino
3
star
58

dotfiles

Development environment configuration, scripts, etc
Ruby
3
star
59

shelly

Remote bash runner over HTTP
Go
2
star
60

debugserver

Debugging server for any console-less applications
Ruby
2
star
61

munin-dashboard

Sinatra based API and GUI for munin nodes
Ruby
2
star
62

ws

Websocket debugging tool
Go
2
star
63

spellcheck

Text spellcheck/correction based on Redis key-value storage server
Ruby
2
star
64

capistrano-payload

Capistrano plugin that delivers JSON payload to the specified URL
Ruby
2
star
65

dependenci

Client for http://dependenci.com
Ruby
2
star
66

irc2pusher

Send IRC messages to a Pusher channel
2
star
67

sqlembed

Parse out *.sql files and embed the queries as consts
Go
2
star
68

app-detective

Detect application type
Ruby
2
star
69

debugclient-php

DebugServer PHP client library
PHP
2
star
70

terminal_helpers

Various helpers for console-based applications
Ruby
2
star
71

crash_hook

Exception notifications via HTTP
Ruby
2
star
72

fpm-builder

Helpers for building packages with fpm
Shell
1
star
73

git-branches

A small tool to show current status of the git repository
Go
1
star
74

arrow_payments

ArrowPayments gateway for Ruby
Ruby
1
star
75

crash_server

Simple web application for crash_hook
Ruby
1
star
76

docker-sandbox

Docker quickstart and playground
1
star
77

bootstrap_navigation

Navigation helper for bootstap html/css framework
Ruby
1
star
78

git-handler

Control git flow
Ruby
1
star
79

server-configs

Set of various server configs and scripts
1
star
80

reckless

Ruby client to Chicago's records store Reckless.com
Ruby
1
star
81

helm-wireguard

Wireguard Helm Chart
Go
1
star
82

docker-http-proxy

Go
1
star
83

shuttle-go

Shuttle is a minimalisting application deployment tool
Go
1
star
84

heroku-addon

Heroku Addon SDK for Go
Go
1
star
85

dummy-service

This a service dummy for random testing
Ruby
1
star
86

dockerfiles

Collection of Dockerfiles
Shell
1
star