class IGDB::Client

Overview

Crystal Client to interface with IGDB

To create a client

client = IGDB.new("my_id","my_token")

To use the client pass a Hash as a parameter with the required query. So to search for Coming Soon Games for PS4

client.get({"fields" => "*",
            "where" => "game.platforms = 48 * date < 1538129354",
            "sort" => "date desc"})

Defined in:

igdb.cr

Constant Summary

URL = "https://api.igdb.com/v4/"

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(client_id : String, token : String, endpoint : String = "games") #

Initialize an IGDB::Client

A Client ID and Token must be provided The endpoint can be chosen (defaults to games) All passed parameters can be changed after initialization by using the associated property


[View source]

Macro Detail

macro method_missing(call) #

[View source]

Instance Method Detail

def client_id : String #

[View source]
def client_id=(client_id : String) #

[View source]
def count(params = {"fields" => "*"}) #

Get count of entries matching parameters


[View source]
def endpoint : String #

[View source]
def endpoint=(endpoint : String) #

[View source]
def get(params = {"fields" => "*"}, suffix = "") #

Run a query

Query is constructed from the passed Hash The query should contain keys and values that correspond to IGDB Apicalypse queries. suffix is used to append a suffix to the endpoint to perform an action (e.g. count by passing "/count")


[View source]
def id(id, params = {"fields" => "*"}) #

Get entry by ID

id of requested entry needs to be passed additional parameters may optionaly be passed


[View source]
def search(title, params = {"fields" => "*"}) #

Run a search on IGDB

title will be the search string additional parameters may optionaly be passed


[View source]
def token : String #

[View source]
def token=(token : String) #

[View source]