Soleone-gamefaqs

Ruby library for fetching information about games from www.gamefaqs.com using Hpricot


Install
gem install Soleone-gamefaqs -v 0.0.2

Documentation

GameFAQs Library

This is a simple gem which gives you access to information about all games (any platform) from GameFAQs.com

You can search for games by title and platform, and then view Reviews, FAQs, Cheats and Answers 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")

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

Top 10 Games

Get the most anticipated games for any platform at the moment.


  List.top_games("xbox 360")

Reviews

You can get score(s) for a game, and also read detailed articles. The reviews range from quick over detailed to full.


  # 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)

Users can post questions for any game (many different categories, e.g. technical or plot).
Other users then write a solution for that problem. It’s very Forum-like.


  # 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

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).

Bugs

If you’re having any problems or exceptions while using this library, I encourage you to add a ticket (the detailed the better) to the issue tracker below:

http://soleone.lighthouseapp.com/projects/20137-gamefaqs

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.