class Legends::Resource

Overview

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

Direct Known Subclasses

Defined in:

legends/resource.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(region : String, api_key : String) #

[View source]

Instance Method Detail

def 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


[View source]
def get(path, query = {} of String => String) #

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


[View source]
def process_response(data, mapper) #

Process the JSON data using the given mapper.


[View source]