<commit_before># Goodreads API wrapper

Ruby library to connect with Goodreads API.

## Installation

Your can install this library via rubygems:

```
gem install goodreads
```

Or using rake:

```
rake install
```

## Getting Started

In order to use Goodreads API you must obtain an API key for your account.

Setup client:

```ruby
client = Goodreads::Client.new(:api_key => 'YOUR_KEY')

# or using a shortcut
client = Goodreads.new(:api_key => 'YOUR_KEY')
```

## Usage

### Lookup books

Find a book by ISBN:

```ruby
book = client.book_by_isbn('ISBN')
```
  
Find a book by Goodreads ID:

```ruby
book = client.book('id')
```
  
Find a book by title:

```ruby
book = client.book_by_title('Book title')
```
  
Search for books (by title, isbn, genre):

```ruby
search = client.search_books('Your search query')
search.results.work.each do |book|
  book.id        # => book ID
  book.title     # => book title
end
```

### Reviews

Pull recent reviews:

```ruby
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:

```ruby
review = client.review('id')
review.id         # => ID
review.user       # => User information
review.book       # => Book information
review.rating     # => User rating
```

## Contributions

Feel free to contribute any patches or new features.

Make sure to add a test coverage so it does not break any existing code.

For documentation please visit [API Reference](http://www.goodreads.com/api)

## License

Copyright &copy; 2011-2012 <NAME>.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.<commit_msg>More readme<commit_after># Goodreads API wrapper

Ruby library to connect with Goodreads API.

## Installation

You can install this library via rubygems:

```
gem install goodreads
```

Or using rake:

```
rake install
```

## Getting Started

In order to use Goodreads API you must obtain an API key for your account.

Setup client:

```ruby
client = Goodreads::Client.new(:api_key => 'YOUR_KEY')

# or using a shortcut
client = Goodreads.new(:api_key => 'YOUR_KEY')
```

### Global configuration

Library allows you to define a global configuration options.

```ruby
Goodreads.configure(:api_key => 'YOUR_KEY')
```

Get current options:

```ruby
Goodreads.configuration # => {:api_key => 'YOUR_KEY'}
```

In case you need to reset options:

```ruby
Goodreads.reset_configuration
```

## Usage

### Lookup books

Find a book by ISBN:

```ruby
book = client.book_by_isbn('ISBN')
```
  
Find a book by Goodreads ID:

```ruby
book = client.book('id')
```
  
Find a book by title:

```ruby
book = client.book_by_title('Book title')
```
  
Search for books (by title, isbn, genre):

```ruby
search = client.search_books('Your search query')
search.results.work.each do |book|
  book.id        # => book ID
  book.title     # => book title
end
```

### Reviews

Pull recent reviews:

```ruby
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:

```ruby
review = client.review('id')
review.id         # => ID
review.user       # => User information
review.book       # => Book information
review.rating     # => User rating
```

## Contributions

Feel free to contribute any patches or new features.

Make sure to add a test coverage so it does not break any existing code.

For documentation please visit [API Reference](http://www.goodreads.com/api)

## License

Copyright &copy; 2011-2012 <NAME>.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{'fraction_non_alphanumeric': 0.09335219236209336, 'fraction_numerical': 0.002828854314002829, 'mean_word_length': 3.923411662315057, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4242007', 'n_tokens_mistral': 1681, 'n_tokens_neox': 1537, 'n_words': 722}