ISBN Validator API - Ruby Gem

ISBN Validator is a comprehensive tool for validating and parsing ISBN-10 and ISBN-13 book identification numbers. It validates checksums and provides detailed information about each ISBN component.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_isbnvalidator'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_isbnvalidator

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_isbnvalidator'

# Initialize the client
client = APIVerve::Isbnvalidator::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ isbn: "978-0-306-40615-7" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ isbn: "978-0-306-40615-7" })
  puts response["data"]
rescue APIVerve::Isbnvalidator::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Isbnvalidator::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Isbnvalidator::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "valid": true,
    "isbn": "978-0-306-40615-7",
    "type": "ISBN-13",
    "normalized": "9780306406157",
    "formatted": "978-0-306-40615-7",
    "checksum_valid": true,
    "prefix": "978",
    "group": "0",
    "publisher": "306",
    "title": "40615",
    "check_digit": "7",
    "error": null
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.