https://github.com/darkstego/igdb_client
Ruby client interface for IGDB API
https://github.com/darkstego/igdb_client
Last synced: about 2 months ago
JSON representation
Ruby client interface for IGDB API
- Host: GitHub
- URL: https://github.com/darkstego/igdb_client
- Owner: darkstego
- License: mit
- Created: 2018-04-16T00:17:11.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-03T01:07:20.000Z (almost 2 years ago)
- Last Synced: 2025-04-02T16:53:44.097Z (2 months ago)
- Language: Ruby
- Size: 9.77 KB
- Stars: 1
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# igdb_client
Ruby client interface for IGDB API. Supports API v4.## Installation
```ruby
$ gem install igdb_client
```## Usage
The structure of queries and results matches the [api documentaion.](https://api-docs.igdb.com/)
You will need client id and a client secret to access the API. The above link explains how to
acquire them.Please note, that unlike the previous versions, this client takes a client secret rather
than access token. The client will retrieve the required access token and renew it
whenever it expires.##### Instance
```ruby
require 'igdb_client'# initialize with client id and token
client = IGDB::Client.new("client_id","client_secret")# Endpoint can optionally be provided to change from defaults of 'games'
other_client = IGDB::Client.new("client_id","token", 'characters')# Endpoint/token/client_id can be changed on a client
other_client.endpoint = 'games'# Use the get method to fetch given the API params
client.get {fields: "name", limit: 10}# Use search method to search
client.search("ibb and obb", {fields: "name,release_dates,rating"})# Use id if you want to match by id
client.id 1942# You can run methods on alternate endpoints by using endpoint as method
client.character.id 14390# Access retrieved data by using methods matching fields of data
results = client.platform.id 2
results[0].name
results[0].summary
```