If you want to use Google Books to get information about books, you can use their data API: http://code.google.com/apis/books/docs/gdata/developers_guide_protocol.html
Querying a URL, such as http://books.google.com/books/feeds/volumes?q=isbn:9780974514055 , will return the XML with the book information. You can use the Nokogiri stone to analyze the result ( http://nokogiri.org/ ).
One thing you need to know about is that to get full descriptions for books, you need to get a record, not just the feed results.
Here's a quick example of how to get information about a book from Google:
require 'open-uri' require 'nokogiri' class Book attr_accessor :title, :description def self.from_google(title) book = self.new entry = Nokogiri::XML(open "http://books.google.com/books/feeds/volumes?q=#{title}").css("entry id").first xml = Nokogiri::XML(open entry.text) if entry return book unless xml book.title = xml.css("entry dc|title").first.text unless xml.css("entry dc|title").empty? book.description = xml.css("entry dc|description").first.text unless xml.css("entry dc|description").empty? book end end b = Book.from_google("Ruby") pb
Kevin griffin
source share