Class: Igdb::Company

Inherits:
ApiResource show all
Defined in:
lib/igdb/models/company.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(id) ⇒ Object



7
8
9
# File 'lib/igdb/models/company.rb', line 7

def self.find(id)
  build_single_resource(Igdb::Requester.get("companies/#{id}")['company'], Igdb::CompanyRepresenter)
end

.metaObject



3
4
5
# File 'lib/igdb/models/company.rb', line 3

def self.meta
  build_single_resource(Igdb::Requester.get("companies/meta"), Igdb::CompanyRepresenter).size
end

Instance Method Details

#games(opts = {}) ⇒ Object

Show games of a specific company



12
13
14
15
16
17
18
# File 'lib/igdb/models/company.rb', line 12

def games(opts={})
  params = Hash.new.tap do |hash|
    hash['offset'] = opts[:offset] || 0
    hash['limit'] = opts[:limit] || 100
  end
  build_for_collection(Igdb::Requester.get("companies/#{id}/games", params)['games'], Igdb::CompanyRepresenter)
end