Sha256: 3608977cd821fd908d5f29f6c19d4adba37edeb1ad219d0891e6e4504d476583
Contents?: true
Size: 748 Bytes
Versions: 2
Compression:
Stored size: 748 Bytes
Contents
module TheGamesDB class Feed include SAXMachine BaseApiUrl = "http://thegamesdb.net/api/" Timeout = 10_000 # milliseconds element :baseImgUrl, :as => :base_image_url elements :Game, :as => :games, :class => TheGamesDB::Game def self.fetch_and_parse(path, params={}) parse fetch(path, params) end def self.fetch(path, params={}) response = Typhoeus::Request.get(api_url(path), :params => params, :timeout => Timeout) bad_response!(response) unless response.success? response.body end def self.api_url(path) BaseApiUrl + path end def self.bad_response!(response) raise TheGamesDB::Exception::BadResponse.new(response.curl_error_message) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
the_games_db-0.1.0 | lib/the_games_db/feed.rb |
the_games_db-0.0.1 | lib/the_games_db/feed.rb |