class

Legends::Resource

Inherits Reference < Object

Main model to create a resource. Every endpoint should subclass this.

Constructors

new(region : String, api_key : String)
Source

Instance methods

build_url(path : String, query = {} of String => String)

Build the URL to make the request. All League of Legends URLs follow the same format. Only the region changes in the hostname. After it we have the path, the API key and the query string to compose a proper filter. path is the resource path like champions. query is a Hash to build a query string like param1=foo

Source
get(path, query = {} of String => String)

Returns the body of the request. It should be encoded as JSON format.

Source
process_response(data, mapper)

Process the JSON data using the given mapper.

Source