Sha256: df63878a3c485a624ffc42a080388830af0c2de1da196bde3960c2956f44cc97
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require 'date' module TheGamesDB class Game include SAXMachine ancestor :feed element :id, :as => :gbd_id element :GameTitle, :as => :title element :Overview, :as => :overview element :Platform, :as => :platform element :ESRB, :as => :esrb element :Players, :as => :players element :'Co-op', :as => :cooperative element :Publisher, :as => :publisher element :Developer, :as => :developer element :ReleaseDate, :as => :release_date element :Rating, :as => :rating element :Youtube, :as => :youtube_video elements :genre, :as => :genres elements :banner, :as => :banners, :class => TheGamesDB::Image::Banner elements :boxart, :as => :boxarts, :class => TheGamesDB::Image::Boxart elements :fanart, :as => :fanarts, :class => TheGamesDB::Image::Fanart elements :screenshot, :as => :screenshots, :class => TheGamesDB::Image::Screenshot attr_accessor :feed def self.search(params = {}) feed = TheGamesDB::Feed.fetch_and_parse('GetGamesList.php', params) feed.games end def self.find(id) feed = TheGamesDB::Feed.fetch_and_parse('GetGame.php', :id => id) feed.games.first || raise(TheGamesDB::Exception::GameNotFound.new id) end def release_date return unless @release_date month, day, year = @release_date.split('/').map(&:to_i) Date.civil year, month, day end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
the_games_db-0.1.0 | lib/the_games_db/game.rb |