module Toshi::Api::ClassMethods

Defined in:

toshi/api/class_methods.cr

Instance Method Summary

Instance Method Detail

abstract def _create_client : HTTP::Client #

[View source]
abstract def _create_pool : DB::Pool(HTTP::Client) #

[View source]
def _request(path : String, method = "GET", params = nil, headers = nil, body : String | JSON::Serializable | NamedTuple | Nil = nil) #

Generic method for making a request with params and headers


[View source]
def _request(uri : URI, method = "GET", headers = nil, body : String | Nil = nil) #

Generic method for making a request with a URI and headers


[View source]
def configure(_options : Options | Nil = nil, &) #

Configure the API client

MyApi.configure do |opts|
  opts.host = "localhost"
  opts.port = 5000
  opts.prefix = "api/v0"
  opts.default_headers = {"User-Agent" => "Toshi-Ruby-Client"}
  opts.sleep_time = 0.1
end

[View source]
def configure(_options : Options | Nil = nil) #

[View source]
abstract def default_options : Options #

[View source]
abstract def logger #

[View source]
def make_request_uri(path : String, params : String | Nil = nil) : URI #

URI helper function


[View source]
abstract def options : Options #

[View source]
abstract def pool : DB::Pool(HTTP::Client) #

[View source]