Class: Igdb::Game
- Inherits:
-
ApiResource
- Object
- OpenStruct
- ApiResource
- Igdb::Game
- Defined in:
- lib/igdb/models/game.rb
Class Method Summary collapse
Class Method Details
.all(opts = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/igdb/models/game.rb', line 19 def self.all(opts={}) params = Hash.new.tap do |hash| hash['offset'] = opts[:offset] || 0 hash['limit'] = opts[:limit] || 100 end build_collection(Igdb::Requester.get("games", params)['games'], Igdb::GameRepresenter) end |
.find(id) ⇒ Object
7 8 9 |
# File 'lib/igdb/models/game.rb', line 7 def self.find(id) build_single_resource(Igdb::Requester.get("games/#{id}")['game'], Igdb::GameRepresenter) end |
.meta ⇒ Object
3 4 5 |
# File 'lib/igdb/models/game.rb', line 3 def self. build_single_resource(Igdb::Requester.get("games/meta"), Igdb::GameRepresenter).size end |
.search(opts = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/igdb/models/game.rb', line 11 def self.search(opts={}) params = Hash.new.tap do |hash| hash['q'] = opts[:query] if opts[:query] hash['filters'] = opts[:filters] if opts[:filters] end build_collection(Igdb::Requester.get("games/search", params)['games'], Igdb::GameRepresenter) end |