module Toshi::Api::ClassMethods
Defined in:
toshi/api/class_methods.crInstance Method Summary
- #_create_client : HTTP::Client
- #_create_pool : DB::Pool(HTTP::Client)
-
#_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
-
#_request(uri : URI, method = "GET", headers = nil, body : String | Nil = nil)
Generic method for making a request with a URI and headers
-
#configure(_options : Options | Nil = nil, &)
Configure the API client
- #configure(_options : Options | Nil = nil)
- #default_options : Options
- #logger
-
#make_request_uri(path : String, params : String | Nil = nil) : URI
URI helper function
- #options : Options
- #pool : DB::Pool(HTTP::Client)
Instance Method Detail
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
Generic method for making a request with a URI and headers
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