class Legends::Resource
- Legends::Resource
- Reference
- Object
Overview
Main model to create a resource. Every endpoint should subclass this.
Direct Known Subclasses
Defined in:
legends/resource.crConstructors
Instance Method Summary
-
#build_url(path : String, query = {} of String => String)
Build the URL to make the request.
-
#get(path, query = {} of String => String)
Returns the body of the request.
-
#process_response(data, mapper)
Process the JSON data using the given mapper.
Constructor Detail
Instance Method Detail
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
Returns the body of the request. It should be encoded as JSON format.