GameFAQs Library

Access information about all games (any platform) from GameFAQs.

You can search for games by title and platform, and then view Reviews, FAQs, Cheats for it.

Installation

gem install Soleone-gamefaqs --source=http://gems.github.com

(Case sensitive!)

Getting started

require 'gamefaqs'

Find games and platforms


  # Search for a game containing two words on the Nintendo DS
  game = GameFaqs::Search.game("Castlevania Ecclesia", "DS")
  
  # You can also search starting from the platform
  snes = GameFaqs::Platform.find("snes")
  game = snes.find("super mario world")

Reviews


  # Get the average score from all reviews
  game.average_score
  # Get the average score from only detailed reviews (there are :detailed, :full and :quick)
  game.average_score(:detailed)

  # Get all reviews for this game
  reviews = game.reviews
  # Get only quick reviews for this game
  reviews = game.reviews(:quick)
  
  # Get the first review in the list
  review = reviews.first
  
  # Score in the format 9/10
  review.score
  
  # Get the full text of the review (original html stripped/converted)
  review.text
  
  # Other information
  review.title
  review.created_at
  review.author

Questions (and Answers)


  # Get an array with all user questions for a game
  game.questions
  
  question = game.questions.first
  
  # Get the number of answers for this question
  question.replies
  # Get the status of the question (e.g. already answered or not)
  question.status
  # Get an array of all the answers for this question
  question.answers

Examples for quick random quotes


  include GameFaqs

  game = Game.find("super mario land", "game boy")

  # The title of a random review for Super Mario Land
  Random.review(game).title
  # long version
  Random.review("super mario land", "game boy").title
  
  Random.one_line_review(game)
  # => "Not Nintendo's (or my) best, but still a decent effort." - 6/10

  Random.one_line_review(game, :detailed => true)
  # => "Super Mario Land [Game Boy]: Not Nintendo's (or my) best, but still a decent effort." - 6/10

  # The title of a random user question for a game
  question = Random.question(game).title

Requirements

Hpricot (will be installed automatically by RubyGems as a dependency)

Issues

Speed! Because sometimes there have to be multiple webpages parsed at once.

For example to retrieve the names of all games for a platform, at least 26 pages need to be parsed (one for each letter of the alphabet). So better caching strategies are something to be worked on in the future.

Contribute

If you’re interested in this kind of stuff and want to help improve this library, feel free to fork this project and send me pull-requests/patches.