From 05229ac6c39389463d92205f04e4422a2c9bfd94 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 18:06:21 +0000 Subject: [PATCH] Deploy to GitHub pages --- .keep | 0 404.html | 212 +++ Crest.html | 920 ++++++++++ Crest/CommonLogger.html | 416 +++++ Crest/Curlify.html | 442 +++++ Crest/DataForm.html | 436 +++++ Crest/EnumeratedFlatParamsEncoder.html | 494 ++++++ Crest/FlatParamsEncoder.html | 469 +++++ Crest/Form.html | 459 +++++ Crest/JSONForm.html | 394 +++++ Crest/Logger.html | 540 ++++++ Crest/NestedParamsEncoder.html | 465 +++++ Crest/ParamsDecoder.html | 389 ++++ Crest/ParamsDecoder/Type.html | 274 +++ Crest/ParamsEncoder.html | 451 +++++ Crest/ParamsValue.html | 274 +++ Crest/Redirector.html | 399 +++++ Crest/Request.html | 1864 ++++++++++++++++++++ Crest/RequestFailed.html | 504 ++++++ Crest/Resource.html | 1718 ++++++++++++++++++ Crest/Response.html | 1140 ++++++++++++ Crest/TimeoutValue.html | 274 +++ Crest/UrlencodedForm.html | 416 +++++ Crest/ZeroEnumeratedFlatParamsEncoder.html | 407 +++++ Float.html | 407 +++++ Int.html | 423 +++++ css/style.css | 980 ++++++++++ index.html | 821 +++++++++ index.json | 1 + js/doc.js | 1099 ++++++++++++ search-index.js | 1 + 31 files changed, 17089 insertions(+) create mode 100644 .keep create mode 100644 404.html create mode 100644 Crest.html create mode 100644 Crest/CommonLogger.html create mode 100644 Crest/Curlify.html create mode 100644 Crest/DataForm.html create mode 100644 Crest/EnumeratedFlatParamsEncoder.html create mode 100644 Crest/FlatParamsEncoder.html create mode 100644 Crest/Form.html create mode 100644 Crest/JSONForm.html create mode 100644 Crest/Logger.html create mode 100644 Crest/NestedParamsEncoder.html create mode 100644 Crest/ParamsDecoder.html create mode 100644 Crest/ParamsDecoder/Type.html create mode 100644 Crest/ParamsEncoder.html create mode 100644 Crest/ParamsValue.html create mode 100644 Crest/Redirector.html create mode 100644 Crest/Request.html create mode 100644 Crest/RequestFailed.html create mode 100644 Crest/Resource.html create mode 100644 Crest/Response.html create mode 100644 Crest/TimeoutValue.html create mode 100644 Crest/UrlencodedForm.html create mode 100644 Crest/ZeroEnumeratedFlatParamsEncoder.html create mode 100644 Float.html create mode 100644 Int.html create mode 100644 css/style.css create mode 100644 index.html create mode 100644 index.json create mode 100644 js/doc.js create mode 100644 search-index.js diff --git a/.keep b/.keep new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..e8ad8c58 --- /dev/null +++ b/404.html @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + crest master + + + + + + + + + + +
+

+ 404 Not Found +

+ +

+ This page is unavailable in this version of the API docs. +

+ +

+ You can use the sidebar to search for your page, or try a different + Crystal version. +

+ +
+ + diff --git a/Crest.html b/Crest.html new file mode 100644 index 00000000..6a17b218 --- /dev/null +++ b/Crest.html @@ -0,0 +1,920 @@ + + + + + + + + + + + + + + + + + Crest - crest master + + + + + + + + + + +
+

+ + module Crest + +

+ + + + + +

+ + + + Overview +

+ +

This module's static methods are the entry point for using the Crest client.

+

Supported HTTP methods: .get, .put, .post, .patch .delete, .options, .head

+

Examples:

+
Crest.get(
+  "http://httpbin.org/get",
+  headers: {"Content-Type" => "image/jpg"},
+  params: {"lang" => "en"}
+)
+
+Crest.post(
+  "http://httpbin.org/post",
+  headers: {"Access-Token" => ["secret1", "secret2"]},
+  form: {"fizz" => "buz"},
+  logging: true,
+)
+
+Crest.get("http://httpbin.org/stream/5") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest.cr + + +
+ + + + crest/curlify.cr + + +
+ + + + crest/exceptions.cr + + +
+ + + + crest/form.cr + + +
+ + + + crest/forms/data_form.cr + + +
+ + + + crest/forms/json_form.cr + + +
+ + + + crest/forms/urlencoded_form.cr + + +
+ + + + crest/logger.cr + + +
+ + + + crest/loggers/common_logger.cr + + +
+ + + + crest/params_decoder.cr + + +
+ + + + crest/params_encoder.cr + + +
+ + + + crest/params_encoders/enumerated_flat_params_encoder.cr + + +
+ + + + crest/params_encoders/flat_params_encoder.cr + + +
+ + + + crest/params_encoders/nested_params_encoder.cr + + +
+ + + + crest/params_encoders/zero_enumerated_flat_params_encoder.cr + + +
+ + + + crest/redirector.cr + + +
+ + + + crest/request.cr + + +
+ + + + crest/resource.cr + + +
+ + + + crest/response.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ EXCEPTIONS_MAP = {} of Int32 => Crest::RequestFailed.class +
+ + +
+ HTTP_METHODS = ["get", "delete", "post", "put", "patch", "options", "head"] of ::String +
+ + +
+ STATUSES = {100 => "Continue", 101 => "Switching Protocols", 102 => "Processing", 200 => "OK", 201 => "Created", 202 => "Accepted", 203 => "Non-Authoritative Information", 204 => "No Content", 205 => "Reset Content", 206 => "Partial Content", 207 => "Multi-Status", 208 => "Already Reported", 226 => "IM Used", 300 => "Multiple Choices", 301 => "Moved Permanently", 302 => "Found", 303 => "See Other", 304 => "Not Modified", 305 => "Use Proxy", 306 => "Switch Proxy", 307 => "Temporary Redirect", 308 => "Permanent Redirect", 400 => "Bad Request", 401 => "Unauthorized", 402 => "Payment Required", 403 => "Forbidden", 404 => "Not Found", 405 => "Method Not Allowed", 406 => "Not Acceptable", 407 => "Proxy Authentication Required", 408 => "Request Timeout", 409 => "Conflict", 410 => "Gone", 411 => "Length Required", 412 => "Precondition Failed", 413 => "Payload Too Large", 414 => "URI Too Long", 415 => "Unsupported Media Type", 416 => "Range Not Satisfiable", 417 => "Expectation Failed", 418 => "I\"m A Teapot", 421 => "Too Many Connections From This IP", 422 => "Unprocessable Entity", 423 => "Locked", 424 => "Failed Dependency", 425 => "Unordered Collection", 426 => "Upgrade Required", 428 => "Precondition Required", 429 => "Too Many Requests", 431 => "Request Header Fields Too Large", 449 => "Retry With", 450 => "Blocked By Windows Parental Controls", 500 => "Internal Server Error", 501 => "Not Implemented", 502 => "Bad Gateway", 503 => "Service Unavailable", 504 => "Gateway Timeout", 505 => "HTTP Version Not Supported", 506 => "Variant Also Negotiates", 507 => "Insufficient Storage", 508 => "Loop Detected", 509 => "Bandwidth Limit Exceeded", 510 => "Not Extended", 511 => "Network Authentication Required"} +
+ +
+

Hash of HTTP status code => message.

+
+ + +
+ USER_AGENT = "Crest/#{Crest::VERSION} (Crystal/#{Crystal::VERSION})" +
+ + +
+ VERSION = {{ (`shards version /home/runner/work/crest/crest/src`).chomp.stringify }} +
+ + +
+ + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.delete(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a DELETE request and and yields the Crest::Response to the block.

+
Crest.delete("http://httpbin.org/delete") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.delete(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a DELETE request and returns a Crest::Response.

+
Crest.delete("http://httpbin.org/delete")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.get(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a GET request and and yields the Crest::Response to the block.

+
Crest.get("http://httpbin.org/get") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.get(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a GET request and returns a Crest::Response.

+
Crest.get("http://httpbin.org/get")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.head(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a HEAD request and and yields the Crest::Response to the block.

+
Crest.head("http://httpbin.org/head") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.head(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a HEAD request and returns a Crest::Response.

+
Crest.head("http://httpbin.org/head")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.options(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a OPTIONS request and and yields the Crest::Response to the block.

+
Crest.options("http://httpbin.org/options") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.options(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a OPTIONS request and returns a Crest::Response.

+
Crest.options("http://httpbin.org/options")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.patch(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PATCH request and and yields the Crest::Response to the block.

+
Crest.patch("http://httpbin.org/patch") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.patch(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a PATCH request and returns a Crest::Response.

+
Crest.patch("http://httpbin.org/patch")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.post(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a POST request and and yields the Crest::Response to the block.

+
Crest.post("http://httpbin.org/post") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.post(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a POST request and returns a Crest::Response.

+
Crest.post("http://httpbin.org/post")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.put(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PUT request and and yields the Crest::Response to the block.

+
Crest.put("http://httpbin.org/put") do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.put(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a PUT request and returns a Crest::Response.

+
Crest.put("http://httpbin.org/put")
+
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Crest/CommonLogger.html b/Crest/CommonLogger.html new file mode 100644 index 00000000..03717d40 --- /dev/null +++ b/Crest/CommonLogger.html @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + Crest::CommonLogger - crest master + + + + + + + + + + +
+

+ + class Crest::CommonLogger + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/loggers/common_logger.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::Logger

+ + + + default_formatter : Log::Formatter + default_formatter, + + + + filter(pattern : String | Regex, replacement : String) + filter, + + + + info(message : String) + info, + + + + request(request : Crest::Request) : Nil + request, + + + + response(response : Crest::Response) : Nil + response + + + + + + +

Constructor methods inherited from class Crest::Logger

+ + + + new(filename : String)
new(io : IO = STDOUT)
+ new
+ + + + + + + + + +

Macros inherited from class Crest::Logger

+ + + + method_missing(call) + method_missing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def request(request : Crest::Request) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def response(response : Crest::Response) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/Curlify.html b/Crest/Curlify.html new file mode 100644 index 00000000..52bb6d1b --- /dev/null +++ b/Crest/Curlify.html @@ -0,0 +1,442 @@ + + + + + + + + + + + + + + + + + Crest::Curlify - crest master + + + + + + + + + + +
+

+ + class Crest::Curlify + +

+ + + + + + + +

+ + + + Overview +

+ +

Class to convert Crest::Request object to cURL command

+
request = Crest::Request.new(:post, "http://httpbin.org/post", form: {"title" => "New Title"})
+Crest::Curlify.to_curl(request)
+=> "curl -X POST http://httpbin.org/post -d 'title=New+Title' -H 'Content-Type: application/x-www-form-urlencoded'"
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/curlify.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(request : Crest::Request) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.to_curl(request : Crest::Request) + + # +
+ +
+ +

Returns string with cURL command by provided Crest::Request object

+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_curl + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/DataForm.html b/Crest/DataForm.html new file mode 100644 index 00000000..7cb9815f --- /dev/null +++ b/Crest/DataForm.html @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + Crest::DataForm(T) - crest master + + + + + + + + + + +
+

+ + class Crest::DataForm(T) + +

+ + + + + + + +

+ + + + Overview +

+ +

This class lets crest emulate a filled-in form +in which a user has pressed the submit button. +This causes crest to POST data using the +"Content-Type" multipart/form-data according to RFC 2388. +This enables uploading of binary files etc.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/forms/data_form.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ DEFAULT_MIME_TYPE = "application/octet-stream" +
+ + +
+ + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::Form(T)

+ + + + content_type + content_type, + + + + form_data + form_data, + + + + generate + generate, + + + + params + params + + + + + + + + + +

Class methods inherited from class Crest::Form(T)

+ + + + generate(params : Hash, params_encoder : Crest::ParamsEncoder.class) + generate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def generate + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def parsed_params + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/EnumeratedFlatParamsEncoder.html b/Crest/EnumeratedFlatParamsEncoder.html new file mode 100644 index 00000000..ba747354 --- /dev/null +++ b/Crest/EnumeratedFlatParamsEncoder.html @@ -0,0 +1,494 @@ + + + + + + + + + + + + + + + + + Crest::EnumeratedFlatParamsEncoder - crest master + + + + + + + + + + +
+

+ + class Crest::EnumeratedFlatParamsEncoder + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_encoders/enumerated_flat_params_encoder.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode + + + + + + + + + +

Class methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode, + + + + flatten_params(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + flatten_params + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.array_start_index + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.flatten_params(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +
Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => "123"}})
+# => [{"key1[key2]", "123"}]
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.flatten_params(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +
Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}})
+# => [{"key1[arr][1]", "1"}, {"key1[arr][2]", "2"}, {"key1[arr][3]", "3"}]
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def encode(params : Hash) : String + + # +
+ +
+ +
Crest::EnumeratedFlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1})
+# => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/FlatParamsEncoder.html b/Crest/FlatParamsEncoder.html new file mode 100644 index 00000000..e7d4f905 --- /dev/null +++ b/Crest/FlatParamsEncoder.html @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + Crest::FlatParamsEncoder - crest master + + + + + + + + + + +
+

+ + class Crest::FlatParamsEncoder + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_encoders/flat_params_encoder.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode + + + + + + + + + +

Class methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode, + + + + flatten_params(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + flatten_params + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.flatten_params(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +

Transform deeply nested params containers into a flat array of {key, value}.

+

parent_key — Should not be passed (used for recursion)

+
Crest::FlatParamsEncoder.flatten_params({:key1 => {:key2 => "123"}})
+# => [{"key1[key2]", "123"}]
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.flatten_params(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +

Transform deeply nested params containers into a flat array of {key, value}.

+

+ +parent_key — Should not be passed (used for recursion)

+
Crest::FlatParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}})
+# => [{"key1[arr][]", "1"}, {"key1[arr][]", "2"}, {"key1[arr][]", "3"}]
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def encode(params : Hash) : String + + # +
+ +
+ +

Converts the given params into a URI query string. Keys and values +will converted to strings and appropriately escaped for the URI.

+
Crest::FlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1})
+# => 'a[]=one&a[]=two&a[]=three&b=true&c=C&d=1'
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/Form.html b/Crest/Form.html new file mode 100644 index 00000000..0d1247d4 --- /dev/null +++ b/Crest/Form.html @@ -0,0 +1,459 @@ + + + + + + + + + + + + + + + + + Crest::Form(T) - crest master + + + + + + + + + + +
+

+ + abstract class Crest::Form(T) + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + crest/form.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.generate(params : Hash, params_encoder : Crest::ParamsEncoder.class) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def content_type + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def form_data + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def generate + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def params + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/JSONForm.html b/Crest/JSONForm.html new file mode 100644 index 00000000..bd3bd79d --- /dev/null +++ b/Crest/JSONForm.html @@ -0,0 +1,394 @@ + + + + + + + + + + + + + + + + + Crest::JSONForm(T) - crest master + + + + + + + + + + +
+

+ + class Crest::JSONForm(T) + +

+ + + + + + + +

+ + + + Overview +

+ +

This class lets crest convert request hash to JSON +This causes crest to POST data using the +"Content-Type" application/json.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/forms/json_form.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::Form(T)

+ + + + content_type + content_type, + + + + form_data + form_data, + + + + generate + generate, + + + + params + params + + + + + + + + + +

Class methods inherited from class Crest::Form(T)

+ + + + generate(params : Hash, params_encoder : Crest::ParamsEncoder.class) + generate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def generate + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/Logger.html b/Crest/Logger.html new file mode 100644 index 00000000..b5c349da --- /dev/null +++ b/Crest/Logger.html @@ -0,0 +1,540 @@ + + + + + + + + + + + + + + + + + Crest::Logger - crest master + + + + + + + + + + +
+

+ + abstract class Crest::Logger + +

+ + + + + + + + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + crest/logger.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + +

+ + + + Macro Summary +

+ + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(filename : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(io : IO = STDOUT) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Macro Detail +

+ +
+
+ + macro method_missing(call) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def default_formatter : Log::Formatter + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def filter(pattern : String | Regex, replacement : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def info(message : String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def request(request : Crest::Request) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ abstract + def response(response : Crest::Response) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/NestedParamsEncoder.html b/Crest/NestedParamsEncoder.html new file mode 100644 index 00000000..94e020b8 --- /dev/null +++ b/Crest/NestedParamsEncoder.html @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + Crest::NestedParamsEncoder - crest master + + + + + + + + + + +
+

+ + class Crest::NestedParamsEncoder + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_encoders/nested_params_encoder.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode + + + + + + + + + +

Class methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode, + + + + flatten_params(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + flatten_params + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.flatten_params(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +

Transform deeply nested params containers into a flat array of {key, value}.

+

parent_key — Should not be passed (used for recursion)

+
Crest::NestedParamsEncoder.flatten_params({:key1 => {:key2 => "123"}})
+# => [{"key1[key2]", "123"}]
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.flatten_params(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +

Transform deeply nested params containers into a flat array of {key, value}.

+

parent_key — Should not be passed (used for recursion)

+
Crest::NestedParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}})
+# => [{"key1[arr]", "1"}, {"key1[arr]", "2"}, {"key1[arr]", "3"}]
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def encode(params : Hash) : String + + # +
+ +
+ +

Converts the given params into a URI query string. Keys and values +will converted to strings and appropriately escaped for the URI.

+
Crest::NestedParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1})
+# => 'a=one&a=two&a=three&b=true&c=C&d=1'
+
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/ParamsDecoder.html b/Crest/ParamsDecoder.html new file mode 100644 index 00000000..efb25f57 --- /dev/null +++ b/Crest/ParamsDecoder.html @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + Crest::ParamsDecoder - crest master + + + + + + + + + + +
+

+ + module Crest::ParamsDecoder + +

+ + + + + +

+ + + + Overview +

+ +

Module for decoding query-string into parameters.

+ + + + + + + +

+ + + + Extended Modules +

+ + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_decoder.cr + + +
+ + + + + +

+ + + + Constant Summary +

+ +
+ +
+ ARRAY_REGEX = /[\[\]]+\Z/ +
+ + +
+ SUBKEYS_REGEX = /[^\[\]]+(?:\]?\[\])?/ +
+ + +
+ + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def decode(query : String) : Hash(String, Type) + + # +
+ +
+ +

Converts the given URI query string into a hash.

+
Crest::ParamsDecoder.decode("a[]=one&a[]=two&a[]=three&b=true&c=C&d=1")
+# => {"a" => ["one", "two", "three"], "b" => "true", "c" => "C", "d" => "1"}
+
+Crest::ParamsDecoder.decode("a=one&a=two&a=three&b=true&c=C&d=1")
+# => {"a" => ["one", "two", "three"], "b" => "true", "c" => "C", "d" => "1"}
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def match_context(context, subkey) : Type | Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/ParamsDecoder/Type.html b/Crest/ParamsDecoder/Type.html new file mode 100644 index 00000000..6fe08ebd --- /dev/null +++ b/Crest/ParamsDecoder/Type.html @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + Crest::ParamsDecoder::Type - crest master + + + + + + + + + + +
+

+ + alias Crest::ParamsDecoder::Type + +

+ + + + + + + +

+ + + + Alias Definition +

+ Array(Crest::ParamsDecoder::Type) | Hash(String, Crest::ParamsDecoder::Type) | String | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_decoder.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Crest/ParamsEncoder.html b/Crest/ParamsEncoder.html new file mode 100644 index 00000000..6c3e47ee --- /dev/null +++ b/Crest/ParamsEncoder.html @@ -0,0 +1,451 @@ + + + + + + + + + + + + + + + + + Crest::ParamsEncoder - crest master + + + + + + + + + + +
+

+ + abstract class Crest::ParamsEncoder + +

+ + + + + + + +

+ + + + Overview +

+ +

Custom serializers

+

You can build your custom encoder, if you like. +The value of params_encoder can be any Crest::ParamsEncoder object that responds to: #encode(Hash) #=> String

+

The encoder will affect both how Crest processes query strings and how it serializes POST bodies.

+

The default encoder is Crest::FlatParamsEncoder.

+ + + + + + + + + +

+ + + + Direct Known Subclasses +

+ + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_encoder.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.encode(params : Hash) : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.flatten_params(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + + # +
+ +
+ +

Transform JSON::Any object into a flat array of {key, value}.

+

+ +parent_key — Should not be passed (used for recursion)

+
params = JSON.parse(%({"access": [{"name": "mapping", "speed": "fast"}, {"name": "any", "speed": "slow"}]}))
+
+Crest::FlatParamsEncoder.flatten_params(params)
+# => [{"access[][name]", "mapping"}, {"access[][speed]", "fast"}, {"access[][name]", "any"}, {"access[][speed]", "slow"}]
+
+Crest::EnumeratedFlatParamsEncoder.flatten_params(params)
+# => [{"access[1][name]", "mapping"}, {"access[1][speed]", "fast"}, {"access[2][name]", "any"}, {"access[2][speed]", "slow"}]
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ abstract + def encode(params : Hash) : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/ParamsValue.html b/Crest/ParamsValue.html new file mode 100644 index 00000000..a39cf38f --- /dev/null +++ b/Crest/ParamsValue.html @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + Crest::ParamsValue - crest master + + + + + + + + + + +
+

+ + alias Crest::ParamsValue + +

+ + + + + + + +

+ + + + Alias Definition +

+ Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Crest/Redirector.html b/Crest/Redirector.html new file mode 100644 index 00000000..d9d63055 --- /dev/null +++ b/Crest/Redirector.html @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + Crest::Redirector - crest master + + + + + + + + + + +
+

+ + class Crest::Redirector + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/redirector.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(response : Crest::Response, request : Crest::Request) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def follow : Crest::Response + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def follow(&block : Crest::Response -> ) + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/Request.html b/Crest/Request.html new file mode 100644 index 00000000..86146cf5 --- /dev/null +++ b/Crest/Request.html @@ -0,0 +1,1864 @@ + + + + + + + + + + + + + + + + + Crest::Request - crest master + + + + + + + + + + +
+

+ + class Crest::Request + +

+ + + + + + + +

+ + + + Overview +

+ +

A class that used to make the requests +The result of a Crest::Request is a Crest::Response object.

+

Simple example:

+
request = Crest::Request.new(:post, "http://httpbin.org/post", {"age" => 27}, params: {:name => "Kurt"})
+request.execute
+
+Crest::Request.execute(:post, "http://httpbin.org/post", {"age" => 27}, json: true)
+
+Crest::Request.post("http://httpbin.org/post", {"age" => 27}, json: true)
+

Block style:

+
request = Crest::Request.new(:get, "http://httpbin.org/get") do |request|
+  request.headers.add("foo", "bar")
+  request.user = "username"
+  request.password = "password"
+end
+
+response = request.execute
+

Mandatory parameters:

+ +

Optional parameters:

+ + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/request.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(method : Symbol, url : String, form = {} of String => String, *, headers = {} of String => String, cookies = {} of String => String, params = {} of String => String, max_redirects : Int32 = 10, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(method : Symbol, url : String, form = {} of String => String, **args) + + # +
+ +
+ +

When block is not given.

+
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.delete(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a DELETE request and and yields the Crest::Response to the block.

+
Crest::Request.delete("http://httpbin.org/delete") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.delete(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a DELETE request and returns a Crest::Response.

+
Crest::Request.delete("http://httpbin.org/delete")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.execute(method, url, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.execute(method, url, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.get(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a GET request and and yields the Crest::Response to the block.

+
Crest::Request.get("http://httpbin.org/get") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.get(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a GET request and returns a Crest::Response.

+
Crest::Request.get("http://httpbin.org/get")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.head(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a HEAD request and and yields the Crest::Response to the block.

+
Crest::Request.head("http://httpbin.org/head") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.head(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a HEAD request and returns a Crest::Response.

+
Crest::Request.head("http://httpbin.org/head")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.options(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a OPTIONS request and and yields the Crest::Response to the block.

+
Crest::Request.options("http://httpbin.org/options") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.options(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a OPTIONS request and returns a Crest::Response.

+
Crest::Request.options("http://httpbin.org/options")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.patch(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PATCH request and and yields the Crest::Response to the block.

+
Crest::Request.patch("http://httpbin.org/patch") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.patch(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a PATCH request and returns a Crest::Response.

+
Crest::Request.patch("http://httpbin.org/patch")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.post(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a POST request and and yields the Crest::Response to the block.

+
Crest::Request.post("http://httpbin.org/post") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.post(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a POST request and returns a Crest::Response.

+
Crest::Request.post("http://httpbin.org/post")
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.put(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PUT request and and yields the Crest::Response to the block.

+
Crest::Request.put("http://httpbin.org/put") do |resp|
+  while line = resp.body_io.gets
+    puts line
+  end
+end
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.put(url : String, form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a PUT request and returns a Crest::Response.

+
Crest::Request.put("http://httpbin.org/put")
+
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def auth : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def close(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def close(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def close_connection : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def closed? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def connect_timeout : Float32 | Int32 | Time::Span | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cookies : HTTP::Cookies + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def execute : Crest::Response + + # +
+ +
+ +

Execute HTTP request

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def execute(&block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute streaming HTTP request

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def form_data : IO | Slice(UInt8) | String | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def handle_errors : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def headers : HTTP::Headers + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def host(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def host(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def http_client : HTTP::Client + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def http_request : HTTP::Request + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def json : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def logger : Crest::Logger + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def logging : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def max_redirects : Int32 + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def method : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def multipart : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_addr : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_pass : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_port : Int32? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_user : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def password : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def password=(password : Nil | String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def port(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def port(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def proxy : HTTP::Proxy::Client? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def read_timeout : Float32 | Int32 | Time::Span | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def redirection_history : Array(Crest::Response) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def redirection_history=(redirection_history : Array(Crest::Response)) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def tls : OpenSSL::SSL::Context::Client? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def tls?(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def tls?(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_curl + + # +
+ +
+ +

Convert Request object to cURL command

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def url : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user=(user : Nil | String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user_agent : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def write_timeout : Float32 | Int32 | Time::Span | Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/RequestFailed.html b/Crest/RequestFailed.html new file mode 100644 index 00000000..11a551e7 --- /dev/null +++ b/Crest/RequestFailed.html @@ -0,0 +1,504 @@ + + + + + + + + + + + + + + + + + Crest::RequestFailed - crest master + + + + + + + + + + +
+

+ + class Crest::RequestFailed + +

+ + + + + + + +

+ + + + Overview +

+ +

This is the base Crest exception class. Rescue it if you want to +catch any exception that your request might raise +You can see anything about the response via e.response. +For example, the entire result body (which is +probably an HTML error page) is e.response.body.

+

Hash of HTTP status code => message.

+ +

See HTTP Status Code Registry +for more Information.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/exceptions.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + +

+ + + + Class Method Summary +

+ + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(response : Crest::Response) + + # +
+ +
+
+ + [View source] + +
+
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.subclass_by_status_code(status_code) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def http_code + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def message + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def response : Crest::Response + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/Resource.html b/Crest/Resource.html new file mode 100644 index 00000000..af5efecf --- /dev/null +++ b/Crest/Resource.html @@ -0,0 +1,1718 @@ + + + + + + + + + + + + + + + + + Crest::Resource - crest master + + + + + + + + + + +
+

+ + class Crest::Resource + +

+ + + + + + + +

+ + + + Overview +

+ +

A class that can be instantiated for access to a RESTful resource, +including authentication, proxy and logging.

+

Simple example:

+
resource = Crest::Resource.new("https://httpbin.org/get")
+response = resource.get
+

Block style:

+
resource = Crest::Resource.new("http://httpbin.org") do |res|
+  res.headers.merge!({"foo" => "bar"})
+end
+
+response = resource["/headers"].get
+

With HTTP basic authentication:

+
resource = Crest::Resource.new("https://httpbin.org/get", user: "user", password: "password")
+

Use the #[] syntax to allocate subresources:

+
resource = Crest::Resource.new("https://httpbin.org")
+resource["/get"].get
+

You can pass advanced parameters like default #params, #headers, or #cookies:

+
resource = Crest::Resource.new(
+  "https://httpbin.org",
+  params: {"key" => "key"},
+  headers: {"Content-Type" => "application/json"},
+  cookies: {"lang"=> "ua"}
+)
+response = response["/post"].post(
+  form: {:height => 100, "width" => "100"},
+  params: {:secret => "secret"},
+  cookies: {"locale"=> "en_US"}
+)
+

If you want to stream the data from the response you can pass a block:

+
resource = Crest::Resource.new("http://httpbin.org")
+resource["/stream/5"].get do |response|
+  while line = response.body_io.gets
+    puts line
+  end
+end
+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/resource.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(url : String, *, headers : Hash(String, String) = {} of String => String, params = {} of String => String, cookies = {} of String => String, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def self.new(url : String, **args) + + # +
+ +
+ +

When block is not given.

+
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def [](suburl) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def close(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def close(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def close_connection : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def closed? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def connect_timeout : Float32 | Int32 | Time::Span | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cookies : Hash(String, Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def delete(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a DELETE request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def delete(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a DELETE request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def delete(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a DELETE request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def delete(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a DELETE request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def get(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a GET request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def get(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a GET request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def get(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a GET request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def get(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a GET request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def handle_errors : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def head(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a HEAD request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def head(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a HEAD request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def head(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a HEAD request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def head(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a HEAD request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def headers : Hash(String, String) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def http_client : HTTP::Client + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def json : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def logger : Crest::Logger + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def logging : Bool + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def options(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a OPTIONS request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def options(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a OPTIONS request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def options(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a OPTIONS request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def options(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a OPTIONS request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_addr : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_pass : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_port : Int32? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def p_user : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def params : Hash(String, Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def password : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def patch(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a PATCH request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def patch(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a PATCH request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def patch(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PATCH request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def patch(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PATCH request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def post(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a POST request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def post(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a POST request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def post(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a POST request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def post(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a POST request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def put(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response + + # +
+ +
+ +

Execute a PUT request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def put(form = {} of String => String, **args) : Crest::Response + + # +
+ +
+ +

Execute a PUT request and returns a Crest::Response.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def put(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PUT request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def put(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil + + # +
+ +
+ +

Execute a PUT request and and yields the Crest::Response to the block.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def read_timeout : Float32 | Int32 | Time::Span | Nil + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def url : String + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def user_agent : String? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def write_timeout : Float32 | Int32 | Time::Span | Nil + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/Response.html b/Crest/Response.html new file mode 100644 index 00000000..b9c5dda7 --- /dev/null +++ b/Crest/Response.html @@ -0,0 +1,1140 @@ + + + + + + + + + + + + + + + + + Crest::Response - crest master + + + + + + + + + + +
+

+ + class Crest::Response + +

+ + + + + + + +

+ + + + Overview +

+ +

Response objects have several useful methods:

+ + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/response.cr + + +
+ + + + + + +

+ + + + Constructors +

+ + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

+ + + + Constructor Detail +

+ +
+
+ + def self.new(http_client_res : HTTP::Client::Response, request : Crest::Request) + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def body(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def body(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def body_io(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def body_io(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def client_error?(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def client_error?(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def content_length : Int64 + + # +
+ +
+ +

Size of the message body in bytes taken from "Content-Length" header

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def cookies + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def filename : String | Nil + + # +
+ +
+ +

Extracts filename from "Content-Disposition" header

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def headers + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def history : Array + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def http_client_res : HTTP::Client::Response + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def informational?(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def informational?(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def inspect + + # +
+ +
+ +
+ Description copied from class Object +
+ +

Returns an unambiguous and information-rich string representation of this +object, typically intended for developers.

+

This method should usually not be overridden. It delegates to +#inspect(IO) which can be overridden for custom implementations.

+

Also see #to_s.

+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def invalid? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def redirect? + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def redirection?(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def redirection?(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def request : Crest::Request + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def return! : Crest::Response + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def return!(&block : Crest::Response -> ) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def server_error?(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def server_error?(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def status(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def status(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def status_code(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def status_code(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def success?(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def success?(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_curl(*args, **options) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_curl(*args, **options, &) + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def to_s(io : IO) : Nil + + # +
+ +
+ +
+ Description copied from class Reference +
+ +

Appends a short String representation of this object +which includes its class name and its object address.

+
class Person
+  def initialize(@name : String, @age : Int32)
+  end
+end
+
+Person.new("John", 32).to_s # => #<Person:0x10a199f20>
+
+ +
+
+ + [View source] + +
+
+ +
+
+ + def url : String + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/TimeoutValue.html b/Crest/TimeoutValue.html new file mode 100644 index 00000000..47426be2 --- /dev/null +++ b/Crest/TimeoutValue.html @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + Crest::TimeoutValue - crest master + + + + + + + + + + +
+

+ + alias Crest::TimeoutValue + +

+ + + + + + + +

+ + + + Alias Definition +

+ Float32 | Int32 | Time::Span + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest.cr + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + + + + + + +
+ + + diff --git a/Crest/UrlencodedForm.html b/Crest/UrlencodedForm.html new file mode 100644 index 00000000..0dad56cc --- /dev/null +++ b/Crest/UrlencodedForm.html @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + Crest::UrlencodedForm(T) - crest master + + + + + + + + + + +
+

+ + class Crest::UrlencodedForm(T) + +

+ + + + + + + +

+ + + + Overview +

+ +

This class lets crest emulate a filled-in form +in which a user has pressed the submit button. +This causes crest to POST data using the +"Content-Type" application/x-www-form-urlencoded.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/forms/urlencoded_form.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + +

Instance methods inherited from class Crest::Form(T)

+ + + + content_type + content_type, + + + + form_data + form_data, + + + + generate + generate, + + + + params + params + + + + + + + + + +

Class methods inherited from class Crest::Form(T)

+ + + + generate(params : Hash, params_encoder : Crest::ParamsEncoder.class) + generate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def generate + + # +
+ +
+
+ + [View source] + +
+
+ +
+
+ + def parsed_params + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Crest/ZeroEnumeratedFlatParamsEncoder.html b/Crest/ZeroEnumeratedFlatParamsEncoder.html new file mode 100644 index 00000000..ea457973 --- /dev/null +++ b/Crest/ZeroEnumeratedFlatParamsEncoder.html @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + Crest::ZeroEnumeratedFlatParamsEncoder - crest master + + + + + + + + + + +
+

+ + class Crest::ZeroEnumeratedFlatParamsEncoder + +

+ + + + + + + + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + crest/params_encoders/zero_enumerated_flat_params_encoder.cr + + +
+ + + + + + + + +

+ + + + Class Method Summary +

+ + + + + + + + +
+ + + +

Instance methods inherited from class Crest::EnumeratedFlatParamsEncoder

+ + + + encode(params : Hash) : String + encode + + + + + + + + + +

Class methods inherited from class Crest::EnumeratedFlatParamsEncoder

+ + + + array_start_index + array_start_index, + + + + flatten_params(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
flatten_params(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))
+ flatten_params
+ + + + + + + + + + +

Instance methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode + + + + + + + + + +

Class methods inherited from class Crest::ParamsEncoder

+ + + + encode(params : Hash) : String + encode, + + + + flatten_params(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue)) + flatten_params + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ + + + Class Method Detail +

+ +
+
+ + def self.array_start_index + + # +
+ +
+
+ + [View source] + +
+
+ + + + + + + +
+ + + diff --git a/Float.html b/Float.html new file mode 100644 index 00000000..a9ee8e77 --- /dev/null +++ b/Float.html @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + Float - crest master + + + + + + + + + + +
+

+ + abstract struct Float + +

+ + + + + + + +

+ + + + Overview +

+ +

Float is the base type of all floating point numbers.

+

There are two floating point types, Float32 and Float64, +which correspond to the binary32 +and binary64 +types defined by IEEE.

+

A floating point literal is an optional + or - sign, followed by +a sequence of numbers or underscores, followed by a dot, +followed by numbers or underscores, followed by an optional exponent suffix, +followed by an optional type suffix. If no suffix is present, the literal's type is Float64.

+
1.0     # Float64
+1.0_f32 # Float32
+1_f32   # Float32
+
+1e10   # Float64
+1.5e10 # Float64
+1.5e-7 # Float64
+
++1.3 # Float64
+-0.5 # Float64
+

The underscore _ before the suffix is optional.

+

Underscores can be used to make some numbers more readable:

+
1_000_000.111_111 # better than 1000000.111111
+

See Float literals in the language reference.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + ext/float.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_time_span : Time::Span + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/Int.html b/Int.html new file mode 100644 index 00000000..89c3250f --- /dev/null +++ b/Int.html @@ -0,0 +1,423 @@ + + + + + + + + + + + + + + + + + Int - crest master + + + + + + + + + + +
+

+ + abstract struct Int + +

+ + + + + + + +

+ + + + Overview +

+ +

Int is the base type of all integer types.

+

There are four signed integer types: Int8, Int16, Int32 and Int64, +being able to represent numbers of 8, 16, 32 and 64 bits respectively. +There are four unsigned integer types: UInt8, UInt16, UInt32 and UInt64.

+

An integer literal is an optional + or - sign, followed by +a sequence of digits and underscores, optionally followed by a suffix. +If no suffix is present, the literal's type is Int32, or Int64 if the +number doesn't fit into an Int32:

+
1 # Int32
+
+1_i8  # Int8
+1_i16 # Int16
+1_i32 # Int32
+1_i64 # Int64
+
+1_u8  # UInt8
+1_u16 # UInt16
+1_u32 # UInt32
+1_u64 # UInt64
+
++10 # Int32
+-20 # Int32
+
+2147483648 # Int64
+

Literals without a suffix that are larger than Int64::MAX represent a +UInt64 if the number fits, e.g. 9223372036854775808 and +0x80000000_00000000. This behavior is deprecated and will become an error in +the future.

+

The underscore _ before the suffix is optional.

+

Underscores can be used to make some numbers more readable:

+
1_000_000 # better than 1000000
+

Binary numbers start with 0b:

+
0b1101 # == 13
+

Octal numbers start with 0o:

+
0o123 # == 83
+

Hexadecimal numbers start with 0x:

+
0xFE012D # == 16646445
+0xfe012d # == 16646445
+

See Integer literals in the language reference.

+ + + + + + + + + + + + + + +

+ + + + Defined in: +

+ + + + ext/int.cr + + +
+ + + + + + + + + + + + +

+ + + + Instance Method Summary +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

+ + + + Instance Method Detail +

+ +
+
+ + def to_time_span : Time::Span + + # +
+ +
+
+ + [View source] + +
+
+ + + +
+ + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 00000000..3d0a8a5f --- /dev/null +++ b/css/style.css @@ -0,0 +1,980 @@ +:root { + color-scheme: light dark; +} + +html, body { + background: #FFFFFF; + position: relative; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +body { + font-family: "Avenir", "Tahoma", "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + color: #333; + line-height: 1.5; +} + +a { + color: #263F6C; +} + +a:visited { + color: #112750; +} + +h1, h2, h3, h4, h5, h6 { + margin: 35px 0 25px; + color: #444444; +} + +h1.type-name { + color: #47266E; + margin: 20px 0 30px; + background-color: #F8F8F8; + padding: 10px 12px; + border: 1px solid #EBEBEB; + border-radius: 2px; +} + +h2 { + border-bottom: 1px solid #E6E6E6; + padding-bottom: 5px; +} + +body { + display: flex; +} + +.sidebar, .main-content { + overflow: auto; +} + +.sidebar { + width: 30em; + color: #F8F4FD; + background-color: #2E1052; + padding: 0 0 30px; + box-shadow: inset -3px 0 4px rgba(0,0,0,.35); + line-height: 1.2; + z-index: 0; +} + +.sidebar .search-box { + padding: 13px 9px; +} + +.sidebar input { + display: block; + box-sizing: border-box; + margin: 0; + padding: 5px; + font: inherit; + font-family: inherit; + line-height: 1.2; + width: 100%; + border: 0; + outline: 0; + border-radius: 2px; + box-shadow: 0px 3px 5px rgba(0,0,0,.25); + transition: box-shadow .12s; +} + +.sidebar input:focus { + box-shadow: 0px 5px 6px rgba(0,0,0,.5); +} + +.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-moz-placeholder { /* Firefox 18- */ + color: #757575; + font-size: 14px; + text-indent: 2px; +} + +.project-summary { + padding: 9px 15px 30px 30px; +} + +.project-name { + font-size: 1.4rem; + margin: 0; + color: #f4f4f4; + font-weight: 600; +} + +.project-version { + margin-top: 5px; + display: inline-block; + position: relative; +} + +.project-version > form::after { + position: absolute; + right: 0; + top: 0; + content: "\25BC"; + font-size: .6em; + line-height: 1.2rem; + z-index: -1; +} + +.project-versions-nav { + cursor: pointer; + margin: 0; + padding: 0 .9em 0 0; + border: none; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: transparent; + color: inherit; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +.project-versions-nav:focus { + outline: none; +} + +.project-versions-nav > option { + color: initial; +} + +.sidebar ul { + margin: 0; + padding: 0; + list-style: none outside; +} + +.sidebar li { + display: block; + position: relative; +} + +.types-list li.hide { + display: none; +} + +.sidebar a { + text-decoration: none; + color: inherit; + transition: color .14s; +} +.types-list a { + display: block; + padding: 5px 15px 5px 30px; +} + +.types-list { + display: block; +} + +.sidebar a:focus { + outline: 1px solid #D1B7F1; +} + +.types-list a { + padding: 5px 15px 5px 30px; +} + +.sidebar .current > a, +.sidebar a:hover { + color: #866BA6; +} + +.types-list li ul { + overflow: hidden; + height: 0; + max-height: 0; + transition: 1s ease-in-out; +} + +.types-list li.parent { + padding-left: 30px; +} + +.types-list li.parent::before { + box-sizing: border-box; + content: "â–¼"; + display: block; + width: 30px; + height: 30px; + position: absolute; + top: 0; + left: 0; + text-align: center; + color: white; + font-size: 8px; + line-height: 30px; + transform: rotateZ(-90deg); + cursor: pointer; + transition: .2s linear; +} + + +.types-list li.parent > a { + padding-left: 0; +} + +.types-list li.parent.open::before { + transform: rotateZ(0); +} + +.types-list li.open > ul { + height: auto; + max-height: 1000em; +} + +.main-content { + padding: 0 30px 30px 30px; + width: 100%; +} + +.kind { + font-size: 60%; + color: #866BA6; +} + +.superclass-hierarchy { + margin: -15px 0 30px 0; + padding: 0; + list-style: none outside; + font-size: 80%; +} + +.superclass-hierarchy .superclass { + display: inline-block; + margin: 0 7px 0 0; + padding: 0; +} + +.superclass-hierarchy .superclass + .superclass::before { + content: "<"; + margin-right: 7px; +} + +.other-types-list li { + display: inline-block; +} + +.other-types-list, +.list-summary { + margin: 0 0 30px 0; + padding: 0; + list-style: none outside; +} + +.entry-const { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +.entry-const code { + white-space: pre-wrap; +} + +.entry-summary { + padding-bottom: 4px; +} + +.superclass-hierarchy .superclass a, +.other-type a, +.entry-summary .signature { + padding: 4px 8px; + margin-bottom: 4px; + display: inline-block; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + text-decoration: none; + border-radius: 3px; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: background .15s, border-color .15s; +} + +.superclass-hierarchy .superclass a:hover, +.other-type a:hover, +.entry-summary .signature:hover { + background: #D5CAE3; + border-color: #624288; +} + +.entry-summary .summary { + padding-left: 32px; +} + +.entry-summary .summary p { + margin: 12px 0 16px; +} + +.entry-summary a { + text-decoration: none; +} + +.entry-detail { + padding: 30px 0; +} + +.entry-detail .signature { + position: relative; + padding: 5px 15px; + margin-bottom: 10px; + display: block; + border-radius: 5px; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: .2s ease-in-out; +} + +.entry-detail:target .signature { + background-color: #D5CAE3; + border: 1px solid #624288; +} + +.entry-detail .signature .method-permalink { + position: absolute; + top: 0; + left: -35px; + padding: 5px 15px; + text-decoration: none; + font-weight: bold; + color: #624288; + opacity: .4; + transition: opacity .2s; +} + +.entry-detail .signature .method-permalink:hover { + opacity: 1; +} + +.entry-detail:target .signature .method-permalink { + opacity: 1; +} + +.methods-inherited { + padding-right: 10%; + line-height: 1.5em; +} + +.methods-inherited h3 { + margin-bottom: 4px; +} + +.methods-inherited a { + display: inline-block; + text-decoration: none; + color: #47266E; +} + +.methods-inherited a:hover { + text-decoration: underline; + color: #6C518B; +} + +.methods-inherited .tooltip>span { + background: #D5CAE3; + padding: 4px 8px; + border-radius: 3px; + margin: -4px -8px; +} + +.methods-inherited .tooltip * { + color: #47266E; +} + +pre { + padding: 10px 20px; + margin-top: 4px; + border-radius: 3px; + line-height: 1.45; + overflow: auto; + color: #333; + background: #fdfdfd; + font-size: 14px; + border: 1px solid #eee; +} + +code { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +:not(pre) > code { + background-color: rgba(40,35,30,0.05); + padding: 0.2em 0.4em; + font-size: 85%; + border-radius: 3px; +} + +span.flag { + padding: 2px 4px 1px; + border-radius: 3px; + margin-right: 3px; + font-size: 11px; + border: 1px solid transparent; +} + +span.flag.orange { + background-color: #EE8737; + color: #FCEBDD; + border-color: #EB7317; +} + +span.flag.yellow { + background-color: #E4B91C; + color: #FCF8E8; + border-color: #B69115; +} + +span.flag.green { + background-color: #469C14; + color: #E2F9D3; + border-color: #34700E; +} + +span.flag.red { + background-color: #BF1919; + color: #F9ECEC; + border-color: #822C2C; +} + +span.flag.purple { + background-color: #2E1052; + color: #ECE1F9; + border-color: #1F0B37; +} + +span.flag.lime { + background-color: #a3ff00; + color: #222222; + border-color: #00ff1e; +} + +.tooltip>span { + position: absolute; + opacity: 0; + display: none; + pointer-events: none; +} + +.tooltip:hover>span { + display: inline-block; + opacity: 1; +} + +.c { + color: #969896; +} + +.n { + color: #0086b3; +} + +.t { + color: #0086b3; +} + +.s { + color: #183691; +} + +.i { + color: #7f5030; +} + +.k { + color: #a71d5d; +} + +.o { + color: #a71d5d; +} + +.m { + color: #795da3; +} + +.hidden { + display: none; +} +.search-results { + font-size: 90%; + line-height: 1.3; +} + +.search-results mark { + color: inherit; + background: transparent; + font-weight: bold; +} +.search-result { + padding: 5px 8px 5px 5px; + cursor: pointer; + border-left: 5px solid transparent; + transform: translateX(-3px); + transition: all .2s, background-color 0s, border .02s; + min-height: 3.2em; +} +.search-result.current { + border-left-color: #ddd; + background-color: rgba(200,200,200,0.4); + transform: translateX(0); + transition: all .2s, background-color .5s, border 0s; +} +.search-result.current:hover, +.search-result.current:focus { + border-left-color: #866BA6; +} +.search-result:not(.current):nth-child(2n) { + background-color: rgba(255,255,255,.06); +} +.search-result__title { + font-size: 105%; + word-break: break-all; + line-height: 1.1; + padding: 3px 0; +} +.search-result__title strong { + font-weight: normal; +} +.search-results .search-result__title > a { + padding: 0; + display: block; +} +.search-result__title > a > .args { + color: #dddddd; + font-weight: 300; + transition: inherit; + font-size: 88%; + line-height: 1.2; + letter-spacing: -.02em; +} +.search-result__title > a > .args * { + color: inherit; +} + +.search-result a, +.search-result a:hover { + color: inherit; +} +.search-result:not(.current):hover .search-result__title > a, +.search-result:not(.current):focus .search-result__title > a, +.search-result__title > a:focus { + color: #866BA6; +} +.search-result:not(.current):hover .args, +.search-result:not(.current):focus .args { + color: #6a5a7d; +} + +.search-result__type { + color: #e8e8e8; + font-weight: 300; +} +.search-result__doc { + color: #bbbbbb; + font-size: 90%; +} +.search-result__doc p { + margin: 0; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 1.2em; + max-height: 2.4em; +} + +.js-modal-visible .modal-background { + display: flex; +} +.main-content { + position: relative; +} +.modal-background { + position: absolute; + display: none; + height: 100%; + width: 100%; + background: rgba(120,120,120,.4); + z-index: 100; + align-items: center; + justify-content: center; +} +.usage-modal { + max-width: 90%; + background: #fff; + border: 2px solid #ccc; + border-radius: 9px; + padding: 5px 15px 20px; + min-width: 50%; + color: #555; + position: relative; + transform: scale(.5); + transition: transform 200ms; +} +.js-modal-visible .usage-modal { + transform: scale(1); +} +.usage-modal > .close-button { + position: absolute; + right: 15px; + top: 8px; + color: #aaa; + font-size: 27px; + cursor: pointer; +} +.usage-modal > .close-button:hover { + text-shadow: 2px 2px 2px #ccc; + color: #999; +} +.modal-title { + margin: 0; + text-align: center; + font-weight: normal; + color: #666; + border-bottom: 2px solid #ddd; + padding: 10px; +} +.usage-list { + padding: 0; + margin: 13px; +} +.usage-list > li { + padding: 5px 2px; + overflow: auto; + padding-left: 100px; + min-width: 12em; +} +.usage-modal kbd { + background: #eee; + border: 1px solid #ccc; + border-bottom-width: 2px; + border-radius: 3px; + padding: 3px 8px; + font-family: monospace; + margin-right: 2px; + display: inline-block; +} +.usage-key { + float: left; + clear: left; + margin-left: -100px; + margin-right: 12px; +} +.doc-inherited { + font-weight: bold; +} + +.anchor { + float: left; + padding-right: 4px; + margin-left: -20px; +} + +.main-content .anchor .octicon-link { + width: 16px; + height: 16px; +} + +.main-content .anchor:focus { + outline: none +} + +.main-content h1:hover .anchor, +.main-content h2:hover .anchor, +.main-content h3:hover .anchor, +.main-content h4:hover .anchor, +.main-content h5:hover .anchor, +.main-content h6:hover .anchor { + text-decoration: none +} + +.main-content h1 .octicon-link, +.main-content h2 .octicon-link, +.main-content h3 .octicon-link, +.main-content h4 .octicon-link, +.main-content h5 .octicon-link, +.main-content h6 .octicon-link { + visibility: hidden +} + +.main-content h1:hover .anchor .octicon-link, +.main-content h2:hover .anchor .octicon-link, +.main-content h3:hover .anchor .octicon-link, +.main-content h4:hover .anchor .octicon-link, +.main-content h5:hover .anchor .octicon-link, +.main-content h6:hover .anchor .octicon-link { + visibility: visible +} + +img { + max-width: 100%; +} + +table { + font-size: 14px; + display: block; + max-width: -moz-fit-content; + max-width: fit-content; + overflow-x: auto; + white-space: nowrap; + background: #fdfdfd; + text-align: center; + border: 1px solid #eee; + border-collapse: collapse; + padding: 0px 5px 0px 5px; +} + +table th { + padding: 10px; + letter-spacing: 1px; + border-bottom: 1px solid #eee; +} + +table td { + padding: 10px; +} + +#sidebar-btn { + height: 32px; + width: 32px; +} + +#sidebar-btn-label { + height: 2em; + width: 2em; +} + +#sidebar-btn, #sidebar-btn-label { + display: none; + margin: .7rem; + appearance: none; + color: black; + cursor: pointer; +} + +@media only screen and (max-width: 635px) { + .sidebar, .main-content { + /* svg size + vertical margin - .search-box padding-top */ + padding-top: calc(2em + 2 * 0.7rem - 13px); + } + + #sidebar-btn, #sidebar-btn-label { + display: block; + position: absolute; + z-index: 50; + transition-duration: 200ms; + left: 0; + } + + #sidebar-btn:not(:checked) ~ #sidebar-btn-label > .close, + #sidebar-btn:checked ~ #sidebar-btn-label > .open, + #sidebar-btn:checked ~ .main-content { + display: none; + } + + #sidebar-btn:checked { + left: calc(100% - 32px - (2 * 0.7rem)); + } + + #sidebar-btn:checked ~ #sidebar-btn-label { + color: white; + /* 100% - svg size - horizontal margin */ + left: calc(100% - 2em - (2 * 0.7rem)); + } + + #sidebar-btn~.sidebar { + width: 0%; + } + + #sidebar-btn:checked~.sidebar { + visibility: visible; + width: 100%; + } + + .sidebar { + transition-duration: 200ms; + max-width: 100vw; + visibility: hidden; + } +} + +@media (prefers-color-scheme: dark) { + html, body { + background: #1b1b1b; + } + + body { + color: white; + } + + a { + color: #8cb4ff; + } + + .main-content a:visited { + color: #5f8de3; + } + + h1, h2, h3, h4, h5, h6 { + color: white; + } + + h1.type-name { + color: white; + background-color: #202020; + border: 1px solid #353535; + } + + .project-versions-nav > option { + background-color: #222; + } + + .superclass-hierarchy .superclass a, + .superclass-hierarchy .superclass a:visited, + .other-type a, + .other-type a:visited, + .entry-summary .signature, + .entry-summary a:visited { + background-color: #202020; + color: white; + border: 1px solid #353535; + } + + .superclass-hierarchy .superclass a:hover, + .other-type a:hover, + .entry-summary .signature:hover { + background: #443d4d; + border-color: #b092d4; + } + + .kind { + color: #b092d4; + } + + .n { + color: #00ade6; + } + + .t { + color: #00ade6; + } + + .k { + color: #ff66ae; + } + + .o { + color: #ff66ae; + } + + .s { + color: #7799ff; + } + + .i { + color: #b38668; + } + + .m { + color: #b9a5d6; + } + + .c { + color: #a1a1a1; + } + + .methods-inherited a, .methods-inherited a:visited { + color: #B290D9; + } + + .methods-inherited a:hover { + color: #D4B7F4; + } + + .methods-inherited .tooltip>span { + background: #443d4d; + } + + .methods-inherited .tooltip * { + color: white; + } + + .entry-detail:target .signature { + background-color: #443d4d; + border: 1px solid #b092d4; + } + + .entry-detail .signature { + background-color: #202020; + color: white; + border: 1px solid #353535; + } + + .entry-detail .signature .method-permalink { + color: #b092d4; + } + + :not(pre)>code { + background-color: #202020; + } + + span.flag.purple { + background-color: #443d4d; + color: #ECE1F9; + border-color: #b092d4; + } + + .sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: white; + } + + .sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: white; + } + + .sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: white; + } + + .sidebar input:-moz-placeholder { /* Firefox 18- */ + color: white; + } + + pre, + table { + color: white; + background: #202020; + border: 1px solid #353535; + } + + table th { + border-bottom: 1px solid #353535; + } + + #sidebar-btn, #sidebar-btn-label { + color: white; + } +} diff --git a/index.html b/index.html new file mode 100644 index 00000000..7bf54bbe --- /dev/null +++ b/index.html @@ -0,0 +1,821 @@ + + + + + + + + + + + + + + + + + crest master + + + + + + + + + + +
+

+

+

crest

+

Codacy Badge +Crystal CI +GitHub release +Commits Since Last Release +Docs +License

+ +

All Contributors

+ +

Visitors

+

HTTP and REST client for Crystal, inspired by the Ruby's RestClient gem.

+

Beloved features:

+ +

Hopefully, someday I can remove this shard though. Ideally, Crystal's standard library would do all this already.

+

+ +Installation

+

Add this to your application's shard.yml:

+
dependencies:
+  crest:
+    github: mamantoha/crest
+

+ +Usage

+
require "crest"
+

Basic usage:

+
Crest.get(
+  "http://httpbin.org/get",
+  params: {:lang => "en"},
+  user_agent: "Mozilla/5.0"
+)
+# curl -L http://httpbin.org/get?lang=en -H 'User-Agent: Mozilla/5.0'
+
+Crest.post(
+  "http://httpbin.org/post",
+  {:age => 27, :name => {:first => "Kurt", :last => "Cobain"}}
+)
+# curl -L --data "age=27&name[first]=Kurt&name[last]=Cobain" -X POST "http://httpbin.org/post"
+
+Crest.post(
+  "http://httpbin.org/post",
+  {"file" => File.open("avatar.png"), "name" => "John"}
+)
+# curl -X POST http://httpbin.org/post -F 'file=@/path/to/avatar.png' -F 'name=John' -H 'Content-Type: multipart/form-data'
+
+response = Crest.post(
+  "http://httpbin.org/post",
+  {:age => 27, :name => {:first => "Kurt", :last => "Cobain"}},
+  json: true
+)
+# curl -X POST http://httpbin.org/post -d '{"age":27,"name":{"first":"Kurt","last":"Cobain"}}' -H 'Content-Type: application/json'
+

+ +Request

+

Crest::Request accept next parameters:

+

Mandatory parameters:

+ +

Optional parameters:

+ +

More detailed examples:

+
request = Crest::Request.new(:post,
+  "http://httpbin.org/post",
+  headers: {"Content-Type" => "application/json"},
+  form: {:width => 640, "height" => "480"}
+)
+request.execute
+# curl -L --data "width=640&height=480" --header "Content-Type: application/json" -X POST "http://httpbin.org/post"
+
Crest::Request.execute(:get,
+  "http://httpbin.org/get",
+  params: {:width => 640, "height" => "480"},
+  headers: {"Content-Type" => "application/json"}
+)
+# curl -L --header "Content-Type: application/json" "http://httpbin.org/get?width=640&height=480"
+
Crest::Request.new(:post, "http://httpbin.org/post", {:foo => "bar"}, json: true)
+
+# curl -X POST http://httpbin.org/post -d '{\"foo\":\"bar\"}' -H 'Content-Type: application/json'"
+
Crest::Request.get(
+  "http://httpbin.org/get",
+  p_addr: "127.0.0.1",
+  p_port: 3128,
+  p_user: "admin",
+  p_pass: "1234"
+)
+# curl -L --proxy admin:1234@127.0.0.1:3128 "http://httpbin.org/get"
+

A block can be passed to the Crest::Request initializer.

+

This block will then be called with the Crest::Request.

+
request = Crest::Request.new(:get, "http://httpbin.org/headers") do |request|
+  request.headers.add("foo", "bar")
+end
+
+request.execute
+# curl -L --header "foo: bar" http://httpbin.org/headers
+

+ +Resource

+

A Crest::Resource class can be instantiated for access to a RESTful resource, +including authentication, proxy and logging.

+

Additionally, you can set default params, headers, and cookies separately. +So you can use Crest::Resource to share common params, headers, and cookies.

+

The final parameters consist of:

+ +

This is especially useful if you wish to define your site in one place and +call it in multiple locations.

+
resource = Crest::Resource.new(
+  "http://httpbin.org",
+  params: {"key" => "value"},
+  headers: {"Content-Type" => "application/json"},
+  cookies: {"lang" => "uk"}
+)
+
+resource["/get"].get(
+  headers: {"Auth-Token" => "secret"}
+)
+
+resource["/post"].post(
+  {:height => 100, "width" => "100"},
+  params: {:secret => "secret"}
+)
+

Use the [] syntax to allocate subresources:

+
site = Crest::Resource.new("http://httpbin.org")
+
+site["/post"].post({:param1 => "value1", :param2 => "value2"})
+# curl -L --data "param1=value1&param2=value2" -X POST http://httpbin.org/post
+

You can pass suburl through Request#http_verb methods:

+
site = Crest::Resource.new("http://httpbin.org")
+
+site.post("/post", {:param1 => "value1", :param2 => "value2"})
+# curl -L --data "param1=value1&param2=value2" -X POST http://httpbin.org/post
+
+site.get("/get", params: {:status => "active"})
+# curl -L http://httpbin.org/get?status=active
+

A block can be passed to the Crest::Resource instance.

+

This block will then be called with the Crest::Resource.

+
resource = Crest::Resource.new("http://httpbin.org") do |resource|
+  resource.headers.merge!({"foo" => "bar"})
+end
+
+resource["/headers"].get
+

With HTTP basic authentication:

+
resource = Crest::Resource.new(
+  "http://httpbin.org/basic-auth/user/passwd",
+  user: "user",
+  password: "passwd"
+)
+

With Proxy:

+
resource = Crest::Resource.new(
+  "http://httpbin.org/get",
+  p_addr: "localhost",
+  p_port: 3128
+)
+

+ +Result handling

+

The result of a Crest::Request and Crest::Resource is a Crest::Response object.

+

Response objects have several useful methods:

+ +

+ +Exceptions

+ +
Crest.get("http://httpbin.org/status/404")
+# => HTTP status code 404: Not Found (Crest::NotFound)
+
+begin
+  Crest.get("http://httpbin.org/status/404")
+rescue ex : Crest::NotFound
+  puts ex.response
+end
+

To not raise exceptions but return the Crest::Response you can set handle_errors to false.

+
response = Crest.get("http://httpbin.org/status/404", handle_errors: false) do |resp|
+  case resp
+  when .success?
+    puts resp.body_io.gets_to_end
+  when .client_error?
+    puts "Client error"
+  when .server_error?
+    puts "Server error"
+  end
+end
+# => Client error
+
+response.status_code # => 404
+

But note that it may be more straightforward to use exceptions to handle different HTTP error response cases:

+
response = begin
+  Crest.get("http://httpbin.org/status/404")
+rescue ex : Crest::NotFound
+  puts "Not found"
+  ex.response
+rescue ex : Crest::InternalServerError
+  puts "Internal server error"
+  ex.response
+end
+# => Not found
+
+response.status_code # => 404
+

+ +Parameters serializer

+

Crest::ParamsEncoder class is used to encode parameters.

+

The encoder affect both how crest processes query strings and how it serializes POST bodies.

+

The default encoder is Crest::FlatParamsEncoder.

+

It provides #encode method, which converts the given params into a URI query string:

+
Crest::FlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1})
+# => 'a[]=one&a[]=two&a[]=three&b=true&c=C&d=1'
+

+ +Custom parameters serializers

+

You can build a custom params encoder.

+

The value of Crest params_encoder can be any subclass of Crest::ParamsEncoder that implement #encode(Hash) #=> String

+

Also Crest include other encoders.

+

+ +Crest::NestedParamsEncoder

+
response = Crest.post(
+  "http://httpbin.org/post",
+  {"size" => "small", "topping" => ["bacon", "onion"]},
+  params_encoder: Crest::NestedParamsEncoder
+)
+
+# => curl -X POST http://httpbin.org/post -d 'size=small&topping=bacon&topping=onion' -H 'Content-Type: application/x-www-form-urlencoded'
+

+ +Crest::EnumeratedFlatParamsEncoder

+
response = Crest.post(
+  "http://httpbin.org/post",
+  {"size" => "small", "topping" => ["bacon", "onion"]},
+  params_encoder: Crest::EnumeratedFlatParamsEncoder
+)
+
+# => curl -X POST http://httpbin.org/post -d 'size=small&topping[1]=bacon&topping[2]=onion' -H 'Content-Type: application/x-www-form-urlencoded'
+

+ +Crest::ZeroEnumeratedFlatParamsEncoder

+
response = Crest.post(
+  "http://httpbin.org/post",
+  {"size" => "small", "topping" => ["bacon", "onion"]},
+  params_encoder: Crest::ZeroEnumeratedFlatParamsEncoder
+)
+
+# => curl -X POST http://httpbin.org/post -d 'size=small&topping[0]=bacon&topping[1]=onion' -H 'Content-Type: application/x-www-form-urlencoded'
+

+ +Streaming responses

+

Normally, when you use Crest, Crest::Request or Crest::Resource methods to retrieve data, the entire response is buffered in memory and returned as the response to the call.

+

However, if you are retrieving a large amount of data, for example, an iso, or any other large file, you may want to stream the response directly to disk rather than loading it into memory. If you have a very large file, it may become impossible to load it into memory.

+

If you want to stream the data from the response to a file as it comes, rather than entirely in memory, you can pass a block to which you pass a additional logic, which you can use to stream directly to a file as each chunk is received.

+

With a block, an Crest::Response body is returned and the response's body is available as an IO by invoking Crest::Response#body_io.

+

The following is an example:

+
Crest.get("https://github.com/crystal-lang/crystal/archive/1.0.0.zip") do |resp|
+  filename = resp.filename || "crystal.zip"
+
+  File.open(filename, "w") do |file|
+    IO.copy(resp.body_io, file)
+  end
+end
+

+ +Advanced Usage

+

This section covers some of crest more advanced features.

+

+ +Multipart

+

Yeah, that's right! This does multipart sends for you!

+
file = File.open("#{__DIR__}/example.png")
+Crest.post("http://httpbin.org/post", {:image => file})
+
file_content = "id,name\n1,test"
+file = IO::Memory.new(file_content)
+Crest.post("http://httpbin.org/post", {"data.csv" => file})
+
file = File.open("#{__DIR__}/example.png")
+resource = Crest::Resource.new("https://httpbin.org")
+response = resource["/post"].post({:image => file})
+

+ +JSON payload

+

crest speaks JSON natively by passing json: true argument to crest.

+
Crest.post("http://httpbin.org/post", {:foo => "bar"}, json: true)
+

As well you can serialize your form to a string by itself before passing it to crest.

+
Crest.post(
+  "http://httpbin.org/post",
+  {:foo => "bar"}.to_json
+  headers: {"Accept" => "application/json", "Content-Type" => "application/json"},
+)
+

+ +Headers

+

Request headers can be set by passing a hash containing keys and values representing header names and values:

+
response = Crest.get(
+  "http://httpbin.org/bearer",
+  headers: {"Authorization" => "Bearer cT0febFoD5lxAlNAXHo6g"}
+)
+response.headers
+# => {"Authorization" => ["Bearer cT0febFoD5lxAlNAXHo6g"]}
+

+ +Cookies

+

Request and Response objects know about HTTP cookies, and will automatically extract and set headers for them as needed:

+
response = Crest.get(
+  "http://httpbin.org/cookies/set",
+  params: {"k1" => "v1", "k2" => "v2"}
+)
+response.cookies
+# => {"k1" => "v1", "k2" => "v2"}
+
response = Crest.get(
+  "http://httpbin.org/cookies",
+  cookies: {"k1" => "v1", "k2" => {"kk2" => "vv2"}}
+)
+response.cookies
+# => {"k1" => "v1", "k2[kk2]" => "vv2"}
+

+ +Basic access authentication

+

For basic access authentication for an HTTP user agent you should to provide a user name and password when making a request.

+
Crest.get(
+  "http://httpbin.org/basic-auth/user/passwd",
+  user: "user",
+  password: "passwd"
+)
+# curl -L --user user:passwd http://httpbin.org/basic-auth/user/passwd
+

+ +Digest access authentication

+

For digest access authentication for an HTTP user agent you should to provide a user name and password when making a request.

+
Crest.get(
+  "https://httpbin.org/digest-auth/auth/user/passwd/MD5",
+  auth: "digest",
+  user: "user",
+  password: "passwd"
+)
+# curl -L --digest --user user:passwd https://httpbin.org/digest-auth/auth/user/passwd/MD5
+

+ +SSL/TLS support

+

If tls is given it will be used:

+
Crest.get("https://expired.badssl.com", tls: OpenSSL::SSL::Context::Client.insecure)
+

+ +Proxy

+

If you need to use a proxy, you can configure individual requests with the proxy host and port arguments to any request method:

+
Crest.get(
+  "http://httpbin.org/ip",
+  p_addr: "localhost",
+  p_port: 3128
+)
+

To use authentication with your proxy, use next syntax:

+
Crest.get(
+  "http://httpbin.org/ip",
+  p_addr: "localhost",
+  p_port: 3128,
+  p_user: "user",
+  p_pass: "qwerty"
+)
+

+ +Logging

+
+

Logger class is completely taken from halite shard. +Thanks icyleaf!

+
+

By default, the Crest does not enable logging. You can enable it per request by setting logging: true:

+
Crest.get("http://httpbin.org/get", logging: true)
+
+ +Filter sensitive information from logs with a regex matcher
+
resource = Crest::Request.get("http://httpbin.org/get", params: {api_key => "secret"}, logging: true) do |request|
+  request.logger.filter(/(api_key=)(\w+)/, "\\1[REMOVED]")
+end
+
+# => crest | 2018-07-04 14:49:49 | GET | http://httpbin.org/get?api_key=[REMOVED]
+
+ +Customize logger
+

You can create the custom logger by integration Crest::Logger abstract class. +Here has two methods must be implement: Crest::Logger.request and Crest::Logger.response.

+
class MyLogger < Crest::Logger
+  def request(request)
+    @logger.info { ">> | %s | %s" % [request.method, request.url] }
+  end
+
+  def response(response)
+    @logger.info { "<< | %s | %s" % [response.status_code, response.url] }
+  end
+end
+
+Crest.get("http://httpbin.org/get", logging: true, logger: MyLogger.new)
+

+ +Redirection

+

By default, crest will follow HTTP 30x redirection requests.

+

To disable automatic redirection, set :max_redirects => 0.

+
Crest::Request.execute(method: :get, url: "http://httpbin.org/redirect/1", max_redirects: 0)
+# => Crest::Found: 302 Found
+

+ +Access HTTP::Client

+

You can access HTTP::Client via the http_client instance method.

+

This is usually used to set additional options (e.g. read timeout, authorization header etc.)

+
client = HTTP::Client.new("httpbin.org")
+client.read_timeout = 1.second
+
+begin
+  Crest::Request.new(:get,
+    "http://httpbin.org/delay/10",
+    http_client: client
+  )
+rescue IO::TimeoutError
+  puts "Timeout!"
+end
+
client = HTTP::Client.new("httpbin.org")
+client.read_timeout = 1.second
+
+begin
+  resource = Crest::Resource.new("http://httpbin.org", http_client: client)
+  resource.get("/delay/10")
+rescue IO::TimeoutError
+  puts "Timeout!"
+end
+

+ +Convert Request object to cURL command

+

Use to_curl method on instance of Crest::Request to convert request to cURL command.

+
request = Crest::Request.new(
+  :post,
+  "http://httpbin.org/post",
+  {"title" => "New Title", "author" => "admin"}
+)
+request.to_curl
+# => curl -X POST http://httpbin.org/post -d 'title=New+Title&author=admin' -H 'Content-Type: application/x-www-form-urlencoded'
+
request = Crest::Request.new(
+  :get,
+  "http://httpbin.org/basic-auth/user/passwd",
+  user: "user",
+  password: "passwd"
+)
+request.to_curl
+# => curl -X GET http://httpbin.org/basic-auth/user/passwd --user user:passwd
+

Also you can directly use Crest::Curlify which accept instance of Crest::Request

+
request = Crest::Request.new(:get, "http://httpbin.org")
+Crest::Curlify.new(request).to_curl
+# => curl -X GET http://httpbin.org
+

+ +Params decoder

+

Crest::ParamsDecoder is a module for decoding query-string into parameters.

+
query = "size=small&topping[1]=bacon&topping[2]=onion"
+Crest::ParamsDecoder.decode(query)
+# => {"size" => "small", "topping" => ["bacon", "onion"]}
+

+ +Development

+

Install dependencies:

+
shards
+

To run test:

+
crystal spec
+

+ +Workbook

+
crystal play
+open http://localhost:8080
+

Then select the Workbook -> Requests from the menu.

+

+ +Contributing

+
    +
  1. Fork it (https://github.com/mamantoha/crest/fork)
  2. +
  3. Create your feature branch (git checkout -b my-new-feature)
  4. +
  5. Commit your changes (git commit -am 'Add some feature')
  6. +
  7. Push to the branch (git push origin my-new-feature)
  8. +
  9. Create a new Pull Request
  10. +
+

+ +Contributors

+ + + + + + + + + + + + +
Anton Maminov
Anton Maminov

💻
Chao Yang
Chao Yang

💻
psikoz
psikoz

🎨
jphaward
jphaward

💻
+ + + + + + + + +

+ +License

+

Copyright: 2017-2024 Anton Maminov (anton.maminov@gmail.com)

+

This library is distributed under the MIT license. Please see the LICENSE file.

+
+ + diff --git a/index.json b/index.json new file mode 100644 index 00000000..8d905bc1 --- /dev/null +++ b/index.json @@ -0,0 +1 @@ +{"repository_name":"crest","body":"# \n

\"crest\"

\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/16e439ef2706472988306ef13da91a51)](https://app.codacy.com/app/mamantoha/crest?utm_source=github.com&utm_medium=referral&utm_content=mamantoha/crest&utm_campaign=Badge_Grade_Dashboard)\n![Crystal CI](https://github.com/mamantoha/crest/workflows/Crystal%20CI/badge.svg)\n[![GitHub release](https://img.shields.io/github/release/mamantoha/crest.svg)](https://github.com/mamantoha/crest/releases)\n[![Commits Since Last Release](https://img.shields.io/github/commits-since/mamantoha/crest/latest.svg)](https://github.com/mamantoha/crest/pulse)\n[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://mamantoha.github.io/crest/)\n[![License](https://img.shields.io/github/license/mamantoha/crest.svg)](https://github.com/mamantoha/crest/blob/master/LICENSE)\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)\n\n\n\n[![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fmamantoha%2Fcrest&countColor=%23263759&style=plastic)](https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Fmamantoha%2Fcrest)\n\nHTTP and REST client for Crystal, inspired by the Ruby's RestClient gem.\n\nBeloved features:\n\n- Redirects support.\n- HTTP(S) proxy support.\n- Elegant Key/Value headers, cookies, query params, and form data.\n- Multipart file uploads.\n- JSON request with the appropriate HTTP headers.\n- Streaming requests.\n- International Domain Names.\n- Digest access authentication.\n- Logging.\n\nHopefully, someday I can remove this shard though. Ideally, Crystal's standard library would do all this already.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n crest:\n github: mamantoha/crest\n```\n\n## Usage\n\n```crystal\nrequire \"crest\"\n```\n\nBasic usage:\n\n```crystal\nCrest.get(\n \"http://httpbin.org/get\",\n params: {:lang => \"en\"},\n user_agent: \"Mozilla/5.0\"\n)\n# curl -L http://httpbin.org/get?lang=en -H 'User-Agent: Mozilla/5.0'\n\nCrest.post(\n \"http://httpbin.org/post\",\n {:age => 27, :name => {:first => \"Kurt\", :last => \"Cobain\"}}\n)\n# curl -L --data \"age=27&name[first]=Kurt&name[last]=Cobain\" -X POST \"http://httpbin.org/post\"\n\nCrest.post(\n \"http://httpbin.org/post\",\n {\"file\" => File.open(\"avatar.png\"), \"name\" => \"John\"}\n)\n# curl -X POST http://httpbin.org/post -F 'file=@/path/to/avatar.png' -F 'name=John' -H 'Content-Type: multipart/form-data'\n\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {:age => 27, :name => {:first => \"Kurt\", :last => \"Cobain\"}},\n json: true\n)\n# curl -X POST http://httpbin.org/post -d '{\"age\":27,\"name\":{\"first\":\"Kurt\",\"last\":\"Cobain\"}}' -H 'Content-Type: application/json'\n```\n\n### Request\n\n`Crest::Request` accept next parameters:\n\nMandatory parameters:\n\n- `:method` - HTTP method (`:get`. `:post`, `:put`, `:patch`, `:delete`, `:options`, `head`)\n- `:url` - URL (e.g.: `http://httpbin.org/ip`)\n\nOptional parameters:\n\n- `:form` - a hash containing form data (or a raw string or IO or Bytes)\n- `:headers` - a hash containing the request headers\n- `:cookies` - a hash containing the request cookies\n- `:params` - a hash that represent query params (or a raw string) - a string separated from the preceding part by a question mark (`?`) and a sequence of attribute–value pairs separated by a delimiter (`&`)\n- `:params_encoder` params encoder (default to `Crest::FlatParamsEncoder`)\n- `:auth` - access authentication method `basic` or `digest` (default to `basic`)\n- `:user` and `:password` - for authentication\n- `:tls` - client certificates, you can pass in a custom `OpenSSL::SSL::Context::Client` (default to `nil`)\n- `:p_addr`, `:p_port`, `:p_user`, and `:p_pass` - specify a per-request proxy by passing these parameters\n- `:json` - make a JSON request with the appropriate HTTP headers (default to `false`)\n- `:multipart` make a multipart request with the appropriate HTTP headers even if not sending a file (default to `false`)\n- `:user_agent` - set \"User-Agent\" HTTP header (default to `Crest::USER_AGENT`)\n- `:max_redirects` - maximum number of redirects (default to 10)\n- `:logging` - enable logging (default to `false`)\n- `:logger` - set logger (default to `Crest::CommonLogger`)\n- `:handle_errors` - error handling (default to `true`)\n- `:close_connection` - close the connection after request is completed (default to `true`)\n- `:http_client` - instance of `HTTP::Client`\n- `:read_timeout` - read timeout (default to `nil`)\n- `:write_timeout` - write timeout (default to `nil`)\n- `:connect_timeout` - connect timeout (default to `nil`)\n\nMore detailed examples:\n\n```crystal\nrequest = Crest::Request.new(:post,\n \"http://httpbin.org/post\",\n headers: {\"Content-Type\" => \"application/json\"},\n form: {:width => 640, \"height\" => \"480\"}\n)\nrequest.execute\n# curl -L --data \"width=640&height=480\" --header \"Content-Type: application/json\" -X POST \"http://httpbin.org/post\"\n```\n\n```crystal\nCrest::Request.execute(:get,\n \"http://httpbin.org/get\",\n params: {:width => 640, \"height\" => \"480\"},\n headers: {\"Content-Type\" => \"application/json\"}\n)\n# curl -L --header \"Content-Type: application/json\" \"http://httpbin.org/get?width=640&height=480\"\n```\n\n```crystal\nCrest::Request.new(:post, \"http://httpbin.org/post\", {:foo => \"bar\"}, json: true)\n\n# curl -X POST http://httpbin.org/post -d '{\\\"foo\\\":\\\"bar\\\"}' -H 'Content-Type: application/json'\"\n```\n\n```crystal\nCrest::Request.get(\n \"http://httpbin.org/get\",\n p_addr: \"127.0.0.1\",\n p_port: 3128,\n p_user: \"admin\",\n p_pass: \"1234\"\n)\n# curl -L --proxy admin:1234@127.0.0.1:3128 \"http://httpbin.org/get\"\n```\n\nA block can be passed to the `Crest::Request` initializer.\n\nThis block will then be called with the `Crest::Request`.\n\n```crystal\nrequest = Crest::Request.new(:get, \"http://httpbin.org/headers\") do |request|\n request.headers.add(\"foo\", \"bar\")\nend\n\nrequest.execute\n# curl -L --header \"foo: bar\" http://httpbin.org/headers\n```\n\n### Resource\n\nA `Crest::Resource` class can be instantiated for access to a RESTful resource,\nincluding authentication, proxy and logging.\n\nAdditionally, you can set default `params`, `headers`, and `cookies` separately.\nSo you can use `Crest::Resource` to share common `params`, `headers`, and `cookies`.\n\nThe final parameters consist of:\n\n- default parameters from initializer\n- parameters provided in call method (`get`, `post`, etc)\n\nThis is especially useful if you wish to define your site in one place and\ncall it in multiple locations.\n\n```crystal\nresource = Crest::Resource.new(\n \"http://httpbin.org\",\n params: {\"key\" => \"value\"},\n headers: {\"Content-Type\" => \"application/json\"},\n cookies: {\"lang\" => \"uk\"}\n)\n\nresource[\"/get\"].get(\n headers: {\"Auth-Token\" => \"secret\"}\n)\n\nresource[\"/post\"].post(\n {:height => 100, \"width\" => \"100\"},\n params: {:secret => \"secret\"}\n)\n```\n\nUse the `[]` syntax to allocate subresources:\n\n```crystal\nsite = Crest::Resource.new(\"http://httpbin.org\")\n\nsite[\"/post\"].post({:param1 => \"value1\", :param2 => \"value2\"})\n# curl -L --data \"param1=value1¶m2=value2\" -X POST http://httpbin.org/post\n```\n\nYou can pass `suburl` through `Request#http_verb` methods:\n\n```crystal\nsite = Crest::Resource.new(\"http://httpbin.org\")\n\nsite.post(\"/post\", {:param1 => \"value1\", :param2 => \"value2\"})\n# curl -L --data \"param1=value1¶m2=value2\" -X POST http://httpbin.org/post\n\nsite.get(\"/get\", params: {:status => \"active\"})\n# curl -L http://httpbin.org/get?status=active\n```\n\nA block can be passed to the `Crest::Resource` instance.\n\nThis block will then be called with the `Crest::Resource`.\n\n```crystal\nresource = Crest::Resource.new(\"http://httpbin.org\") do |resource|\n resource.headers.merge!({\"foo\" => \"bar\"})\nend\n\nresource[\"/headers\"].get\n```\n\nWith HTTP basic authentication:\n\n```crystal\nresource = Crest::Resource.new(\n \"http://httpbin.org/basic-auth/user/passwd\",\n user: \"user\",\n password: \"passwd\"\n)\n```\n\nWith Proxy:\n\n```crystal\nresource = Crest::Resource.new(\n \"http://httpbin.org/get\",\n p_addr: \"localhost\",\n p_port: 3128\n)\n```\n\n### Result handling\n\nThe result of a `Crest::Request` and `Crest::Resource` is a `Crest::Response` object.\n\nResponse objects have several useful methods:\n\n- `Response#body`: The response body as a `String`\n- `Response#body_io`: The response body as a `IO`\n- `Response#status`: The response status as a `HTTP::Status`\n- `Response#status_code`: The HTTP response code\n- `Response#headers`: A hash of HTTP response headers\n- `Response#cookies`: A hash of HTTP cookies set by the server\n- `Response#request`: The `Crest::Request` object used to make the request\n- `Response#http_client_res`: The `HTTP::Client::Response` object\n- `Response#history`: A list of each response received in a redirection chain\n\n### Exceptions\n\n- for status codes between `200` and `207`, a `Crest::Response` will be returned\n- for status codes `301`, `302`, `303` or `307`, the redirection will be followed and the request transformed into a `GET`\n- for other cases, a `Crest::RequestFailed` holding the `Crest::Response` will be raised\n- call `.response` on the exception to get the server's response\n\n```crystal\nCrest.get(\"http://httpbin.org/status/404\")\n# => HTTP status code 404: Not Found (Crest::NotFound)\n\nbegin\n Crest.get(\"http://httpbin.org/status/404\")\nrescue ex : Crest::NotFound\n puts ex.response\nend\n```\n\nTo not raise exceptions but return the `Crest::Response` you can set `handle_errors` to `false`.\n\n```crystal\nresponse = Crest.get(\"http://httpbin.org/status/404\", handle_errors: false) do |resp|\n case resp\n when .success?\n puts resp.body_io.gets_to_end\n when .client_error?\n puts \"Client error\"\n when .server_error?\n puts \"Server error\"\n end\nend\n# => Client error\n\nresponse.status_code # => 404\n```\n\nBut note that it may be more straightforward to use exceptions to handle different HTTP error response cases:\n\n```crystal\nresponse = begin\n Crest.get(\"http://httpbin.org/status/404\")\nrescue ex : Crest::NotFound\n puts \"Not found\"\n ex.response\nrescue ex : Crest::InternalServerError\n puts \"Internal server error\"\n ex.response\nend\n# => Not found\n\nresponse.status_code # => 404\n```\n\n### Parameters serializer\n\n`Crest::ParamsEncoder` class is used to encode parameters.\n\nThe encoder affect both how `crest` processes query strings and how it serializes POST bodies.\n\nThe default encoder is `Crest::FlatParamsEncoder`.\n\nIt provides `#encode` method, which converts the given params into a URI query string:\n\n```crystal\nCrest::FlatParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a[]=one&a[]=two&a[]=three&b=true&c=C&d=1'\n```\n\n### Custom parameters serializers\n\nYou can build a custom params encoder.\n\nThe value of Crest `params_encoder` can be any subclass of `Crest::ParamsEncoder` that implement `#encode(Hash) #=> String`\n\nAlso Crest include other encoders.\n\n#### `Crest::NestedParamsEncoder`\n\n```crystal\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]},\n params_encoder: Crest::NestedParamsEncoder\n)\n\n# => curl -X POST http://httpbin.org/post -d 'size=small&topping=bacon&topping=onion' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n#### `Crest::EnumeratedFlatParamsEncoder`\n\n```crystal\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]},\n params_encoder: Crest::EnumeratedFlatParamsEncoder\n)\n\n# => curl -X POST http://httpbin.org/post -d 'size=small&topping[1]=bacon&topping[2]=onion' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n#### `Crest::ZeroEnumeratedFlatParamsEncoder`\n\n```crystal\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]},\n params_encoder: Crest::ZeroEnumeratedFlatParamsEncoder\n)\n\n# => curl -X POST http://httpbin.org/post -d 'size=small&topping[0]=bacon&topping[1]=onion' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n### Streaming responses\n\nNormally, when you use `Crest`, `Crest::Request` or `Crest::Resource` methods to retrieve data, the entire response is buffered in memory and returned as the response to the call.\n\nHowever, if you are retrieving a large amount of data, for example, an iso, or any other large file, you may want to stream the response directly to disk rather than loading it into memory. If you have a very large file, it may become impossible to load it into memory.\n\nIf you want to stream the data from the response to a file as it comes, rather than entirely in memory, you can pass a block to which you pass a additional logic, which you can use to stream directly to a file as each chunk is received.\n\nWith a block, an `Crest::Response` body is returned and the response's body is available as an `IO` by invoking `Crest::Response#body_io`.\n\nThe following is an example:\n\n```crystal\nCrest.get(\"https://github.com/crystal-lang/crystal/archive/1.0.0.zip\") do |resp|\n filename = resp.filename || \"crystal.zip\"\n\n File.open(filename, \"w\") do |file|\n IO.copy(resp.body_io, file)\n end\nend\n```\n\n### Advanced Usage\n\nThis section covers some of `crest` more advanced features.\n\n#### Multipart\n\nYeah, that's right! This does multipart sends for you!\n\n```crystal\nfile = File.open(\"#{__DIR__}/example.png\")\nCrest.post(\"http://httpbin.org/post\", {:image => file})\n```\n\n```crystal\nfile_content = \"id,name\\n1,test\"\nfile = IO::Memory.new(file_content)\nCrest.post(\"http://httpbin.org/post\", {\"data.csv\" => file})\n```\n\n```crystal\nfile = File.open(\"#{__DIR__}/example.png\")\nresource = Crest::Resource.new(\"https://httpbin.org\")\nresponse = resource[\"/post\"].post({:image => file})\n```\n\n#### JSON payload\n\n`crest` speaks JSON natively by passing `json: true` argument to `crest`.\n\n```crystal\nCrest.post(\"http://httpbin.org/post\", {:foo => \"bar\"}, json: true)\n```\n\nAs well you can serialize your _form_ to a string by itself before passing it to `crest`.\n\n```crystal\nCrest.post(\n \"http://httpbin.org/post\",\n {:foo => \"bar\"}.to_json\n headers: {\"Accept\" => \"application/json\", \"Content-Type\" => \"application/json\"},\n)\n```\n\n#### Headers\n\nRequest headers can be set by passing a hash containing keys and values representing header names and values:\n\n```crystal\nresponse = Crest.get(\n \"http://httpbin.org/bearer\",\n headers: {\"Authorization\" => \"Bearer cT0febFoD5lxAlNAXHo6g\"}\n)\nresponse.headers\n# => {\"Authorization\" => [\"Bearer cT0febFoD5lxAlNAXHo6g\"]}\n```\n\n#### Cookies\n\n`Request` and `Response` objects know about HTTP cookies, and will automatically extract and set headers for them as needed:\n\n```crystal\nresponse = Crest.get(\n \"http://httpbin.org/cookies/set\",\n params: {\"k1\" => \"v1\", \"k2\" => \"v2\"}\n)\nresponse.cookies\n# => {\"k1\" => \"v1\", \"k2\" => \"v2\"}\n```\n\n```crystal\nresponse = Crest.get(\n \"http://httpbin.org/cookies\",\n cookies: {\"k1\" => \"v1\", \"k2\" => {\"kk2\" => \"vv2\"}}\n)\nresponse.cookies\n# => {\"k1\" => \"v1\", \"k2[kk2]\" => \"vv2\"}\n```\n\n#### Basic access authentication\n\nFor basic access authentication for an HTTP user agent you should to provide a `user` name and `password` when making a request.\n\n```crystal\nCrest.get(\n \"http://httpbin.org/basic-auth/user/passwd\",\n user: \"user\",\n password: \"passwd\"\n)\n# curl -L --user user:passwd http://httpbin.org/basic-auth/user/passwd\n```\n\n#### Digest access authentication\n\nFor digest access authentication for an HTTP user agent you should to provide a `user` name and `password` when making a request.\n\n```crystal\nCrest.get(\n \"https://httpbin.org/digest-auth/auth/user/passwd/MD5\",\n auth: \"digest\",\n user: \"user\",\n password: \"passwd\"\n)\n# curl -L --digest --user user:passwd https://httpbin.org/digest-auth/auth/user/passwd/MD5\n```\n\n#### SSL/TLS support\n\nIf `tls` is given it will be used:\n\n```crystal\nCrest.get(\"https://expired.badssl.com\", tls: OpenSSL::SSL::Context::Client.insecure)\n```\n\n#### Proxy\n\nIf you need to use a proxy, you can configure individual requests with the proxy host and port arguments to any request method:\n\n```crystal\nCrest.get(\n \"http://httpbin.org/ip\",\n p_addr: \"localhost\",\n p_port: 3128\n)\n```\n\nTo use authentication with your proxy, use next syntax:\n\n```crystal\nCrest.get(\n \"http://httpbin.org/ip\",\n p_addr: \"localhost\",\n p_port: 3128,\n p_user: \"user\",\n p_pass: \"qwerty\"\n)\n```\n\n#### Logging\n\n> `Logger` class is completely taken from [halite](https://github.com/icyleaf/halite) shard.\n> Thanks [icyleaf](https://github.com/icyleaf)!\n\nBy default, the `Crest` does not enable logging. You can enable it per request by setting `logging: true`:\n\n```crystal\nCrest.get(\"http://httpbin.org/get\", logging: true)\n```\n\n##### Filter sensitive information from logs with a regex matcher\n\n```crystal\nresource = Crest::Request.get(\"http://httpbin.org/get\", params: {api_key => \"secret\"}, logging: true) do |request|\n request.logger.filter(/(api_key=)(\\w+)/, \"\\\\1[REMOVED]\")\nend\n\n# => crest | 2018-07-04 14:49:49 | GET | http://httpbin.org/get?api_key=[REMOVED]\n```\n\n##### Customize logger\n\nYou can create the custom logger by integration `Crest::Logger` abstract class.\nHere has two methods must be implement: `Crest::Logger.request` and `Crest::Logger.response`.\n\n```crystal\nclass MyLogger < Crest::Logger\n def request(request)\n @logger.info { \">> | %s | %s\" % [request.method, request.url] }\n end\n\n def response(response)\n @logger.info { \"<< | %s | %s\" % [response.status_code, response.url] }\n end\nend\n\nCrest.get(\"http://httpbin.org/get\", logging: true, logger: MyLogger.new)\n```\n\n#### Redirection\n\nBy default, `crest` will follow HTTP 30x redirection requests.\n\nTo disable automatic redirection, set `:max_redirects => 0`.\n\n```crystal\nCrest::Request.execute(method: :get, url: \"http://httpbin.org/redirect/1\", max_redirects: 0)\n# => Crest::Found: 302 Found\n```\n\n#### Access HTTP::Client\n\nYou can access `HTTP::Client` via the `http_client` instance method.\n\nThis is usually used to set additional options (e.g. read timeout, authorization header etc.)\n\n```crystal\nclient = HTTP::Client.new(\"httpbin.org\")\nclient.read_timeout = 1.second\n\nbegin\n Crest::Request.new(:get,\n \"http://httpbin.org/delay/10\",\n http_client: client\n )\nrescue IO::TimeoutError\n puts \"Timeout!\"\nend\n```\n\n```crystal\nclient = HTTP::Client.new(\"httpbin.org\")\nclient.read_timeout = 1.second\n\nbegin\n resource = Crest::Resource.new(\"http://httpbin.org\", http_client: client)\n resource.get(\"/delay/10\")\nrescue IO::TimeoutError\n puts \"Timeout!\"\nend\n```\n\n#### Convert Request object to cURL command\n\nUse `to_curl` method on instance of `Crest::Request` to convert request to cURL command.\n\n```crystal\nrequest = Crest::Request.new(\n :post,\n \"http://httpbin.org/post\",\n {\"title\" => \"New Title\", \"author\" => \"admin\"}\n)\nrequest.to_curl\n# => curl -X POST http://httpbin.org/post -d 'title=New+Title&author=admin' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n```crystal\nrequest = Crest::Request.new(\n :get,\n \"http://httpbin.org/basic-auth/user/passwd\",\n user: \"user\",\n password: \"passwd\"\n)\nrequest.to_curl\n# => curl -X GET http://httpbin.org/basic-auth/user/passwd --user user:passwd\n```\n\nAlso you can directly use `Crest::Curlify` which accept instance of `Crest::Request`\n\n```crystal\nrequest = Crest::Request.new(:get, \"http://httpbin.org\")\nCrest::Curlify.new(request).to_curl\n# => curl -X GET http://httpbin.org\n```\n\n#### Params decoder\n\n`Crest::ParamsDecoder` is a module for decoding query-string into parameters.\n\n```crystal\nquery = \"size=small&topping[1]=bacon&topping[2]=onion\"\nCrest::ParamsDecoder.decode(query)\n# => {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]}\n```\n\n## Development\n\nInstall dependencies:\n\n```console\nshards\n```\n\nTo run test:\n\n```console\ncrystal spec\n```\n\n### Workbook\n\n```console\ncrystal play\nopen http://localhost:8080\n```\n\nThen select the Workbook -> Requests from the menu.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n\n\n\n\n \n \n \n \n \n \n \n \n
\"Anton
Anton Maminov

💻
\"Chao
Chao Yang

💻
\"psikoz\"/
psikoz

🎨
\"jphaward\"/
jphaward

💻
\n\n\n\n\n\n\n\n\n\n\n\n\n\n## License\n\nCopyright: 2017-2024 Anton Maminov (anton.maminov@gmail.com)\n\nThis library is distributed under the MIT license. Please see the LICENSE file.\n","program":{"html_id":"crest/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"crest","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"crest/Crest","path":"Crest.html","kind":"module","full_name":"Crest","name":"Crest","abstract":false,"locations":[{"filename":"src/crest.cr","line_number":38,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L38"},{"filename":"src/crest/curlify.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L1"},{"filename":"src/crest/exceptions.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L3"},{"filename":"src/crest/form.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L1"},{"filename":"src/crest/forms/data_form.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L3"},{"filename":"src/crest/forms/json_form.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/json_form.cr#L3"},{"filename":"src/crest/forms/urlencoded_form.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L3"},{"filename":"src/crest/logger.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L3"},{"filename":"src/crest/loggers/common_logger.cr","line_number":8,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L8"},{"filename":"src/crest/params_decoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L1"},{"filename":"src/crest/params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr#L1"},{"filename":"src/crest/redirector.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L1"},{"filename":"src/crest/request.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L3"},{"filename":"src/crest/resource.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L3"},{"filename":"src/crest/response.cr","line_number":5,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L5"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"EXCEPTIONS_MAP","name":"EXCEPTIONS_MAP","value":"{} of Int32 => Crest::RequestFailed.class"},{"id":"HTTP_METHODS","name":"HTTP_METHODS","value":"[\"get\", \"delete\", \"post\", \"put\", \"patch\", \"options\", \"head\"] of ::String"},{"id":"STATUSES","name":"STATUSES","value":"{100 => \"Continue\", 101 => \"Switching Protocols\", 102 => \"Processing\", 200 => \"OK\", 201 => \"Created\", 202 => \"Accepted\", 203 => \"Non-Authoritative Information\", 204 => \"No Content\", 205 => \"Reset Content\", 206 => \"Partial Content\", 207 => \"Multi-Status\", 208 => \"Already Reported\", 226 => \"IM Used\", 300 => \"Multiple Choices\", 301 => \"Moved Permanently\", 302 => \"Found\", 303 => \"See Other\", 304 => \"Not Modified\", 305 => \"Use Proxy\", 306 => \"Switch Proxy\", 307 => \"Temporary Redirect\", 308 => \"Permanent Redirect\", 400 => \"Bad Request\", 401 => \"Unauthorized\", 402 => \"Payment Required\", 403 => \"Forbidden\", 404 => \"Not Found\", 405 => \"Method Not Allowed\", 406 => \"Not Acceptable\", 407 => \"Proxy Authentication Required\", 408 => \"Request Timeout\", 409 => \"Conflict\", 410 => \"Gone\", 411 => \"Length Required\", 412 => \"Precondition Failed\", 413 => \"Payload Too Large\", 414 => \"URI Too Long\", 415 => \"Unsupported Media Type\", 416 => \"Range Not Satisfiable\", 417 => \"Expectation Failed\", 418 => \"I\\\"m A Teapot\", 421 => \"Too Many Connections From This IP\", 422 => \"Unprocessable Entity\", 423 => \"Locked\", 424 => \"Failed Dependency\", 425 => \"Unordered Collection\", 426 => \"Upgrade Required\", 428 => \"Precondition Required\", 429 => \"Too Many Requests\", 431 => \"Request Header Fields Too Large\", 449 => \"Retry With\", 450 => \"Blocked By Windows Parental Controls\", 500 => \"Internal Server Error\", 501 => \"Not Implemented\", 502 => \"Bad Gateway\", 503 => \"Service Unavailable\", 504 => \"Gateway Timeout\", 505 => \"HTTP Version Not Supported\", 506 => \"Variant Also Negotiates\", 507 => \"Insufficient Storage\", 508 => \"Loop Detected\", 509 => \"Bandwidth Limit Exceeded\", 510 => \"Not Extended\", 511 => \"Network Authentication Required\"}","doc":"Hash of HTTP status code => message.","summary":"

Hash of HTTP status code => message.

"},{"id":"USER_AGENT","name":"USER_AGENT","value":"\"Crest/#{Crest::VERSION} (Crystal/#{Crystal::VERSION})\""},{"id":"VERSION","name":"VERSION","value":"{{ (`shards version /home/runner/work/crest/crest/src`).chomp.stringify }}"}],"doc":"This module's static methods are the entry point for using the Crest client.\n\nSupported HTTP methods: `get`, `put`, `post`, `patch` `delete`, `options`, `head`\n\nExamples:\n\n```\nCrest.get(\n \"http://httpbin.org/get\",\n headers: {\"Content-Type\" => \"image/jpg\"},\n params: {\"lang\" => \"en\"}\n)\n\nCrest.post(\n \"http://httpbin.org/post\",\n headers: {\"Access-Token\" => [\"secret1\", \"secret2\"]},\n form: {\"fizz\" => \"buz\"},\n logging: true,\n)\n\nCrest.get(\"http://httpbin.org/stream/5\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

This module's static methods are the entry point for using the Crest client.

","class_methods":[{"html_id":"delete(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.\n\n```\nCrest.delete(\"http://httpbin.org/delete\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"delete(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.\n\n```\nCrest.delete(\"http://httpbin.org/delete\")\n```","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nrequest.execute\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.\n\n```\nCrest.get(\"http://httpbin.org/get\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.\n\n```\nCrest.get(\"http://httpbin.org/get\")\n```","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nrequest.execute\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.\n\n```\nCrest.head(\"http://httpbin.org/head\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.\n\n```\nCrest.head(\"http://httpbin.org/head\")\n```","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nrequest.execute\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.\n\n```\nCrest.options(\"http://httpbin.org/options\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.\n\n```\nCrest.options(\"http://httpbin.org/options\")\n```","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nrequest.execute\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.\n\n```\nCrest.patch(\"http://httpbin.org/patch\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.\n\n```\nCrest.patch(\"http://httpbin.org/patch\")\n```","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nrequest.execute\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.\n\n```\nCrest.post(\"http://httpbin.org/post\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.\n\n```\nCrest.post(\"http://httpbin.org/post\")\n```","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nrequest.execute\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.\n\n```\nCrest.put(\"http://httpbin.org/put\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.\n\n```\nCrest.put(\"http://httpbin.org/put\")\n```","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nrequest.execute\n"}}],"types":[{"html_id":"crest/Crest/CommonLogger","path":"Crest/CommonLogger.html","kind":"class","full_name":"Crest::CommonLogger","name":"CommonLogger","abstract":false,"superclass":{"html_id":"crest/Crest/Logger","kind":"class","full_name":"Crest::Logger","name":"Logger"},"ancestors":[{"html_id":"crest/Crest/Logger","kind":"class","full_name":"Crest::Logger","name":"Logger"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/loggers/common_logger.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L9"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"instance_methods":[{"html_id":"request(request:Crest::Request):Nil-instance-method","name":"request","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request) : Nil","args_html":"(request : Crest::Request) : Nil","location":{"filename":"src/crest/loggers/common_logger.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L10"},"def":{"name":"request","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"return_type":"Nil","visibility":"Public","body":"message = String.build do |io|\n (io << \"| \") << (colorful_method(request.method))\n (io << \" | \") << request.url\n if request.form_data.nil?\n else\n (io << \" | \") << request.form_data.to_s.inspect\n end\nend.to_s\ninfo(message)\nmessage\n"}},{"html_id":"response(response:Crest::Response):Nil-instance-method","name":"response","abstract":false,"args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"args_string":"(response : Crest::Response) : Nil","args_html":"(response : Crest::Response) : Nil","location":{"filename":"src/crest/loggers/common_logger.cr","line_number":22,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L22"},"def":{"name":"response","args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"return_type":"Nil","visibility":"Public","body":"message = String.build do |io|\n (io << \"| \") << (colorful_status_code(response.status_code))\n (io << \" | \") << response.url\n (io << \" | \") << response.body.inspect\nend.to_s\ninfo(message)\nmessage\n"}}]},{"html_id":"crest/Crest/Curlify","path":"Crest/Curlify.html","kind":"class","full_name":"Crest::Curlify","name":"Curlify","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/curlify.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L9"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Class to convert `Crest::Request` object to cURL command\n\n```\nrequest = Crest::Request.new(:post, \"http://httpbin.org/post\", form: {\"title\" => \"New Title\"})\nCrest::Curlify.to_curl(request)\n=> \"curl -X POST http://httpbin.org/post -d 'title=New+Title' -H 'Content-Type: application/x-www-form-urlencoded'\"\n```","summary":"

Class to convert Crest::Request object to cURL command

","class_methods":[{"html_id":"to_curl(request:Crest::Request)-class-method","name":"to_curl","doc":"Returns string with cURL command by provided `Crest::Request` object","summary":"

Returns string with cURL command by provided Crest::Request object

","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request)","args_html":"(request : Crest::Request)","location":{"filename":"src/crest/curlify.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L11"},"def":{"name":"to_curl","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"(new(request)).to_curl"}}],"constructors":[{"html_id":"new(request:Crest::Request)-class-method","name":"new","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request)","args_html":"(request : Crest::Request)","location":{"filename":"src/crest/curlify.cr","line_number":15,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L15"},"def":{"name":"new","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"_ = allocate\n_.initialize(request)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_curl-instance-method","name":"to_curl","abstract":false,"location":{"filename":"src/crest/curlify.cr","line_number":18,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L18"},"def":{"name":"to_curl","visibility":"Public","body":"[\"curl\", method, url, proxy, basic_auth, form_data, headers].reject(&.empty?).join(\" \")"}}]},{"html_id":"crest/Crest/DataForm","path":"Crest/DataForm.html","kind":"class","full_name":"Crest::DataForm(T)","name":"DataForm","abstract":false,"superclass":{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},"ancestors":[{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/forms/data_form.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L9"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_MIME_TYPE","name":"DEFAULT_MIME_TYPE","value":"\"application/octet-stream\""}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This class lets `crest` emulate a filled-in form\nin which a user has pressed the submit button.\nThis causes `crest` to POST data using the\n\"Content-Type\" `multipart/form-data according` to RFC 2388.\nThis enables uploading of binary files etc.","summary":"

This class lets crest emulate a filled-in form in which a user has pressed the submit button.

","instance_methods":[{"html_id":"generate-instance-method","name":"generate","abstract":false,"location":{"filename":"src/crest/forms/data_form.cr","line_number":12,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L12"},"def":{"name":"generate","visibility":"Public","body":"content_type_ch = Channel(String).new(1)\nio = IO::Memory.new\nHTTP::FormData.build(io) do |formdata|\n content_type_ch.send(formdata.content_type)\n parsed_params.each do |name, value|\n add_field(formdata, name.to_s, value)\n end\nend\n@form_data = io.to_s\n@content_type = content_type_ch.receive\nself\n"}},{"html_id":"parsed_params-instance-method","name":"parsed_params","abstract":false,"location":{"filename":"src/crest/forms/data_form.cr","line_number":32,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L32"},"def":{"name":"parsed_params","visibility":"Public","body":"@params_encoder.flatten_params(@params)"}}]},{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","path":"Crest/EnumeratedFlatParamsEncoder.html","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/ZeroEnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::ZeroEnumeratedFlatParamsEncoder","name":"ZeroEnumeratedFlatParamsEncoder"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"array_start_index-class-method","name":"array_start_index","abstract":false,"location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L3"},"def":{"name":"array_start_index","visibility":"Public","body":"@@array_start_index"}},{"html_id":"flatten_params(object:Hash,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"```\nCrest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => \"123\"}})\n# => [{\"key1[key2]\", \"123\"}]\n```","summary":"

Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => "123"}}) # => [{"key1[key2]", "123"}]

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L21"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_89|\n k, v = __temp_89\n processed_key = parent_key ? \"#{parent_key}[#{k}]\" : k.to_s\n case v\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(v, processed_key))\n else\n memo << {processed_key, v}\n end\nend"}},{"html_id":"flatten_params(object:Array,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"```\nCrest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => [\"1\", \"2\", \"3\"]}})\n# => [{\"key1[arr][1]\", \"1\"}, {\"key1[arr][2]\", \"2\"}, {\"key1[arr][3]\", \"3\"}]\n```","summary":"

Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}}) # => [{"key1[arr][1]", "1"}, {"key1[arr][2]", "2"}, {"key1[arr][3]", "3"}]

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":38,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L38"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"(object.each_with_index(array_start_index)).reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_90|\n item, index = __temp_90\n processed_key = parent_key ? \"#{parent_key}[#{index}]\" : \"\"\n case item\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(item, processed_key))\n else\n memo << {processed_key, item}\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","doc":"```\nCrest::EnumeratedFlatParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'\n```","summary":"

Crest::EnumeratedFlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1}) # => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'

","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L9"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"HTTP::Params.build do |form|\n (self.class.flatten_params(params)).each do |name, value|\n form.add(name.to_s, value.to_s)\n end\nend"}}]},{"html_id":"crest/Crest/FlatParamsEncoder","path":"Crest/FlatParamsEncoder.html","kind":"class","full_name":"Crest::FlatParamsEncoder","name":"FlatParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"flatten_params(object:Hash,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n`parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::FlatParamsEncoder.flatten_params({:key1 => {:key2 => \"123\"}})\n# => [{\"key1[key2]\", \"123\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":26,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L26"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_91|\n k, v = __temp_91\n processed_key = parent_key ? \"#{parent_key}[#{k}]\" : k.to_s\n case v\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(v, processed_key))\n else\n memo << {processed_key, v}\n end\nend"}},{"html_id":"flatten_params(object:Array,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n# `parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::FlatParamsEncoder.flatten_params({:key1 => {:arr => [\"1\", \"2\", \"3\"]}})\n# => [{\"key1[arr][]\", \"1\"}, {\"key1[arr][]\", \"2\"}, {\"key1[arr][]\", \"3\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L47"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, item|\n processed_key = parent_key ? \"#{parent_key}[]\" : \"\"\n case item\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(item, processed_key))\n else\n memo << {processed_key, item}\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","doc":"Converts the given params into a URI query string. Keys and values\nwill converted to strings and appropriately escaped for the URI.\n\n```\nCrest::FlatParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a[]=one&a[]=two&a[]=three&b=true&c=C&d=1'\n```","summary":"

Converts the given params into a URI query string.

","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L10"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"HTTP::Params.build do |form|\n (self.class.flatten_params(params)).each do |name, value|\n form.add(name.to_s, value.to_s)\n end\nend"}}]},{"html_id":"crest/Crest/Form","path":"Crest/Form.html","kind":"class","full_name":"Crest::Form(T)","name":"Form","abstract":true,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/form.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/DataForm","kind":"class","full_name":"Crest::DataForm(T)","name":"DataForm"},{"html_id":"crest/Crest/JSONForm","kind":"class","full_name":"Crest::JSONForm(T)","name":"JSONForm"},{"html_id":"crest/Crest/UrlencodedForm","kind":"class","full_name":"Crest::UrlencodedForm(T)","name":"UrlencodedForm"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"generate(params:Hash,params_encoder:Crest::ParamsEncoder.class)-class-method","name":"generate","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"},{"name":"params_encoder","external_name":"params_encoder","restriction":"Crest::ParamsEncoder.class"}],"args_string":"(params : Hash, params_encoder : Crest::ParamsEncoder.class)","args_html":"(params : Hash, params_encoder : Crest::ParamsEncoder.class)","location":{"filename":"src/crest/form.cr","line_number":8,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L8"},"def":{"name":"generate","args":[{"name":"params","external_name":"params","restriction":"Hash"},{"name":"params_encoder","external_name":"params_encoder","restriction":"Crest::ParamsEncoder.class"}],"visibility":"Public","body":"(new(params, params_encoder)).generate"}}],"instance_methods":[{"html_id":"content_type-instance-method","name":"content_type","abstract":false,"location":{"filename":"src/crest/form.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L6"},"def":{"name":"content_type","visibility":"Public","body":"@content_type"}},{"html_id":"form_data-instance-method","name":"form_data","abstract":false,"location":{"filename":"src/crest/form.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L6"},"def":{"name":"form_data","visibility":"Public","body":"@form_data"}},{"html_id":"generate-instance-method","name":"generate","abstract":true,"location":{"filename":"src/crest/form.cr","line_number":15,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L15"},"def":{"name":"generate","visibility":"Public","body":""}},{"html_id":"params-instance-method","name":"params","abstract":false,"location":{"filename":"src/crest/form.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L6"},"def":{"name":"params","visibility":"Public","body":"@params"}}]},{"html_id":"crest/Crest/JSONForm","path":"Crest/JSONForm.html","kind":"class","full_name":"Crest::JSONForm(T)","name":"JSONForm","abstract":false,"superclass":{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},"ancestors":[{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/forms/json_form.cr","line_number":7,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/json_form.cr#L7"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This class lets `crest` convert request hash to JSON\nThis causes `crest` to POST data using the\n\"Content-Type\" `application/json`.","summary":"

This class lets crest convert request hash to JSON This causes crest to POST data using the "Content-Type" application/json.

","instance_methods":[{"html_id":"generate-instance-method","name":"generate","abstract":false,"location":{"filename":"src/crest/forms/json_form.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/json_form.cr#L10"},"def":{"name":"generate","visibility":"Public","body":"@form_data = @params.to_json\nself\n"}}]},{"html_id":"crest/Crest/Logger","path":"Crest/Logger.html","kind":"class","full_name":"Crest::Logger","name":"Logger","abstract":true,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/logger.cr","line_number":4,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L4"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/CommonLogger","kind":"class","full_name":"Crest::CommonLogger","name":"CommonLogger"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"constructors":[{"html_id":"new(filename:String)-class-method","name":"new","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String)","args_html":"(filename : String)","location":{"filename":"src/crest/logger.cr","line_number":5,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L5"},"def":{"name":"new","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"visibility":"Public","body":"new(File.open(filename, \"w\"))"}},{"html_id":"new(io:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"io","default_value":"STDOUT","external_name":"io","restriction":"IO"}],"args_string":"(io : IO = STDOUT)","args_html":"(io : IO = STDOUT)","location":{"filename":"src/crest/logger.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L11"},"def":{"name":"new","args":[{"name":"io","default_value":"STDOUT","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"default_formatter:Log::Formatter-instance-method","name":"default_formatter","abstract":false,"location":{"filename":"src/crest/logger.cr","line_number":23,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L23"},"def":{"name":"default_formatter","return_type":"::Log::Formatter","visibility":"Public","body":"::Log::Formatter.new do |entry, io|\n io << entry.source\n (io << \" | \") << (entry.timestamp.to_s(\"%F %T\"))\n (io << \" \") << entry.message\nend"}},{"html_id":"filter(pattern:String|Regex,replacement:String)-instance-method","name":"filter","abstract":false,"args":[{"name":"pattern","external_name":"pattern","restriction":"String | Regex"},{"name":"replacement","external_name":"replacement","restriction":"String"}],"args_string":"(pattern : String | Regex, replacement : String)","args_html":"(pattern : String | Regex, replacement : String)","location":{"filename":"src/crest/logger.cr","line_number":35,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L35"},"def":{"name":"filter","args":[{"name":"pattern","external_name":"pattern","restriction":"String | Regex"},{"name":"replacement","external_name":"replacement","restriction":"String"}],"visibility":"Public","body":"@filters.push({pattern, replacement})"}},{"html_id":"info(message:String)-instance-method","name":"info","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"}],"args_string":"(message : String)","args_html":"(message : String)","location":{"filename":"src/crest/logger.cr","line_number":31,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L31"},"def":{"name":"info","args":[{"name":"message","external_name":"message","restriction":"String"}],"visibility":"Public","body":"@logger.info do\n apply_filters(message)\nend"}},{"html_id":"request(request:Crest::Request):Nil-instance-method","name":"request","abstract":true,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request) : Nil","args_html":"(request : Crest::Request) : Nil","location":{"filename":"src/crest/logger.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L20"},"def":{"name":"request","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"return_type":"Nil","visibility":"Public","body":""}},{"html_id":"response(response:Crest::Response):Nil-instance-method","name":"response","abstract":true,"args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"args_string":"(response : Crest::Response) : Nil","args_html":"(response : Crest::Response) : Nil","location":{"filename":"src/crest/logger.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L21"},"def":{"name":"response","args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"return_type":"Nil","visibility":"Public","body":""}}],"macros":[{"html_id":"method_missing(call)-macro","name":"method_missing","abstract":false,"args":[{"name":"call","external_name":"call","restriction":""}],"args_string":"(call)","args_html":"(call)","location":{"filename":"src/crest/logger.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L9"},"def":{"name":"method_missing","args":[{"name":"call","external_name":"call","restriction":""}],"visibility":"Public","body":" @logger.\n{{ call }}\n\n \n"}}]},{"html_id":"crest/Crest/NestedParamsEncoder","path":"Crest/NestedParamsEncoder.html","kind":"class","full_name":"Crest::NestedParamsEncoder","name":"NestedParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"flatten_params(object:Hash,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n`parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::NestedParamsEncoder.flatten_params({:key1 => {:key2 => \"123\"}})\n# => [{\"key1[key2]\", \"123\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":26,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L26"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_92|\n k, v = __temp_92\n processed_key = parent_key ? \"#{parent_key}[#{k}]\" : k.to_s\n case v\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(v, processed_key))\n else\n memo << {processed_key, v}\n end\nend"}},{"html_id":"flatten_params(object:Array,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n`parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::NestedParamsEncoder.flatten_params({:key1 => {:arr => [\"1\", \"2\", \"3\"]}})\n# => [{\"key1[arr]\", \"1\"}, {\"key1[arr]\", \"2\"}, {\"key1[arr]\", \"3\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L47"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, item|\n processed_key = parent_key ? parent_key : \"\"\n case item\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(item, processed_key))\n else\n memo << {processed_key, item}\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","doc":"Converts the given params into a URI query string. Keys and values\nwill converted to strings and appropriately escaped for the URI.\n\n```\nCrest::NestedParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a=one&a=two&a=three&b=true&c=C&d=1'\n```","summary":"

Converts the given params into a URI query string.

","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L10"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"HTTP::Params.build do |form|\n (self.class.flatten_params(params)).each do |name, value|\n form.add(name.to_s, value.to_s)\n end\nend"}}]},{"html_id":"crest/Crest/ParamsDecoder","path":"Crest/ParamsDecoder.html","kind":"module","full_name":"Crest::ParamsDecoder","name":"ParamsDecoder","abstract":false,"locations":[{"filename":"src/crest/params_decoder.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L3"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ARRAY_REGEX","name":"ARRAY_REGEX","value":"/[\\[\\]]+\\Z/"},{"id":"SUBKEYS_REGEX","name":"SUBKEYS_REGEX","value":"/[^\\[\\]]+(?:\\]?\\[\\])?/"}],"extended_modules":[{"html_id":"crest/Crest/ParamsDecoder","kind":"module","full_name":"Crest::ParamsDecoder","name":"ParamsDecoder"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Module for decoding query-string into parameters.","summary":"

Module for decoding query-string into parameters.

","instance_methods":[{"html_id":"decode(query:String):Hash(String,Type)-instance-method","name":"decode","doc":"Converts the given URI query string into a hash.\n\n```\nCrest::ParamsDecoder.decode(\"a[]=one&a[]=two&a[]=three&b=true&c=C&d=1\")\n# => {\"a\" => [\"one\", \"two\", \"three\"], \"b\" => \"true\", \"c\" => \"C\", \"d\" => \"1\"}\n\nCrest::ParamsDecoder.decode(\"a=one&a=two&a=three&b=true&c=C&d=1\")\n# => {\"a\" => [\"one\", \"two\", \"three\"], \"b\" => \"true\", \"c\" => \"C\", \"d\" => \"1\"}\n```","summary":"

Converts the given URI query string into a hash.

","abstract":false,"args":[{"name":"query","external_name":"query","restriction":"String"}],"args_string":"(query : String) : Hash(String, Type)","args_html":"(query : String) : Hash(String, Type)","location":{"filename":"src/crest/params_decoder.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L20"},"def":{"name":"decode","args":[{"name":"query","external_name":"query","restriction":"String"}],"return_type":"Hash(String, Type)","visibility":"Public","body":"params = {} of String => Type\n(query.split('&')).each do |pair|\n if pair.empty?\n next\n end\n key, value = pair.split('=', 2)\n key = URI.decode(key)\n value = URI.decode(value)\n decode_pair(key, value, params)\nend\n(dehash(params)).as(Hash)\n"}},{"html_id":"match_context(context,subkey):Type|Nil-instance-method","name":"match_context","abstract":false,"args":[{"name":"context","external_name":"context","restriction":""},{"name":"subkey","external_name":"subkey","restriction":""}],"args_string":"(context, subkey) : Type | Nil","args_html":"(context, subkey) : Type | Nil","location":{"filename":"src/crest/params_decoder.cr","line_number":72,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L72"},"def":{"name":"match_context","args":[{"name":"context","external_name":"context","restriction":""},{"name":"subkey","external_name":"subkey","restriction":""}],"return_type":"Type | Nil","visibility":"Public","body":"if (!context.last?.is_a?(Hash)) || ((context.last.as(Hash)).has_key?(subkey))\n context << ({} of String => Type)\nend\ncontext.last?\n"}}],"types":[{"html_id":"crest/Crest/ParamsDecoder/Type","path":"Crest/ParamsDecoder/Type.html","kind":"alias","full_name":"Crest::ParamsDecoder::Type","name":"Type","abstract":false,"locations":[{"filename":"src/crest/params_decoder.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L6"}],"repository_name":"crest","program":false,"enum":false,"alias":true,"aliased":"(Array(Crest::ParamsDecoder::Type) | Hash(String, Crest::ParamsDecoder::Type) | String | Nil)","aliased_html":"Array(Crest::ParamsDecoder::Type) | Hash(String, Crest::ParamsDecoder::Type) | String | Nil","const":false,"namespace":{"html_id":"crest/Crest/ParamsDecoder","kind":"module","full_name":"Crest::ParamsDecoder","name":"ParamsDecoder"}}]},{"html_id":"crest/Crest/ParamsEncoder","path":"Crest/ParamsEncoder.html","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder","abstract":true,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoder.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L10"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder"},{"html_id":"crest/Crest/FlatParamsEncoder","kind":"class","full_name":"Crest::FlatParamsEncoder","name":"FlatParamsEncoder"},{"html_id":"crest/Crest/NestedParamsEncoder","kind":"class","full_name":"Crest::NestedParamsEncoder","name":"NestedParamsEncoder"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Custom serializers\n\nYou can build your custom encoder, if you like.\nThe value of `params_encoder` can be any `Crest::ParamsEncoder` object that responds to: `#encode(Hash) #=> String`\n\nThe encoder will affect both how Crest processes query strings and how it serializes POST bodies.\n\nThe default encoder is `Crest::FlatParamsEncoder`.","summary":"

Custom serializers

","class_methods":[{"html_id":"encode(params:Hash):String-class-method","name":"encode","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoder.cr","line_number":13,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L13"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"new.encode(params)"}},{"html_id":"flatten_params(object:JSON::Any,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform JSON::Any `object` into a flat array of `{key, value}`.\n\n# `parent_key` — Should not be passed (used for recursion)\n\n```\nparams = JSON.parse(%({\"access\": [{\"name\": \"mapping\", \"speed\": \"fast\"}, {\"name\": \"any\", \"speed\": \"slow\"}]}))\n\nCrest::FlatParamsEncoder.flatten_params(params)\n# => [{\"access[][name]\", \"mapping\"}, {\"access[][speed]\", \"fast\"}, {\"access[][name]\", \"any\"}, {\"access[][speed]\", \"slow\"}]\n\nCrest::EnumeratedFlatParamsEncoder.flatten_params(params)\n# => [{\"access[1][name]\", \"mapping\"}, {\"access[1][speed]\", \"fast\"}, {\"access[2][name]\", \"any\"}, {\"access[2][speed]\", \"slow\"}]\n```","summary":"

Transform JSON::Any object into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"JSON::Any"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoder.cr","line_number":30,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L30"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"JSON::Any"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"if hash = object.as_h?\n flatten_params(hash, parent_key)\nelse\n if array = object.as_a?\n flatten_params(array, parent_key)\n else\n processed_key = parent_key ? parent_key : \"\"\n value : Crest::ParamsValue = nil\n if value.nil?\n value = object.as_i64?\n end\n if value.nil?\n value = object.as_f?\n end\n if value.nil?\n value = object.as_bool?\n end\n if value.nil?\n value = object.as_s?\n end\n [{processed_key, value.as(Crest::ParamsValue)}]\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","abstract":true,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoder.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L11"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":""}}]},{"html_id":"crest/Crest/ParamsValue","path":"Crest/ParamsValue.html","kind":"alias","full_name":"Crest::ParamsValue","name":"ParamsValue","abstract":false,"locations":[{"filename":"src/crest.cr","line_number":42,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L42"}],"repository_name":"crest","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil)","aliased_html":"Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil","const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"}},{"html_id":"crest/Crest/Redirector","path":"Crest/Redirector.html","kind":"class","full_name":"Crest::Redirector","name":"Redirector","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/redirector.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"constructors":[{"html_id":"new(response:Crest::Response,request:Crest::Request)-class-method","name":"new","abstract":false,"args":[{"name":"response","external_name":"response","restriction":"Crest::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(response : Crest::Response, request : Crest::Request)","args_html":"(response : Crest::Response, request : Crest::Request)","location":{"filename":"src/crest/redirector.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L3"},"def":{"name":"new","args":[{"name":"response","external_name":"response","restriction":"Crest::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"_ = allocate\n_.initialize(response, request)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"follow:Crest::Response-instance-method","name":"follow","abstract":false,"location":{"filename":"src/crest/redirector.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L6"},"def":{"name":"follow","return_type":"Crest::Response","visibility":"Public","body":"case @response\nwhen .success?\n @response\nwhen .redirect?\n check_max_redirects\n @request.max_redirects > 0 ? follow_redirection : @response\nelse\n if @request.handle_errors\n raise_exception!\n end\n @response\nend"}},{"html_id":"follow(&block:Crest::Response->)-instance-method","name":"follow","abstract":false,"location":{"filename":"src/crest/redirector.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L20"},"def":{"name":"follow","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"visibility":"Public","body":"case @response\nwhen .success?\n @response\nwhen .redirect?\n check_max_redirects\n @request.max_redirects > 0 ? follow_redirection(&block) : @response\nelse\n if @request.handle_errors\n raise_exception!\n end\n @response\nend"}}]},{"html_id":"crest/Crest/Request","path":"Crest/Request.html","kind":"class","full_name":"Crest::Request","name":"Request","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/request.cr","line_number":57,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L57"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"A class that used to make the requests\nThe result of a `Crest::Request` is a `Crest::Response` object.\n\nSimple example:\n\n```\nrequest = Crest::Request.new(:post, \"http://httpbin.org/post\", {\"age\" => 27}, params: {:name => \"Kurt\"})\nrequest.execute\n\nCrest::Request.execute(:post, \"http://httpbin.org/post\", {\"age\" => 27}, json: true)\n\nCrest::Request.post(\"http://httpbin.org/post\", {\"age\" => 27}, json: true)\n```\n\nBlock style:\n\n```\nrequest = Crest::Request.new(:get, \"http://httpbin.org/get\") do |request|\n request.headers.add(\"foo\", \"bar\")\n request.user = \"username\"\n request.password = \"password\"\nend\n\nresponse = request.execute\n```\n\nMandatory parameters:\n- `method`\n- `url`\n\nOptional parameters:\n- `headers` a hash containing the request headers\n- `cookies` a hash containing the request cookies\n- `form` a hash containing form data (or a raw string)\n- `params` a hash that represent query params (or a raw string) - a string separated from the preceding part by a question mark (?)\n and a sequence of attribute–value pairs separated by a delimiter (&).\n- `params_encoder` params encoder (default to `Crest::FlatParamsEncoder`)\n- `auth` access authentication method `basic` or `digest` (default to `basic`)\n- `user` and `password` for authentication\n- `tls` configuring TLS settings\n- `p_addr`, `p_port`, `p_user`, `p_pass` for proxy\n- `json` make a JSON request with the appropriate HTTP headers (default to `false`)\n- `multipart` make a multipart request with the appropriate HTTP headers even if not sending a file (default to `false`)\n- `user_agent` set \"User-Agent\" HTTP header (default to `Crest::USER_AGENT`)\n- `max_redirects` maximum number of redirects (default to `10`)\n- `logging` enable logging (default to `false`)\n- `logger` set logger (default to `Crest::CommonLogger`)\n- `handle_errors` error handling (default to `true`)\n- `close_connection` close the connection after request is completed (default to `true`)\n- `http_client` instance of `HTTP::Client`\n- `read_timeout` read timeout (default to `nil`)\n- `write_timeout` write timeout (default to `nil`)\n- `connect_timeout` connect timeout (default to `nil`)","summary":"

A class that used to make the requests The result of a Crest::Request is a Crest::Response object.

","class_methods":[{"html_id":"delete(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.delete(\"http://httpbin.org/delete\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"delete(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.\n\n```\nCrest::Request.delete(\"http://httpbin.org/delete\")\n```","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nrequest.execute\n"}},{"html_id":"execute(method,url,form={}ofString=>String,**args):Crest::Response-class-method","name":"execute","abstract":false,"args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(method, url, form = {} of String => String, **args) : Crest::Response","args_html":"(method, url, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":95,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L95"},"def":{"name":"execute","args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = new(method, url, form, **args)\nrequest.execute\n"}},{"html_id":"execute(method,url,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"execute","abstract":false,"args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(method, url, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(method, url, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":100,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L100"},"def":{"name":"execute","args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = new(method, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.get(\"http://httpbin.org/get\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.\n\n```\nCrest::Request.get(\"http://httpbin.org/get\")\n```","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nrequest.execute\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.head(\"http://httpbin.org/head\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.\n\n```\nCrest::Request.head(\"http://httpbin.org/head\")\n```","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nrequest.execute\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.options(\"http://httpbin.org/options\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.\n\n```\nCrest::Request.options(\"http://httpbin.org/options\")\n```","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nrequest.execute\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.patch(\"http://httpbin.org/patch\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.\n\n```\nCrest::Request.patch(\"http://httpbin.org/patch\")\n```","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nrequest.execute\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.post(\"http://httpbin.org/post\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.\n\n```\nCrest::Request.post(\"http://httpbin.org/post\")\n```","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nrequest.execute\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.put(\"http://httpbin.org/put\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.\n\n```\nCrest::Request.put(\"http://httpbin.org/put\")\n```","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nrequest.execute\n"}}],"constructors":[{"html_id":"new(method:Symbol,url:String,form={}ofString=>String,*,headers={}ofString=>String,cookies={}ofString=>String,params={}ofString=>String,max_redirects:Int32=10,**options,&)-class-method","name":"new","abstract":false,"args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"max_redirects","default_value":"10","external_name":"max_redirects","restriction":"::Int32"}],"args_string":"(method : Symbol, url : String, form = {} of String => String, *, headers = {} of String => String, cookies = {} of String => String, params = {} of String => String, max_redirects : Int32 = 10, **options, &)","args_html":"(method : Symbol, url : String, form = {} of String => String, *, headers = {} of String => String, cookies = {} of String => String, params = {} of String => String, max_redirects : Int32 = 10, **options, &)","location":{"filename":"src/crest/request.cr","line_number":105,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L105"},"def":{"name":"new","args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"max_redirects","default_value":"10","external_name":"max_redirects","restriction":"::Int32"}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":3,"yields":1,"block_arity":1,"visibility":"Public","body":"_ = allocate\n_.initialize(method, url, form, **options, headers: headers, cookies: cookies, params: params, max_redirects: max_redirects) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(method:Symbol,url:String,form={}ofString=>String,**args)-class-method","name":"new","doc":"When block is not given.","summary":"

When block is not given.

","abstract":false,"args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(method : Symbol, url : String, form = {} of String => String, **args)","args_html":"(method : Symbol, url : String, form = {} of String => String, **args)","location":{"filename":"src/crest/request.cr","line_number":163,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L163"},"def":{"name":"new","args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"_ = allocate\n_.initialize(method, url, form, **args)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"auth:String-instance-method","name":"auth","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"auth","visibility":"Public","body":"@auth"}},{"html_id":"close(*args,**options)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.close(*args, **options)"}},{"html_id":"close(*args,**options,&)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.close(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"close_connection:Bool-instance-method","name":"close_connection","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"close_connection","visibility":"Public","body":"@close_connection"}},{"html_id":"closed?-instance-method","name":"closed?","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":229,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L229"},"def":{"name":"closed?","visibility":"Public","body":"http_client.@io ? false : true"}},{"html_id":"connect_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"connect_timeout","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"connect_timeout","visibility":"Public","body":"@connect_timeout"}},{"html_id":"cookies:HTTP::Cookies-instance-method","name":"cookies","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"cookies","visibility":"Public","body":"@cookies"}},{"html_id":"execute:Crest::Response-instance-method","name":"execute","doc":"Execute HTTP request","summary":"

Execute HTTP request

","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":196,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L196"},"def":{"name":"execute","return_type":"Crest::Response","visibility":"Public","body":"begin\n @proxy.try do |proxy|\n @http_client.proxy = proxy\n end\n authenticate!\n if @logging\n @logger.request(self)\n end\n @http_request = new_http_request(@method, @url, @headers, @form_data)\n http_response = @http_client.exec(@http_request)\n process_result(http_response)\nensure\n if @close_connection\n @http_client.close\n end\nend"}},{"html_id":"execute(&block:Crest::Response->):Nil-instance-method","name":"execute","doc":"Execute streaming HTTP request","summary":"

Execute streaming HTTP request

","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":211,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L211"},"def":{"name":"execute","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"begin\n @proxy.try do |proxy|\n @http_client.proxy = proxy\n end\n authenticate!\n if @logging\n @logger.request(self)\n end\n @http_request = new_http_request(@method, @url, @headers, @form_data)\n @http_client.exec(@http_request) do |http_response|\n response = process_result(http_response, &block)\n if response\n yield response\n end\n end\nensure\n if @close_connection\n @http_client.close\n end\nend"}},{"html_id":"form_data:IO|Slice(UInt8)|String|Nil-instance-method","name":"form_data","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"form_data","visibility":"Public","body":"@form_data"}},{"html_id":"handle_errors:Bool-instance-method","name":"handle_errors","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"handle_errors","visibility":"Public","body":"@handle_errors"}},{"html_id":"headers:HTTP::Headers-instance-method","name":"headers","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"headers","visibility":"Public","body":"@headers"}},{"html_id":"host(*args,**options)-instance-method","name":"host","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"host","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.host(*args, **options)"}},{"html_id":"host(*args,**options,&)-instance-method","name":"host","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"host","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.host(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"http_client:HTTP::Client-instance-method","name":"http_client","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"http_client","visibility":"Public","body":"@http_client"}},{"html_id":"http_request:HTTP::Request-instance-method","name":"http_request","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"http_request","visibility":"Public","body":"@http_request"}},{"html_id":"json:Bool-instance-method","name":"json","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"json","visibility":"Public","body":"@json"}},{"html_id":"logger:Crest::Logger-instance-method","name":"logger","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"logger","visibility":"Public","body":"@logger"}},{"html_id":"logging:Bool-instance-method","name":"logging","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"logging","visibility":"Public","body":"@logging"}},{"html_id":"max_redirects:Int32-instance-method","name":"max_redirects","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"max_redirects","visibility":"Public","body":"@max_redirects"}},{"html_id":"method:String-instance-method","name":"method","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"method","visibility":"Public","body":"@method"}},{"html_id":"multipart:Bool-instance-method","name":"multipart","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"multipart","visibility":"Public","body":"@multipart"}},{"html_id":"p_addr:String?-instance-method","name":"p_addr","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_addr","visibility":"Public","body":"@p_addr"}},{"html_id":"p_pass:String?-instance-method","name":"p_pass","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_pass","visibility":"Public","body":"@p_pass"}},{"html_id":"p_port:Int32?-instance-method","name":"p_port","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_port","visibility":"Public","body":"@p_port"}},{"html_id":"p_user:String?-instance-method","name":"p_user","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_user","visibility":"Public","body":"@p_user"}},{"html_id":"password:String?-instance-method","name":"password","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"password","visibility":"Public","body":"@password"}},{"html_id":"password=(password:Nil|String)-instance-method","name":"password=","abstract":false,"args":[{"name":"password","external_name":"password","restriction":"::Nil | ::String"}],"args_string":"(password : Nil | String)","args_html":"(password : Nil | String)","location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"password=","args":[{"name":"password","external_name":"password","restriction":"::Nil | ::String"}],"visibility":"Public","body":"@password = password"}},{"html_id":"port(*args,**options)-instance-method","name":"port","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"port","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.port(*args, **options)"}},{"html_id":"port(*args,**options,&)-instance-method","name":"port","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"port","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.port(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"proxy:HTTP::Proxy::Client?-instance-method","name":"proxy","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"proxy","visibility":"Public","body":"@proxy"}},{"html_id":"read_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"read_timeout","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"read_timeout","visibility":"Public","body":"@read_timeout"}},{"html_id":"redirection_history:Array(Crest::Response)-instance-method","name":"redirection_history","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"redirection_history","visibility":"Public","body":"@redirection_history"}},{"html_id":"redirection_history=(redirection_history:Array(Crest::Response))-instance-method","name":"redirection_history=","abstract":false,"args":[{"name":"redirection_history","external_name":"redirection_history","restriction":"::Array(::Crest::Response)"}],"args_string":"(redirection_history : Array(Crest::Response))","args_html":"(redirection_history : Array(Crest::Response))","location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"redirection_history=","args":[{"name":"redirection_history","external_name":"redirection_history","restriction":"::Array(::Crest::Response)"}],"visibility":"Public","body":"@redirection_history = redirection_history"}},{"html_id":"tls:OpenSSL::SSL::Context::Client?-instance-method","name":"tls","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"tls","visibility":"Public","body":"@tls"}},{"html_id":"tls?(*args,**options)-instance-method","name":"tls?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"tls?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.tls?(*args, **options)"}},{"html_id":"tls?(*args,**options,&)-instance-method","name":"tls?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"tls?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.tls?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_curl-instance-method","name":"to_curl","doc":"Convert `Request` object to cURL command","summary":"

Convert Request object to cURL command

","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":246,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L246"},"def":{"name":"to_curl","visibility":"Public","body":"Crest::Curlify.to_curl(self)"}},{"html_id":"url:String-instance-method","name":"url","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"url","visibility":"Public","body":"@url"}},{"html_id":"user:String?-instance-method","name":"user","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"user","visibility":"Public","body":"@user"}},{"html_id":"user=(user:Nil|String)-instance-method","name":"user=","abstract":false,"args":[{"name":"user","external_name":"user","restriction":"::Nil | ::String"}],"args_string":"(user : Nil | String)","args_html":"(user : Nil | String)","location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"user=","args":[{"name":"user","external_name":"user","restriction":"::Nil | ::String"}],"visibility":"Public","body":"@user = user"}},{"html_id":"user_agent:String?-instance-method","name":"user_agent","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"user_agent","visibility":"Public","body":"@user_agent"}},{"html_id":"write_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"write_timeout","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"write_timeout","visibility":"Public","body":"@write_timeout"}}]},{"html_id":"crest/Crest/RequestFailed","path":"Crest/RequestFailed.html","kind":"class","full_name":"Crest::RequestFailed","name":"RequestFailed","abstract":false,"superclass":{"html_id":"crest/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"crest/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/exceptions.cr","line_number":95,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L95"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This is the base `Crest` exception class. Rescue it if you want to\ncatch any exception that your request might raise\nYou can see anything about the response via `e.response`.\nFor example, the entire result body (which is\nprobably an HTML error page) is `e.response.body`.\n\nHash of HTTP status `code => message`.\n\n- `1xx`: Informational - Request received, continuing process\n- `2xx`: Success - The action was successfully received, understood, and\n accepted\n- `3xx`: Redirection - Further action must be taken in order to complete the\n request\n- `4xx`: Client Error - The request contains bad syntax or cannot be fulfilled\n- `5xx`: Server Error - The server failed to fulfill an apparently valid\n request\n\nSee [HTTP Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)\nfor more Information.","summary":"

This is the base Crest exception class.

","class_methods":[{"html_id":"subclass_by_status_code(status_code)-class-method","name":"subclass_by_status_code","abstract":false,"args":[{"name":"status_code","external_name":"status_code","restriction":""}],"args_string":"(status_code)","args_html":"(status_code)","location":{"filename":"src/crest/exceptions.cr","line_number":100,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L100"},"def":{"name":"subclass_by_status_code","args":[{"name":"status_code","external_name":"status_code","restriction":""}],"visibility":"Public","body":"EXCEPTIONS_MAP.fetch(status_code, self)"}}],"constructors":[{"html_id":"new(response:Crest::Response)-class-method","name":"new","abstract":false,"args":[{"name":"response","external_name":"response","restriction":"::Crest::Response"}],"args_string":"(response : Crest::Response)","args_html":"(response : Crest::Response)","location":{"filename":"src/crest/exceptions.cr","line_number":104,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L104"},"def":{"name":"new","args":[{"name":"response","external_name":"response","restriction":"::Crest::Response"}],"visibility":"Public","body":"_ = allocate\n_.initialize(response)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"http_code-instance-method","name":"http_code","abstract":false,"location":{"filename":"src/crest/exceptions.cr","line_number":108,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L108"},"def":{"name":"http_code","visibility":"Public","body":"@response.status_code.to_i"}},{"html_id":"message-instance-method","name":"message","abstract":false,"location":{"filename":"src/crest/exceptions.cr","line_number":112,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L112"},"def":{"name":"message","visibility":"Public","body":"\"HTTP status code #{http_code}: #{STATUSES[http_code]}\""}},{"html_id":"response:Crest::Response-instance-method","name":"response","abstract":false,"location":{"filename":"src/crest/exceptions.cr","line_number":96,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L96"},"def":{"name":"response","visibility":"Public","body":"@response"}}]},{"html_id":"crest/Crest/Resource","path":"Crest/Resource.html","kind":"class","full_name":"Crest::Resource","name":"Resource","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/resource.cr","line_number":62,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L62"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"A class that can be instantiated for access to a RESTful resource,\nincluding authentication, proxy and logging.\n\nSimple example:\n\n```\nresource = Crest::Resource.new(\"https://httpbin.org/get\")\nresponse = resource.get\n```\n\nBlock style:\n\n```\nresource = Crest::Resource.new(\"http://httpbin.org\") do |res|\n res.headers.merge!({\"foo\" => \"bar\"})\nend\n\nresponse = resource[\"/headers\"].get\n```\n\nWith HTTP basic authentication:\n\n```\nresource = Crest::Resource.new(\"https://httpbin.org/get\", user: \"user\", password: \"password\")\n```\n\nUse the `[]` syntax to allocate subresources:\n\n```\nresource = Crest::Resource.new(\"https://httpbin.org\")\nresource[\"/get\"].get\n```\n\nYou can pass advanced parameters like default `params`, `headers`, or `cookies`:\n\n```\nresource = Crest::Resource.new(\n \"https://httpbin.org\",\n params: {\"key\" => \"key\"},\n headers: {\"Content-Type\" => \"application/json\"},\n cookies: {\"lang\"=> \"ua\"}\n)\nresponse = response[\"/post\"].post(\n form: {:height => 100, \"width\" => \"100\"},\n params: {:secret => \"secret\"},\n cookies: {\"locale\"=> \"en_US\"}\n)\n```\nIf you want to stream the data from the response you can pass a block:\n\n```\nresource = Crest::Resource.new(\"http://httpbin.org\")\nresource[\"/stream/5\"].get do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

A class that can be instantiated for access to a RESTful resource, including authentication, proxy and logging.

","constructors":[{"html_id":"new(url:String,*,headers:Hash(String,String)={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,**options,&)-class-method","name":"new","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":"::Hash(::String, ::String)"},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(url : String, *, headers : Hash(String, String) = {} of String => String, params = {} of String => String, cookies = {} of String => String, **options, &)","args_html":"(url : String, *, headers : Hash(String, String) = {} of String => String, params = {} of String => String, cookies = {} of String => String, **options, &)","location":{"filename":"src/crest/resource.cr","line_number":77,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L77"},"def":{"name":"new","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":"::Hash(::String, ::String)"},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":1,"yields":1,"block_arity":1,"visibility":"Public","body":"_ = allocate\n_.initialize(url, **options, headers: headers, params: params, cookies: cookies) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(url:String,**args)-class-method","name":"new","doc":"When block is not given.","summary":"

When block is not given.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(url : String, **args)","args_html":"(url : String, **args)","location":{"filename":"src/crest/resource.cr","line_number":112,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L112"},"def":{"name":"new","args":[{"name":"url","external_name":"url","restriction":"String"}],"double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"_ = allocate\n_.initialize(url, **args)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](suburl)-instance-method","name":"[]","abstract":false,"args":[{"name":"suburl","external_name":"suburl","restriction":""}],"args_string":"(suburl)","args_html":"(suburl)","location":{"filename":"src/crest/resource.cr","line_number":163,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L163"},"def":{"name":"[]","args":[{"name":"suburl","external_name":"suburl","restriction":""}],"visibility":"Public","body":"@url = concat_urls(@base_url, suburl)\nself\n"}},{"html_id":"close(*args,**options)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/resource.cr","line_number":72,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L72"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client.close(*args, **options)"}},{"html_id":"close(*args,**options,&)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/resource.cr","line_number":72,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L72"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client.close(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"close_connection:Bool-instance-method","name":"close_connection","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"close_connection","visibility":"Public","body":"@close_connection"}},{"html_id":"closed?-instance-method","name":"closed?","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":169,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L169"},"def":{"name":"closed?","visibility":"Public","body":"http_client.@io ? false : true"}},{"html_id":"connect_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"connect_timeout","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"connect_timeout","visibility":"Public","body":"@connect_timeout"}},{"html_id":"cookies:Hash(String,Bool|Float32|Float64|IO|Int32|Int64|String|Symbol|Nil)-instance-method","name":"cookies","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"cookies","visibility":"Public","body":"@cookies"}},{"html_id":"delete(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:delete, form)\n"}},{"html_id":"delete(form={}ofString=>String,**args):Crest::Response-instance-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"delete(nil, form, **args)"}},{"html_id":"delete(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:delete, form, &block)\n"}},{"html_id":"delete(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"delete(nil, form, **args, &block)"}},{"html_id":"get(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:get, form)\n"}},{"html_id":"get(form={}ofString=>String,**args):Crest::Response-instance-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"get(nil, form, **args)"}},{"html_id":"get(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:get, form, &block)\n"}},{"html_id":"get(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"get(nil, form, **args, &block)"}},{"html_id":"handle_errors:Bool-instance-method","name":"handle_errors","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"handle_errors","visibility":"Public","body":"@handle_errors"}},{"html_id":"head(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:head, form)\n"}},{"html_id":"head(form={}ofString=>String,**args):Crest::Response-instance-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"head(nil, form, **args)"}},{"html_id":"head(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:head, form, &block)\n"}},{"html_id":"head(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"head(nil, form, **args, &block)"}},{"html_id":"headers:Hash(String,String)-instance-method","name":"headers","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"headers","visibility":"Public","body":"@headers"}},{"html_id":"http_client:HTTP::Client-instance-method","name":"http_client","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"http_client","visibility":"Public","body":"@http_client"}},{"html_id":"json:Bool-instance-method","name":"json","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"json","visibility":"Public","body":"@json"}},{"html_id":"logger:Crest::Logger-instance-method","name":"logger","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"logger","visibility":"Public","body":"@logger"}},{"html_id":"logging:Bool-instance-method","name":"logging","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"logging","visibility":"Public","body":"@logging"}},{"html_id":"options(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:options, form)\n"}},{"html_id":"options(form={}ofString=>String,**args):Crest::Response-instance-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"options(nil, form, **args)"}},{"html_id":"options(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:options, form, &block)\n"}},{"html_id":"options(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"options(nil, form, **args, &block)"}},{"html_id":"p_addr:String?-instance-method","name":"p_addr","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_addr","visibility":"Public","body":"@p_addr"}},{"html_id":"p_pass:String?-instance-method","name":"p_pass","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_pass","visibility":"Public","body":"@p_pass"}},{"html_id":"p_port:Int32?-instance-method","name":"p_port","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_port","visibility":"Public","body":"@p_port"}},{"html_id":"p_user:String?-instance-method","name":"p_user","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_user","visibility":"Public","body":"@p_user"}},{"html_id":"params:Hash(String,Bool|Float32|Float64|IO|Int32|Int64|String|Symbol|Nil)-instance-method","name":"params","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"params","visibility":"Public","body":"@params"}},{"html_id":"password:String?-instance-method","name":"password","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"password","visibility":"Public","body":"@password"}},{"html_id":"patch(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:patch, form)\n"}},{"html_id":"patch(form={}ofString=>String,**args):Crest::Response-instance-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"patch(nil, form, **args)"}},{"html_id":"patch(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:patch, form, &block)\n"}},{"html_id":"patch(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"patch(nil, form, **args, &block)"}},{"html_id":"post(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:post, form)\n"}},{"html_id":"post(form={}ofString=>String,**args):Crest::Response-instance-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"post(nil, form, **args)"}},{"html_id":"post(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:post, form, &block)\n"}},{"html_id":"post(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"post(nil, form, **args, &block)"}},{"html_id":"put(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:put, form)\n"}},{"html_id":"put(form={}ofString=>String,**args):Crest::Response-instance-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"put(nil, form, **args)"}},{"html_id":"put(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:put, form, &block)\n"}},{"html_id":"put(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"put(nil, form, **args, &block)"}},{"html_id":"read_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"read_timeout","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"read_timeout","visibility":"Public","body":"@read_timeout"}},{"html_id":"url:String-instance-method","name":"url","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"url","visibility":"Public","body":"@url"}},{"html_id":"user:String?-instance-method","name":"user","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"user","visibility":"Public","body":"@user"}},{"html_id":"user_agent:String?-instance-method","name":"user_agent","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"user_agent","visibility":"Public","body":"@user_agent"}},{"html_id":"write_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"write_timeout","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"write_timeout","visibility":"Public","body":"@write_timeout"}}]},{"html_id":"crest/Crest/Response","path":"Crest/Response.html","kind":"class","full_name":"Crest::Response","name":"Response","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/response.cr","line_number":17,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L17"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Response objects have several useful methods:\n\n- `body`: The response body as a `String`\n- `body_io`: The response body as a `IO`\n- `status`: The response status as a `HTTP::Status`\n- `status_code`: The HTTP response code\n- `headers`: A hash of HTTP response headers\n- `cookies`: A hash of HTTP cookies set by the server\n- `request`: The `Crest::Request` object used to make the request\n- `http_client_res`: The `HTTP::Client::Response` object\n- `history`: A list of each response received in a redirection chain","summary":"

Response objects have several useful methods:

","constructors":[{"html_id":"new(http_client_res:HTTP::Client::Response,request:Crest::Request)-class-method","name":"new","abstract":false,"args":[{"name":"http_client_res","external_name":"http_client_res","restriction":"HTTP::Client::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(http_client_res : HTTP::Client::Response, request : Crest::Request)","args_html":"(http_client_res : HTTP::Client::Response, request : Crest::Request)","location":{"filename":"src/crest/response.cr","line_number":27,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L27"},"def":{"name":"new","args":[{"name":"http_client_res","external_name":"http_client_res","restriction":"HTTP::Client::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"_ = allocate\n_.initialize(http_client_res, request)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"body(*args,**options)-instance-method","name":"body","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L20"},"def":{"name":"body","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.body(*args, **options)"}},{"html_id":"body(*args,**options,&)-instance-method","name":"body","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L20"},"def":{"name":"body","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.body(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"body_io(*args,**options)-instance-method","name":"body_io","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L21"},"def":{"name":"body_io","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.body_io(*args, **options)"}},{"html_id":"body_io(*args,**options,&)-instance-method","name":"body_io","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L21"},"def":{"name":"body_io","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.body_io(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"client_error?(*args,**options)-instance-method","name":"client_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"client_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.client_error?(*args, **options)"}},{"html_id":"client_error?(*args,**options,&)-instance-method","name":"client_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"client_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.client_error?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"content_length:Int64-instance-method","name":"content_length","doc":"Size of the message body in bytes taken from \"Content-Length\" header","summary":"

Size of the message body in bytes taken from "Content-Length" header

","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":67,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L67"},"def":{"name":"content_length","return_type":"Int64","visibility":"Public","body":"http_client_res.headers[\"Content-Length\"].to_i64"}},{"html_id":"cookies-instance-method","name":"cookies","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":49,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L49"},"def":{"name":"cookies","visibility":"Public","body":"request_cookies.merge(response_cookies)"}},{"html_id":"filename:String|Nil-instance-method","name":"filename","doc":"Extracts filename from \"Content-Disposition\" header","summary":"

Extracts filename from "Content-Disposition" header

","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":58,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L58"},"def":{"name":"filename","return_type":"String | ::Nil","visibility":"Public","body":"filename_regex = /filename\\*?=['\"]?(?:UTF-\\d['\"]*)?([^;\\r\\n\"']*)['\"]?;?/ix\nif match_data = (http_client_res.headers.fetch(\"Content-Disposition\", \"\")).match(filename_regex)\n return match_data[1]\nend\n"}},{"html_id":"headers-instance-method","name":"headers","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":45,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L45"},"def":{"name":"headers","visibility":"Public","body":"normalize_headers(http_client_res.headers)"}},{"html_id":"history:Array-instance-method","name":"history","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":53,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L53"},"def":{"name":"history","return_type":"Array","visibility":"Public","body":"@request.redirection_history"}},{"html_id":"http_client_res:HTTP::Client::Response-instance-method","name":"http_client_res","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":18,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L18"},"def":{"name":"http_client_res","visibility":"Public","body":"@http_client_res"}},{"html_id":"informational?(*args,**options)-instance-method","name":"informational?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"informational?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.informational?(*args, **options)"}},{"html_id":"informational?(*args,**options,&)-instance-method","name":"informational?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"informational?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.informational?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"inspect-instance-method","name":"inspect","doc":"Returns an unambiguous and information-rich string representation of this\nobject, typically intended for developers.\n\nThis method should usually **not** be overridden. It delegates to\n`#inspect(IO)` which can be overridden for custom implementations.\n\nAlso see `#to_s`.","summary":"

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":87,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L87"},"def":{"name":"inspect","visibility":"Public","body":"\"\""}},{"html_id":"invalid?-instance-method","name":"invalid?","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":71,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L71"},"def":{"name":"invalid?","visibility":"Public","body":"status_code < 100 || status_code >= 600"}},{"html_id":"redirect?-instance-method","name":"redirect?","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":75,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L75"},"def":{"name":"redirect?","visibility":"Public","body":"[301, 302, 303, 307, 308].includes?(status_code)"}},{"html_id":"redirection?(*args,**options)-instance-method","name":"redirection?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"redirection?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.redirection?(*args, **options)"}},{"html_id":"redirection?(*args,**options,&)-instance-method","name":"redirection?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"redirection?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.redirection?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"request:Crest::Request-instance-method","name":"request","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":18,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L18"},"def":{"name":"request","visibility":"Public","body":"@request"}},{"html_id":"return!:Crest::Response-instance-method","name":"return!","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":31,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L31"},"def":{"name":"return!","return_type":"Crest::Response","visibility":"Public","body":"redirector = Redirector.new(self, request)\nredirector.follow\n"}},{"html_id":"return!(&block:Crest::Response->)-instance-method","name":"return!","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":36,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L36"},"def":{"name":"return!","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"visibility":"Public","body":"redirector = Redirector.new(self, request)\nredirector.follow(&block)\n"}},{"html_id":"server_error?(*args,**options)-instance-method","name":"server_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"server_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.server_error?(*args, **options)"}},{"html_id":"server_error?(*args,**options,&)-instance-method","name":"server_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"server_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.server_error?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"status(*args,**options)-instance-method","name":"status","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":22,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L22"},"def":{"name":"status","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.status(*args, **options)"}},{"html_id":"status(*args,**options,&)-instance-method","name":"status","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":22,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L22"},"def":{"name":"status","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.status(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"status_code(*args,**options)-instance-method","name":"status_code","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":23,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L23"},"def":{"name":"status_code","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.status_code(*args, **options)"}},{"html_id":"status_code(*args,**options,&)-instance-method","name":"status_code","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":23,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L23"},"def":{"name":"status_code","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.status_code(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"success?(*args,**options)-instance-method","name":"success?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"success?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.success?(*args, **options)"}},{"html_id":"success?(*args,**options,&)-instance-method","name":"success?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"success?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.success?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_curl(*args,**options)-instance-method","name":"to_curl","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":25,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L25"},"def":{"name":"to_curl","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"request.to_curl(*args, **options)"}},{"html_id":"to_curl(*args,**options,&)-instance-method","name":"to_curl","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":25,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L25"},"def":{"name":"to_curl","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"request.to_curl(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_s(io:IO):Nil-instance-method","name":"to_s","doc":"Appends a short String representation of this object\nwhich includes its class name and its object address.\n\n```\nclass Person\n def initialize(@name : String, @age : Int32)\n end\nend\n\nPerson.new(\"John\", 32).to_s # => #\n```","summary":"

Appends a short String representation of this object which includes its class name and its object address.

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/crest/response.cr","line_number":79,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L79"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"{% if (compare_versions(Crystal::VERSION, \"1.1.1\")) > 0 %}\n io.write_string(body.to_slice)\n {% else %}\n io.write_utf8(body.to_slice)\n {% end %}"}},{"html_id":"url:String-instance-method","name":"url","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":41,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L41"},"def":{"name":"url","return_type":"String","visibility":"Public","body":"@request.url"}}]},{"html_id":"crest/Crest/TimeoutValue","path":"Crest/TimeoutValue.html","kind":"alias","full_name":"Crest::TimeoutValue","name":"TimeoutValue","abstract":false,"locations":[{"filename":"src/crest.cr","line_number":43,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L43"}],"repository_name":"crest","program":false,"enum":false,"alias":true,"aliased":"(Float32 | Int32 | Time::Span)","aliased_html":"Float32 | Int32 | Time::Span","const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"}},{"html_id":"crest/Crest/UrlencodedForm","path":"Crest/UrlencodedForm.html","kind":"class","full_name":"Crest::UrlencodedForm(T)","name":"UrlencodedForm","abstract":false,"superclass":{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},"ancestors":[{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/forms/urlencoded_form.cr","line_number":8,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L8"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This class lets `crest` emulate a filled-in form\nin which a user has pressed the submit button.\nThis causes `crest` to POST data using the\n\"Content-Type\" `application/x-www-form-urlencoded`.","summary":"

This class lets crest emulate a filled-in form in which a user has pressed the submit button.

","instance_methods":[{"html_id":"generate-instance-method","name":"generate","abstract":false,"location":{"filename":"src/crest/forms/urlencoded_form.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L11"},"def":{"name":"generate","visibility":"Public","body":"@form_data = parsed_params\nself\n"}},{"html_id":"parsed_params-instance-method","name":"parsed_params","abstract":false,"location":{"filename":"src/crest/forms/urlencoded_form.cr","line_number":17,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L17"},"def":{"name":"parsed_params","visibility":"Public","body":"@params_encoder.encode(@params)"}}]},{"html_id":"crest/Crest/ZeroEnumeratedFlatParamsEncoder","path":"Crest/ZeroEnumeratedFlatParamsEncoder.html","kind":"class","full_name":"Crest::ZeroEnumeratedFlatParamsEncoder","name":"ZeroEnumeratedFlatParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder"},{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"array_start_index-class-method","name":"array_start_index","abstract":false,"location":{"filename":"src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr#L3"},"def":{"name":"array_start_index","visibility":"Public","body":"@@array_start_index"}}]}]},{"html_id":"crest/Float","path":"Float.html","kind":"struct","full_name":"Float","name":"Float","abstract":true,"superclass":{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},"ancestors":[{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},{"html_id":"crest/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"crest/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"crest/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ext/float.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/float.cr#L1"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"doc":"Float is the base type of all floating point numbers.\n\nThere are two floating point types, `Float32` and `Float64`,\nwhich correspond to the [binary32](http://en.wikipedia.org/wiki/Single_precision_floating-point_format)\nand [binary64](http://en.wikipedia.org/wiki/Double_precision_floating-point_format)\ntypes defined by IEEE.\n\nA floating point literal is an optional `+` or `-` sign, followed by\na sequence of numbers or underscores, followed by a dot,\nfollowed by numbers or underscores, followed by an optional exponent suffix,\nfollowed by an optional type suffix. If no suffix is present, the literal's type is `Float64`.\n\n```\n1.0 # Float64\n1.0_f32 # Float32\n1_f32 # Float32\n\n1e10 # Float64\n1.5e10 # Float64\n1.5e-7 # Float64\n\n+1.3 # Float64\n-0.5 # Float64\n```\n\nThe underscore `_` before the suffix is optional.\n\nUnderscores can be used to make some numbers more readable:\n\n```\n1_000_000.111_111 # better than 1000000.111111\n```\n\nSee [`Float` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/floats.html) in the language reference.","summary":"

Float is the base type of all floating point numbers.

","instance_methods":[{"html_id":"to_time_span:Time::Span-instance-method","name":"to_time_span","abstract":false,"location":{"filename":"src/ext/float.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/float.cr#L2"},"def":{"name":"to_time_span","return_type":"Time::Span","visibility":"Public","body":"seconds = self.to_i\nnanoseconds = ((self - seconds) * 1000000000).to_i\nTime::Span.new(seconds: seconds, nanoseconds: nanoseconds)\n"}}]},{"html_id":"crest/Int","path":"Int.html","kind":"struct","full_name":"Int","name":"Int","abstract":true,"superclass":{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},"ancestors":[{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},{"html_id":"crest/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"crest/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"crest/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ext/int.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/int.cr#L1"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"doc":"Int is the base type of all integer types.\n\nThere are four signed integer types: `Int8`, `Int16`, `Int32` and `Int64`,\nbeing able to represent numbers of 8, 16, 32 and 64 bits respectively.\nThere are four unsigned integer types: `UInt8`, `UInt16`, `UInt32` and `UInt64`.\n\nAn integer literal is an optional `+` or `-` sign, followed by\na sequence of digits and underscores, optionally followed by a suffix.\nIf no suffix is present, the literal's type is `Int32`, or `Int64` if the\nnumber doesn't fit into an `Int32`:\n\n```\n1 # Int32\n\n1_i8 # Int8\n1_i16 # Int16\n1_i32 # Int32\n1_i64 # Int64\n\n1_u8 # UInt8\n1_u16 # UInt16\n1_u32 # UInt32\n1_u64 # UInt64\n\n+10 # Int32\n-20 # Int32\n\n2147483648 # Int64\n```\n\nLiterals without a suffix that are larger than `Int64::MAX` represent a\n`UInt64` if the number fits, e.g. `9223372036854775808` and\n`0x80000000_00000000`. This behavior is deprecated and will become an error in\nthe future.\n\nThe underscore `_` before the suffix is optional.\n\nUnderscores can be used to make some numbers more readable:\n\n```\n1_000_000 # better than 1000000\n```\n\nBinary numbers start with `0b`:\n\n```\n0b1101 # == 13\n```\n\nOctal numbers start with `0o`:\n\n```\n0o123 # == 83\n```\n\nHexadecimal numbers start with `0x`:\n\n```\n0xFE012D # == 16646445\n0xfe012d # == 16646445\n```\n\nSee [`Integer` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/integers.html) in the language reference.","summary":"

Int is the base type of all integer types.

","instance_methods":[{"html_id":"to_time_span:Time::Span-instance-method","name":"to_time_span","abstract":false,"location":{"filename":"src/ext/int.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/int.cr#L2"},"def":{"name":"to_time_span","return_type":"Time::Span","visibility":"Public","body":"Time::Span.new(seconds: self)"}}]}]}} \ No newline at end of file diff --git a/js/doc.js b/js/doc.js new file mode 100644 index 00000000..eaedd5c3 --- /dev/null +++ b/js/doc.js @@ -0,0 +1,1099 @@ +window.CrystalDocs = (window.CrystalDocs || {}); + +CrystalDocs.base_path = (CrystalDocs.base_path || ""); + +CrystalDocs.searchIndex = (CrystalDocs.searchIndex || false); +CrystalDocs.MAX_RESULTS_DISPLAY = 140; + +CrystalDocs.runQuery = function(query) { + function searchType(type, query, results) { + var matches = []; + var matchedFields = []; + var name = type.full_name; + var i = name.lastIndexOf("::"); + if (i > 0) { + name = name.substring(i + 2); + } + var nameMatches = query.matches(name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + var namespaceMatches = query.matchesNamespace(type.full_name); + if(namespaceMatches){ + matches = matches.concat(namespaceMatches); + matchedFields.push("name"); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + results.push({ + id: type.html_id, + result_type: "type", + kind: type.kind, + name: name, + full_name: type.full_name, + href: type.path, + summary: type.summary, + matched_fields: matchedFields, + matched_terms: matches + }); + } + + if (type.instance_methods) { + type.instance_methods.forEach(function(method) { + searchMethod(method, type, "instance_method", query, results); + }) + } + if (type.class_methods) { + type.class_methods.forEach(function(method) { + searchMethod(method, type, "class_method", query, results); + }) + } + if (type.constructors) { + type.constructors.forEach(function(constructor) { + searchMethod(constructor, type, "constructor", query, results); + }) + } + if (type.macros) { + type.macros.forEach(function(macro) { + searchMethod(macro, type, "macro", query, results); + }) + } + if (type.constants) { + type.constants.forEach(function(constant){ + searchConstant(constant, type, query, results); + }); + } + if (type.types) { + type.types.forEach(function(subtype){ + searchType(subtype, query, results); + }); + } + }; + + function searchMethod(method, type, kind, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matchesMethod(method.name, kind, type); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + if (method.args) { + method.args.forEach(function(arg){ + var argMatches = query.matches(arg.external_name); + if (argMatches) { + matches = matches.concat(argMatches); + matchedFields.push("args"); + } + }); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: method.html_id, + type: type.full_name, + result_type: kind, + name: method.name, + full_name: type.full_name + "#" + method.name, + args_string: method.args_string, + summary: method.summary, + href: type.path + "#" + method.html_id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + function searchConstant(constant, type, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matches(constant.name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + var docMatches = query.matches(constant.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: constant.id, + type: type.full_name, + result_type: "constant", + name: constant.name, + full_name: type.full_name + "#" + constant.name, + value: constant.value, + summary: constant.summary, + href: type.path + "#" + constant.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + var results = []; + searchType(CrystalDocs.searchIndex.program, query, results); + return results; +}; + +CrystalDocs.rankResults = function(results, query) { + function uniqueArray(ar) { + var j = {}; + + ar.forEach(function(v) { + j[v + "::" + typeof v] = v; + }); + + return Object.keys(j).map(function(v) { + return j[v]; + }); + } + + results = results.sort(function(a, b) { + var matchedTermsDiff = uniqueArray(b.matched_terms).length - uniqueArray(a.matched_terms).length; + var aHasDocs = b.matched_fields.includes("doc"); + var bHasDocs = b.matched_fields.includes("doc"); + + var aOnlyDocs = aHasDocs && a.matched_fields.length == 1; + var bOnlyDocs = bHasDocs && b.matched_fields.length == 1; + + if (a.result_type == "type" && b.result_type != "type" && !aOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("a is type b not"); } + return -1; + } else if (b.result_type == "type" && a.result_type != "type" && !bOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("b is type, a not"); } + return 1; + } + if (a.matched_fields.includes("name")) { + if (b.matched_fields.includes("name")) { + var a_name = (CrystalDocs.prefixForType(a.result_type) || "") + ((a.result_type == "type") ? a.full_name : a.name); + var b_name = (CrystalDocs.prefixForType(b.result_type) || "") + ((b.result_type == "type") ? b.full_name : b.name); + a_name = a_name.toLowerCase(); + b_name = b_name.toLowerCase(); + for(var i = 0; i < query.normalizedTerms.length; i++) { + var term = query.terms[i].replace(/^::?|::?$/, ""); + var a_orig_index = a_name.indexOf(term); + var b_orig_index = b_name.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("term: " + term + " a: " + a_name + " b: " + b_name); } + if(CrystalDocs.DEBUG) { console.log(a_orig_index, b_orig_index, a_orig_index - b_orig_index); } + if (a_orig_index >= 0) { + if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("both have exact match", a_orig_index > b_orig_index ? -1 : 1); } + if(a_orig_index != b_orig_index) { + if(CrystalDocs.DEBUG) { console.log("both have exact match at different positions", a_orig_index > b_orig_index ? 1 : -1); } + return a_orig_index > b_orig_index ? 1 : -1; + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has exact match, b not"); } + return -1; + } + } else if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("b has exact match, a not"); } + return 1; + } + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has match in name, b not"); } + return -1; + } + } else if ( + !a.matched_fields.includes("name") && + b.matched_fields.includes("name") + ) { + return 1; + } + + if (matchedTermsDiff != 0 || (aHasDocs != bHasDocs)) { + if(CrystalDocs.DEBUG) { console.log("matchedTermsDiff: " + matchedTermsDiff, aHasDocs, bHasDocs); } + return matchedTermsDiff; + } + + var matchedFieldsDiff = b.matched_fields.length - a.matched_fields.length; + if (matchedFieldsDiff != 0) { + if(CrystalDocs.DEBUG) { console.log("matched to different number of fields: " + matchedFieldsDiff); } + return matchedFieldsDiff > 0 ? 1 : -1; + } + + var nameCompare = a.name.localeCompare(b.name); + if(nameCompare != 0){ + if(CrystalDocs.DEBUG) { console.log("nameCompare resulted in: " + a.name + "<=>" + b.name + ": " + nameCompare); } + return nameCompare > 0 ? 1 : -1; + } + + if(a.matched_fields.includes("args") && b.matched_fields.includes("args")) { + for(var i = 0; i < query.terms.length; i++) { + var term = query.terms[i]; + var aIndex = a.args_string.indexOf(term); + var bIndex = b.args_string.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("index of " + term + " in args_string: " + aIndex + " - " + bIndex); } + if(aIndex >= 0){ + if(bIndex >= 0){ + if(aIndex != bIndex){ + return aIndex > bIndex ? 1 : -1; + } + }else{ + return -1; + } + }else if(bIndex >= 0) { + return 1; + } + } + } + + return 0; + }); + + if (results.length > 1) { + // if we have more than two search terms, only include results with the most matches + var bestMatchedTerms = uniqueArray(results[0].matched_terms).length; + + results = results.filter(function(result) { + return uniqueArray(result.matched_terms).length + 1 >= bestMatchedTerms; + }); + } + return results; +}; + +CrystalDocs.prefixForType = function(type) { + switch (type) { + case "instance_method": + return "#"; + + case "class_method": + case "macro": + case "constructor": + return "."; + + default: + return false; + } +}; + +CrystalDocs.displaySearchResults = function(results, query) { + function sanitize(html){ + return html.replace(/<(?!\/?code)[^>]+>/g, ""); + } + + // limit results + if (results.length > CrystalDocs.MAX_RESULTS_DISPLAY) { + results = results.slice(0, CrystalDocs.MAX_RESULTS_DISPLAY); + } + + var $frag = document.createDocumentFragment(); + var $resultsElem = document.querySelector(".search-list"); + $resultsElem.innerHTML = ""; + + results.forEach(function(result, i) { + var url = CrystalDocs.base_path + result.href; + var type = false; + + var title = query.highlight(result.result_type == "type" ? result.full_name : result.name); + + var prefix = CrystalDocs.prefixForType(result.result_type); + if (prefix) { + title = "" + prefix + "" + title; + } + + title = "" + title + ""; + + if (result.args_string) { + title += + "" + query.highlight(result.args_string) + ""; + } + + $elem = document.createElement("li"); + $elem.className = "search-result search-result--" + result.result_type; + $elem.dataset.href = url; + $elem.setAttribute("title", result.full_name + " docs page"); + + var $title = document.createElement("div"); + $title.setAttribute("class", "search-result__title"); + var $titleLink = document.createElement("a"); + $titleLink.setAttribute("href", url); + + $titleLink.innerHTML = title; + $title.appendChild($titleLink); + $elem.appendChild($title); + $elem.addEventListener("click", function() { + $titleLink.click(); + }); + + if (result.result_type !== "type") { + var $type = document.createElement("div"); + $type.setAttribute("class", "search-result__type"); + $type.innerHTML = query.highlight(result.type); + $elem.appendChild($type); + } + + if(result.summary){ + var $doc = document.createElement("div"); + $doc.setAttribute("class", "search-result__doc"); + $doc.innerHTML = query.highlight(sanitize(result.summary)); + $elem.appendChild($doc); + } + + $elem.appendChild(document.createComment(JSON.stringify(result))); + $frag.appendChild($elem); + }); + + $resultsElem.appendChild($frag); + + CrystalDocs.toggleResultsList(true); +}; + +CrystalDocs.toggleResultsList = function(visible) { + if (visible) { + document.querySelector(".types-list").classList.add("hidden"); + document.querySelector(".search-results").classList.remove("hidden"); + } else { + document.querySelector(".types-list").classList.remove("hidden"); + document.querySelector(".search-results").classList.add("hidden"); + } +}; + +CrystalDocs.Query = function(string) { + this.original = string; + this.terms = string.split(/\s+/).filter(function(word) { + return CrystalDocs.Query.stripModifiers(word).length > 0; + }); + + var normalized = this.terms.map(CrystalDocs.Query.normalizeTerm); + this.normalizedTerms = normalized; + + function runMatcher(field, matcher) { + if (!field) { + return false; + } + var normalizedValue = CrystalDocs.Query.normalizeTerm(field); + + var matches = []; + normalized.forEach(function(term) { + if (matcher(normalizedValue, term)) { + matches.push(term); + } + }); + return matches.length > 0 ? matches : false; + } + + this.matches = function(field) { + return runMatcher(field, function(normalized, term) { + if (term[0] == "#" || term[0] == ".") { + return false; + } + return normalized.indexOf(term) >= 0; + }); + }; + + function namespaceMatcher(normalized, term){ + var i = term.indexOf(":"); + if(i >= 0){ + term = term.replace(/^::?|::?$/, ""); + var index = normalized.indexOf(term); + if((index == 0) || (index > 0 && normalized[index-1] == ":")){ + return true; + } + } + return false; + } + this.matchesMethod = function(name, kind, type) { + return runMatcher(name, function(normalized, term) { + var i = term.indexOf("#"); + if(i >= 0){ + if (kind != "instance_method") { + return false; + } + }else{ + i = term.indexOf("."); + if(i >= 0){ + if (kind != "class_method" && kind != "macro" && kind != "constructor") { + return false; + } + }else{ + //neither # nor . + if(term.indexOf(":") && namespaceMatcher(normalized, term)){ + return true; + } + } + } + + var methodName = term; + if(i >= 0){ + var termType = term.substring(0, i); + methodName = term.substring(i+1); + + if(termType != "") { + if(CrystalDocs.Query.normalizeTerm(type.full_name).indexOf(termType) < 0){ + return false; + } + } + } + return normalized.indexOf(methodName) >= 0; + }); + }; + + this.matchesNamespace = function(namespace){ + return runMatcher(namespace, namespaceMatcher); + }; + + this.highlight = function(string) { + if (typeof string == "undefined") { + return ""; + } + function escapeRegExp(s) { + return s.replace(/[.*+?\^${}()|\[\]\\]/g, "\\$&").replace(/^[#\.:]+/, ""); + } + return string.replace( + new RegExp("(" + this.normalizedTerms.map(escapeRegExp).join("|") + ")", "gi"), + "$1" + ); + }; +}; +CrystalDocs.Query.normalizeTerm = function(term) { + return term.toLowerCase(); +}; +CrystalDocs.Query.stripModifiers = function(term) { + switch (term[0]) { + case "#": + case ".": + case ":": + return term.substr(1); + + default: + return term; + } +} + +CrystalDocs.search = function(string) { + if(!CrystalDocs.searchIndex) { + console.log("CrystalDocs search index not initialized, delaying search"); + + document.addEventListener("CrystalDocs:loaded", function listener(){ + document.removeEventListener("CrystalDocs:loaded", listener); + CrystalDocs.search(string); + }); + return; + } + + document.dispatchEvent(new Event("CrystalDocs:searchStarted")); + + var query = new CrystalDocs.Query(string); + var results = CrystalDocs.runQuery(query); + results = CrystalDocs.rankResults(results, query); + CrystalDocs.displaySearchResults(results, query); + + document.dispatchEvent(new Event("CrystalDocs:searchPerformed")); +}; + +CrystalDocs.initializeIndex = function(data) { + CrystalDocs.searchIndex = data; + + document.dispatchEvent(new Event("CrystalDocs:loaded")); +}; + +CrystalDocs.loadIndex = function() { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function loadScript(file) { + script = document.createElement("script"); + script.src = file; + document.body.appendChild(script); + } + + function parseJSON(json) { + CrystalDocs.initializeIndex(JSON.parse(json)); + } + + for(var i = 0; i < document.scripts.length; i++){ + var script = document.scripts[i]; + if (script.src && script.src.indexOf("js/doc.js") >= 0) { + if (script.src.indexOf("file://") == 0) { + // We need to support JSONP files for the search to work on local file system. + var jsonPath = script.src.replace("js/doc.js", "search-index.js"); + loadScript(jsonPath); + return; + } else { + var jsonPath = script.src.replace("js/doc.js", "index.json"); + loadJSON(jsonPath, parseJSON); + return; + } + } + } + console.error("Could not find location of js/doc.js"); +}; + +// Callback for jsonp +function crystal_doc_search_index_callback(data) { + CrystalDocs.initializeIndex(data); +} + +Navigator = function(sidebar, searchInput, list, leaveSearchScope){ + this.list = list; + var self = this; + + var performingSearch = false; + + document.addEventListener('CrystalDocs:searchStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchDebounceStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchPerformed', function(){ + performingSearch = false; + }); + document.addEventListener('CrystalDocs:searchDebounceStopped', function(event){ + performingSearch = false; + }); + + function delayWhileSearching(callback) { + if(performingSearch){ + document.addEventListener('CrystalDocs:searchPerformed', function listener(){ + document.removeEventListener('CrystalDocs:searchPerformed', listener); + + // add some delay to let search results display kick in + setTimeout(callback, 100); + }); + }else{ + callback(); + } + } + + function clearMoveTimeout() { + clearTimeout(self.moveTimeout); + self.moveTimeout = null; + } + + function startMoveTimeout(upwards){ + /*if(self.moveTimeout) { + clearMoveTimeout(); + } + + var go = function() { + if (!self.moveTimeout) return; + self.move(upwards); + self.moveTimeout = setTimeout(go, 600); + }; + self.moveTimeout = setTimeout(go, 800);*/ + } + + function scrollCenter(element) { + var rect = element.getBoundingClientRect(); + var middle = sidebar.clientHeight / 2; + sidebar.scrollTop += rect.top + rect.height / 2 - middle; + } + + var move = this.move = function(upwards){ + if(!this.current){ + this.highlightFirst(); + return true; + } + var next = upwards ? this.current.previousElementSibling : this.current.nextElementSibling; + if(next && next.classList) { + this.highlight(next); + scrollCenter(next); + return true; + } + return false; + }; + + this.moveRight = function(){ + }; + this.moveLeft = function(){ + }; + + this.highlight = function(elem) { + if(!elem){ + return; + } + this.removeHighlight(); + + this.current = elem; + this.current.classList.add("current"); + }; + + this.highlightFirst = function(){ + this.highlight(this.list.querySelector('li:first-child')); + }; + + this.removeHighlight = function() { + if(this.current){ + this.current.classList.remove("current"); + } + this.current = null; + } + + this.openSelectedResult = function() { + if(this.current) { + this.current.click(); + } + } + + this.focus = function() { + searchInput.focus(); + searchInput.select(); + this.highlightFirst(); + } + + function handleKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + case "i": + case "j": + case "k": + case "l": + case "c": + case "h": + case "t": + case "n": + event.stopPropagation(); + clearMoveTimeout(); + } + } + + function handleKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + self.openSelectedResult(); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + break; + case "j": + case "c": + case "ArrowUp": + if(event.ctrlKey || event.key == "ArrowUp") { + event.stopPropagation(); + self.move(true); + startMoveTimeout(true); + } + break; + case "k": + case "h": + case "ArrowDown": + if(event.ctrlKey || event.key == "ArrowDown") { + event.stopPropagation(); + self.move(false); + startMoveTimeout(false); + } + break; + case "k": + case "t": + case "ArrowLeft": + if(event.ctrlKey || event.key == "ArrowLeft") { + event.stopPropagation(); + self.moveLeft(); + } + break; + case "l": + case "n": + case "ArrowRight": + if(event.ctrlKey || event.key == "ArrowRight") { + event.stopPropagation(); + self.moveRight(); + } + break; + } + } + + function handleInputKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + clearMoveTimeout(); + } + } + + function handleInputKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + delayWhileSearching(function(){ + self.openSelectedResult(); + leaveSearchScope(); + }); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + // remove focus from search input + leaveSearchScope(); + sidebar.focus(); + break; + case "ArrowUp": + event.stopPropagation(); + event.preventDefault(); + self.move(true); + startMoveTimeout(true); + break; + + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + self.move(false); + startMoveTimeout(false); + break; + } + } + + sidebar.tabIndex = 100; // set tabIndex to enable keylistener + sidebar.addEventListener('keyup', function(event) { + handleKeyUp(event); + }); + sidebar.addEventListener('keydown', function(event) { + handleKeyDown(event); + }); + searchInput.addEventListener('keydown', function(event) { + handleInputKeyDown(event); + }); + searchInput.addEventListener('keyup', function(event) { + handleInputKeyUp(event); + }); + this.move(); +}; + +CrystalDocs.initializeVersions = function () { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function parseJSON(json) { + CrystalDocs.loadConfig(JSON.parse(json)); + } + + $elem = document.querySelector("html > head > meta[name=\"crystal_docs.json_config_url\"]") + if ($elem == undefined) { + return + } + jsonURL = $elem.getAttribute("content") + if (jsonURL && jsonURL != "") { + loadJSON(jsonURL, parseJSON); + } +} + +CrystalDocs.loadConfig = function (config) { + var projectVersions = config["versions"] + var currentVersion = document.querySelector("html > head > meta[name=\"crystal_docs.project_version\"]").getAttribute("content") + + var currentVersionInList = projectVersions.find(function (element) { + return element.name == currentVersion + }) + + if (!currentVersionInList) { + projectVersions.unshift({ name: currentVersion, url: '#' }) + } + + $version = document.querySelector(".project-summary > .project-version") + $version.innerHTML = "" + + $select = document.createElement("select") + $select.classList.add("project-versions-nav") + $select.addEventListener("change", function () { + window.location.href = this.value + }) + projectVersions.forEach(function (version) { + $item = document.createElement("option") + $item.setAttribute("value", version.url) + $item.append(document.createTextNode(version.name)) + + if (version.name == currentVersion) { + $item.setAttribute("selected", true) + $item.setAttribute("disabled", true) + } + $select.append($item) + }); + $form = document.createElement("form") + $form.setAttribute("autocomplete", "off") + $form.append($select) + $version.append($form) +} + +document.addEventListener("DOMContentLoaded", function () { + CrystalDocs.initializeVersions() +}) + +var UsageModal = function(title, content) { + var $body = document.body; + var self = this; + var $modalBackground = document.createElement("div"); + $modalBackground.classList.add("modal-background"); + var $usageModal = document.createElement("div"); + $usageModal.classList.add("usage-modal"); + $modalBackground.appendChild($usageModal); + var $title = document.createElement("h3"); + $title.classList.add("modal-title"); + $title.innerHTML = title + $usageModal.appendChild($title); + var $closeButton = document.createElement("span"); + $closeButton.classList.add("close-button"); + $closeButton.setAttribute("title", "Close modal"); + $closeButton.innerText = '×'; + $usageModal.appendChild($closeButton); + $usageModal.insertAdjacentHTML("beforeend", content); + + $modalBackground.addEventListener('click', function(event) { + var element = event.target || event.srcElement; + + if(element == $modalBackground) { + self.hide(); + } + }); + $closeButton.addEventListener('click', function(event) { + self.hide(); + }); + + $body.insertAdjacentElement('beforeend', $modalBackground); + + this.show = function(){ + $body.classList.add("js-modal-visible"); + }; + this.hide = function(){ + $body.classList.remove("js-modal-visible"); + }; + this.isVisible = function(){ + return $body.classList.contains("js-modal-visible"); + } +} + + +document.addEventListener('DOMContentLoaded', function() { + var sessionStorage; + try { + sessionStorage = window.sessionStorage; + } catch (e) { } + if(!sessionStorage) { + sessionStorage = { + setItem: function() {}, + getItem: function() {}, + removeItem: function() {} + }; + } + + var repositoryName = document.querySelector('[name=repository-name]').getAttribute('content'); + var typesList = document.querySelector('.types-list'); + var searchInput = document.querySelector('.search-input'); + var parents = document.querySelectorAll('.types-list li.parent'); + + var scrollSidebarToOpenType = function(){ + var openTypes = typesList.querySelectorAll('.current'); + if (openTypes.length > 0) { + var lastOpenType = openTypes[openTypes.length - 1]; + lastOpenType.scrollIntoView(!(window.matchMedia('only screen and (max-width: 635px)')).matches); + } + } + + scrollSidebarToOpenType(); + + var setPersistentSearchQuery = function(value){ + sessionStorage.setItem(repositoryName + '::search-input:value', value); + } + + for(var i = 0; i < parents.length; i++) { + var _parent = parents[i]; + _parent.addEventListener('click', function(e) { + e.stopPropagation(); + + if(e.target.tagName.toLowerCase() == 'li') { + if(e.target.className.match(/open/)) { + sessionStorage.removeItem(e.target.getAttribute('data-id')); + e.target.className = e.target.className.replace(/ +open/g, ''); + } else { + sessionStorage.setItem(e.target.getAttribute('data-id'), '1'); + if(e.target.className.indexOf('open') == -1) { + e.target.className += ' open'; + } + } + } + }); + + if(sessionStorage.getItem(_parent.getAttribute('data-id')) == '1') { + _parent.className += ' open'; + } + } + + var leaveSearchScope = function(){ + CrystalDocs.toggleResultsList(false); + window.focus(); + } + + var navigator = new Navigator(document.querySelector('.types-list'), searchInput, document.querySelector(".search-results"), leaveSearchScope); + + CrystalDocs.loadIndex(); + var searchTimeout; + var lastSearchText = false; + var performSearch = function() { + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStarted")); + + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function() { + var text = searchInput.value; + + if(text == "") { + CrystalDocs.toggleResultsList(false); + }else if(text == lastSearchText){ + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStopped")); + }else{ + CrystalDocs.search(text); + navigator.highlightFirst(); + searchInput.focus(); + } + lastSearchText = text; + setPersistentSearchQuery(text); + }, 200); + }; + + if(location.hash.length > 3 && location.hash.substring(0,3) == "#q="){ + // allows directly linking a search query which is then executed on the client + // this comes handy for establishing a custom browser search engine with https://crystal-lang.org/api/#q=%s as a search URL + // TODO: Add OpenSearch description + var searchQuery = location.hash.substring(3); + history.pushState({searchQuery: searchQuery}, "Search for " + searchQuery, location.href.replace(/#q=.*/, "")); + searchInput.value = decodeURIComponent(searchQuery); + document.addEventListener('CrystalDocs:loaded', performSearch); + } + + if (searchInput.value.length == 0) { + var searchText = sessionStorage.getItem(repositoryName + '::search-input:value'); + if(searchText){ + searchInput.value = searchText; + } + } + searchInput.addEventListener('keyup', performSearch); + searchInput.addEventListener('input', performSearch); + + var usageModal = new UsageModal('Keyboard Shortcuts', '' + + '
    ' + + '
  • ' + + ' ' + + ' s,' + + ' /' + + ' ' + + ' Search' + + '
  • ' + + '
  • ' + + ' Esc' + + ' Abort search / Close modal' + + '
  • ' + + '
  • ' + + ' ' + + ' ⇨,' + + ' Enter' + + ' ' + + ' Open highlighted result' + + '
  • ' + + '
  • ' + + ' ' + + ' ⇧,' + + ' Ctrl+j' + + ' ' + + ' Select previous result' + + '
  • ' + + '
  • ' + + ' ' + + ' ⇩,' + + ' Ctrl+k' + + ' ' + + ' Select next result' + + '
  • ' + + '
  • ' + + ' ?' + + ' Show usage info' + + '
  • ' + + '
' + ); + + function handleShortkeys(event) { + var element = event.target || event.srcElement; + + if(element.tagName == "INPUT" || element.tagName == "TEXTAREA" || element.parentElement.tagName == "TEXTAREA"){ + return; + } + + switch(event.key) { + case "?": + usageModal.show(); + break; + + case "Escape": + usageModal.hide(); + break; + + case "s": + case "/": + if(usageModal.isVisible()) { + return; + } + event.stopPropagation(); + navigator.focus(); + performSearch(); + break; + } + } + + document.addEventListener('keyup', handleShortkeys); + + var scrollToEntryFromLocationHash = function() { + var hash = window.location.hash; + if (hash) { + var targetAnchor = decodeURI(hash.substr(1)); + var targetEl = document.getElementById(targetAnchor) + if (targetEl) { + targetEl.offsetParent.scrollTop = targetEl.offsetTop; + } + } + }; + window.addEventListener("hashchange", scrollToEntryFromLocationHash, false); + scrollToEntryFromLocationHash(); +}); diff --git a/search-index.js b/search-index.js new file mode 100644 index 00000000..776d9f5c --- /dev/null +++ b/search-index.js @@ -0,0 +1 @@ +crystal_doc_search_index_callback({"repository_name":"crest","body":"# \n

\"crest\"

\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/16e439ef2706472988306ef13da91a51)](https://app.codacy.com/app/mamantoha/crest?utm_source=github.com&utm_medium=referral&utm_content=mamantoha/crest&utm_campaign=Badge_Grade_Dashboard)\n![Crystal CI](https://github.com/mamantoha/crest/workflows/Crystal%20CI/badge.svg)\n[![GitHub release](https://img.shields.io/github/release/mamantoha/crest.svg)](https://github.com/mamantoha/crest/releases)\n[![Commits Since Last Release](https://img.shields.io/github/commits-since/mamantoha/crest/latest.svg)](https://github.com/mamantoha/crest/pulse)\n[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://mamantoha.github.io/crest/)\n[![License](https://img.shields.io/github/license/mamantoha/crest.svg)](https://github.com/mamantoha/crest/blob/master/LICENSE)\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)\n\n\n\n[![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fmamantoha%2Fcrest&countColor=%23263759&style=plastic)](https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Fmamantoha%2Fcrest)\n\nHTTP and REST client for Crystal, inspired by the Ruby's RestClient gem.\n\nBeloved features:\n\n- Redirects support.\n- HTTP(S) proxy support.\n- Elegant Key/Value headers, cookies, query params, and form data.\n- Multipart file uploads.\n- JSON request with the appropriate HTTP headers.\n- Streaming requests.\n- International Domain Names.\n- Digest access authentication.\n- Logging.\n\nHopefully, someday I can remove this shard though. Ideally, Crystal's standard library would do all this already.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n crest:\n github: mamantoha/crest\n```\n\n## Usage\n\n```crystal\nrequire \"crest\"\n```\n\nBasic usage:\n\n```crystal\nCrest.get(\n \"http://httpbin.org/get\",\n params: {:lang => \"en\"},\n user_agent: \"Mozilla/5.0\"\n)\n# curl -L http://httpbin.org/get?lang=en -H 'User-Agent: Mozilla/5.0'\n\nCrest.post(\n \"http://httpbin.org/post\",\n {:age => 27, :name => {:first => \"Kurt\", :last => \"Cobain\"}}\n)\n# curl -L --data \"age=27&name[first]=Kurt&name[last]=Cobain\" -X POST \"http://httpbin.org/post\"\n\nCrest.post(\n \"http://httpbin.org/post\",\n {\"file\" => File.open(\"avatar.png\"), \"name\" => \"John\"}\n)\n# curl -X POST http://httpbin.org/post -F 'file=@/path/to/avatar.png' -F 'name=John' -H 'Content-Type: multipart/form-data'\n\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {:age => 27, :name => {:first => \"Kurt\", :last => \"Cobain\"}},\n json: true\n)\n# curl -X POST http://httpbin.org/post -d '{\"age\":27,\"name\":{\"first\":\"Kurt\",\"last\":\"Cobain\"}}' -H 'Content-Type: application/json'\n```\n\n### Request\n\n`Crest::Request` accept next parameters:\n\nMandatory parameters:\n\n- `:method` - HTTP method (`:get`. `:post`, `:put`, `:patch`, `:delete`, `:options`, `head`)\n- `:url` - URL (e.g.: `http://httpbin.org/ip`)\n\nOptional parameters:\n\n- `:form` - a hash containing form data (or a raw string or IO or Bytes)\n- `:headers` - a hash containing the request headers\n- `:cookies` - a hash containing the request cookies\n- `:params` - a hash that represent query params (or a raw string) - a string separated from the preceding part by a question mark (`?`) and a sequence of attribute–value pairs separated by a delimiter (`&`)\n- `:params_encoder` params encoder (default to `Crest::FlatParamsEncoder`)\n- `:auth` - access authentication method `basic` or `digest` (default to `basic`)\n- `:user` and `:password` - for authentication\n- `:tls` - client certificates, you can pass in a custom `OpenSSL::SSL::Context::Client` (default to `nil`)\n- `:p_addr`, `:p_port`, `:p_user`, and `:p_pass` - specify a per-request proxy by passing these parameters\n- `:json` - make a JSON request with the appropriate HTTP headers (default to `false`)\n- `:multipart` make a multipart request with the appropriate HTTP headers even if not sending a file (default to `false`)\n- `:user_agent` - set \"User-Agent\" HTTP header (default to `Crest::USER_AGENT`)\n- `:max_redirects` - maximum number of redirects (default to 10)\n- `:logging` - enable logging (default to `false`)\n- `:logger` - set logger (default to `Crest::CommonLogger`)\n- `:handle_errors` - error handling (default to `true`)\n- `:close_connection` - close the connection after request is completed (default to `true`)\n- `:http_client` - instance of `HTTP::Client`\n- `:read_timeout` - read timeout (default to `nil`)\n- `:write_timeout` - write timeout (default to `nil`)\n- `:connect_timeout` - connect timeout (default to `nil`)\n\nMore detailed examples:\n\n```crystal\nrequest = Crest::Request.new(:post,\n \"http://httpbin.org/post\",\n headers: {\"Content-Type\" => \"application/json\"},\n form: {:width => 640, \"height\" => \"480\"}\n)\nrequest.execute\n# curl -L --data \"width=640&height=480\" --header \"Content-Type: application/json\" -X POST \"http://httpbin.org/post\"\n```\n\n```crystal\nCrest::Request.execute(:get,\n \"http://httpbin.org/get\",\n params: {:width => 640, \"height\" => \"480\"},\n headers: {\"Content-Type\" => \"application/json\"}\n)\n# curl -L --header \"Content-Type: application/json\" \"http://httpbin.org/get?width=640&height=480\"\n```\n\n```crystal\nCrest::Request.new(:post, \"http://httpbin.org/post\", {:foo => \"bar\"}, json: true)\n\n# curl -X POST http://httpbin.org/post -d '{\\\"foo\\\":\\\"bar\\\"}' -H 'Content-Type: application/json'\"\n```\n\n```crystal\nCrest::Request.get(\n \"http://httpbin.org/get\",\n p_addr: \"127.0.0.1\",\n p_port: 3128,\n p_user: \"admin\",\n p_pass: \"1234\"\n)\n# curl -L --proxy admin:1234@127.0.0.1:3128 \"http://httpbin.org/get\"\n```\n\nA block can be passed to the `Crest::Request` initializer.\n\nThis block will then be called with the `Crest::Request`.\n\n```crystal\nrequest = Crest::Request.new(:get, \"http://httpbin.org/headers\") do |request|\n request.headers.add(\"foo\", \"bar\")\nend\n\nrequest.execute\n# curl -L --header \"foo: bar\" http://httpbin.org/headers\n```\n\n### Resource\n\nA `Crest::Resource` class can be instantiated for access to a RESTful resource,\nincluding authentication, proxy and logging.\n\nAdditionally, you can set default `params`, `headers`, and `cookies` separately.\nSo you can use `Crest::Resource` to share common `params`, `headers`, and `cookies`.\n\nThe final parameters consist of:\n\n- default parameters from initializer\n- parameters provided in call method (`get`, `post`, etc)\n\nThis is especially useful if you wish to define your site in one place and\ncall it in multiple locations.\n\n```crystal\nresource = Crest::Resource.new(\n \"http://httpbin.org\",\n params: {\"key\" => \"value\"},\n headers: {\"Content-Type\" => \"application/json\"},\n cookies: {\"lang\" => \"uk\"}\n)\n\nresource[\"/get\"].get(\n headers: {\"Auth-Token\" => \"secret\"}\n)\n\nresource[\"/post\"].post(\n {:height => 100, \"width\" => \"100\"},\n params: {:secret => \"secret\"}\n)\n```\n\nUse the `[]` syntax to allocate subresources:\n\n```crystal\nsite = Crest::Resource.new(\"http://httpbin.org\")\n\nsite[\"/post\"].post({:param1 => \"value1\", :param2 => \"value2\"})\n# curl -L --data \"param1=value1¶m2=value2\" -X POST http://httpbin.org/post\n```\n\nYou can pass `suburl` through `Request#http_verb` methods:\n\n```crystal\nsite = Crest::Resource.new(\"http://httpbin.org\")\n\nsite.post(\"/post\", {:param1 => \"value1\", :param2 => \"value2\"})\n# curl -L --data \"param1=value1¶m2=value2\" -X POST http://httpbin.org/post\n\nsite.get(\"/get\", params: {:status => \"active\"})\n# curl -L http://httpbin.org/get?status=active\n```\n\nA block can be passed to the `Crest::Resource` instance.\n\nThis block will then be called with the `Crest::Resource`.\n\n```crystal\nresource = Crest::Resource.new(\"http://httpbin.org\") do |resource|\n resource.headers.merge!({\"foo\" => \"bar\"})\nend\n\nresource[\"/headers\"].get\n```\n\nWith HTTP basic authentication:\n\n```crystal\nresource = Crest::Resource.new(\n \"http://httpbin.org/basic-auth/user/passwd\",\n user: \"user\",\n password: \"passwd\"\n)\n```\n\nWith Proxy:\n\n```crystal\nresource = Crest::Resource.new(\n \"http://httpbin.org/get\",\n p_addr: \"localhost\",\n p_port: 3128\n)\n```\n\n### Result handling\n\nThe result of a `Crest::Request` and `Crest::Resource` is a `Crest::Response` object.\n\nResponse objects have several useful methods:\n\n- `Response#body`: The response body as a `String`\n- `Response#body_io`: The response body as a `IO`\n- `Response#status`: The response status as a `HTTP::Status`\n- `Response#status_code`: The HTTP response code\n- `Response#headers`: A hash of HTTP response headers\n- `Response#cookies`: A hash of HTTP cookies set by the server\n- `Response#request`: The `Crest::Request` object used to make the request\n- `Response#http_client_res`: The `HTTP::Client::Response` object\n- `Response#history`: A list of each response received in a redirection chain\n\n### Exceptions\n\n- for status codes between `200` and `207`, a `Crest::Response` will be returned\n- for status codes `301`, `302`, `303` or `307`, the redirection will be followed and the request transformed into a `GET`\n- for other cases, a `Crest::RequestFailed` holding the `Crest::Response` will be raised\n- call `.response` on the exception to get the server's response\n\n```crystal\nCrest.get(\"http://httpbin.org/status/404\")\n# => HTTP status code 404: Not Found (Crest::NotFound)\n\nbegin\n Crest.get(\"http://httpbin.org/status/404\")\nrescue ex : Crest::NotFound\n puts ex.response\nend\n```\n\nTo not raise exceptions but return the `Crest::Response` you can set `handle_errors` to `false`.\n\n```crystal\nresponse = Crest.get(\"http://httpbin.org/status/404\", handle_errors: false) do |resp|\n case resp\n when .success?\n puts resp.body_io.gets_to_end\n when .client_error?\n puts \"Client error\"\n when .server_error?\n puts \"Server error\"\n end\nend\n# => Client error\n\nresponse.status_code # => 404\n```\n\nBut note that it may be more straightforward to use exceptions to handle different HTTP error response cases:\n\n```crystal\nresponse = begin\n Crest.get(\"http://httpbin.org/status/404\")\nrescue ex : Crest::NotFound\n puts \"Not found\"\n ex.response\nrescue ex : Crest::InternalServerError\n puts \"Internal server error\"\n ex.response\nend\n# => Not found\n\nresponse.status_code # => 404\n```\n\n### Parameters serializer\n\n`Crest::ParamsEncoder` class is used to encode parameters.\n\nThe encoder affect both how `crest` processes query strings and how it serializes POST bodies.\n\nThe default encoder is `Crest::FlatParamsEncoder`.\n\nIt provides `#encode` method, which converts the given params into a URI query string:\n\n```crystal\nCrest::FlatParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a[]=one&a[]=two&a[]=three&b=true&c=C&d=1'\n```\n\n### Custom parameters serializers\n\nYou can build a custom params encoder.\n\nThe value of Crest `params_encoder` can be any subclass of `Crest::ParamsEncoder` that implement `#encode(Hash) #=> String`\n\nAlso Crest include other encoders.\n\n#### `Crest::NestedParamsEncoder`\n\n```crystal\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]},\n params_encoder: Crest::NestedParamsEncoder\n)\n\n# => curl -X POST http://httpbin.org/post -d 'size=small&topping=bacon&topping=onion' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n#### `Crest::EnumeratedFlatParamsEncoder`\n\n```crystal\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]},\n params_encoder: Crest::EnumeratedFlatParamsEncoder\n)\n\n# => curl -X POST http://httpbin.org/post -d 'size=small&topping[1]=bacon&topping[2]=onion' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n#### `Crest::ZeroEnumeratedFlatParamsEncoder`\n\n```crystal\nresponse = Crest.post(\n \"http://httpbin.org/post\",\n {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]},\n params_encoder: Crest::ZeroEnumeratedFlatParamsEncoder\n)\n\n# => curl -X POST http://httpbin.org/post -d 'size=small&topping[0]=bacon&topping[1]=onion' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n### Streaming responses\n\nNormally, when you use `Crest`, `Crest::Request` or `Crest::Resource` methods to retrieve data, the entire response is buffered in memory and returned as the response to the call.\n\nHowever, if you are retrieving a large amount of data, for example, an iso, or any other large file, you may want to stream the response directly to disk rather than loading it into memory. If you have a very large file, it may become impossible to load it into memory.\n\nIf you want to stream the data from the response to a file as it comes, rather than entirely in memory, you can pass a block to which you pass a additional logic, which you can use to stream directly to a file as each chunk is received.\n\nWith a block, an `Crest::Response` body is returned and the response's body is available as an `IO` by invoking `Crest::Response#body_io`.\n\nThe following is an example:\n\n```crystal\nCrest.get(\"https://github.com/crystal-lang/crystal/archive/1.0.0.zip\") do |resp|\n filename = resp.filename || \"crystal.zip\"\n\n File.open(filename, \"w\") do |file|\n IO.copy(resp.body_io, file)\n end\nend\n```\n\n### Advanced Usage\n\nThis section covers some of `crest` more advanced features.\n\n#### Multipart\n\nYeah, that's right! This does multipart sends for you!\n\n```crystal\nfile = File.open(\"#{__DIR__}/example.png\")\nCrest.post(\"http://httpbin.org/post\", {:image => file})\n```\n\n```crystal\nfile_content = \"id,name\\n1,test\"\nfile = IO::Memory.new(file_content)\nCrest.post(\"http://httpbin.org/post\", {\"data.csv\" => file})\n```\n\n```crystal\nfile = File.open(\"#{__DIR__}/example.png\")\nresource = Crest::Resource.new(\"https://httpbin.org\")\nresponse = resource[\"/post\"].post({:image => file})\n```\n\n#### JSON payload\n\n`crest` speaks JSON natively by passing `json: true` argument to `crest`.\n\n```crystal\nCrest.post(\"http://httpbin.org/post\", {:foo => \"bar\"}, json: true)\n```\n\nAs well you can serialize your _form_ to a string by itself before passing it to `crest`.\n\n```crystal\nCrest.post(\n \"http://httpbin.org/post\",\n {:foo => \"bar\"}.to_json\n headers: {\"Accept\" => \"application/json\", \"Content-Type\" => \"application/json\"},\n)\n```\n\n#### Headers\n\nRequest headers can be set by passing a hash containing keys and values representing header names and values:\n\n```crystal\nresponse = Crest.get(\n \"http://httpbin.org/bearer\",\n headers: {\"Authorization\" => \"Bearer cT0febFoD5lxAlNAXHo6g\"}\n)\nresponse.headers\n# => {\"Authorization\" => [\"Bearer cT0febFoD5lxAlNAXHo6g\"]}\n```\n\n#### Cookies\n\n`Request` and `Response` objects know about HTTP cookies, and will automatically extract and set headers for them as needed:\n\n```crystal\nresponse = Crest.get(\n \"http://httpbin.org/cookies/set\",\n params: {\"k1\" => \"v1\", \"k2\" => \"v2\"}\n)\nresponse.cookies\n# => {\"k1\" => \"v1\", \"k2\" => \"v2\"}\n```\n\n```crystal\nresponse = Crest.get(\n \"http://httpbin.org/cookies\",\n cookies: {\"k1\" => \"v1\", \"k2\" => {\"kk2\" => \"vv2\"}}\n)\nresponse.cookies\n# => {\"k1\" => \"v1\", \"k2[kk2]\" => \"vv2\"}\n```\n\n#### Basic access authentication\n\nFor basic access authentication for an HTTP user agent you should to provide a `user` name and `password` when making a request.\n\n```crystal\nCrest.get(\n \"http://httpbin.org/basic-auth/user/passwd\",\n user: \"user\",\n password: \"passwd\"\n)\n# curl -L --user user:passwd http://httpbin.org/basic-auth/user/passwd\n```\n\n#### Digest access authentication\n\nFor digest access authentication for an HTTP user agent you should to provide a `user` name and `password` when making a request.\n\n```crystal\nCrest.get(\n \"https://httpbin.org/digest-auth/auth/user/passwd/MD5\",\n auth: \"digest\",\n user: \"user\",\n password: \"passwd\"\n)\n# curl -L --digest --user user:passwd https://httpbin.org/digest-auth/auth/user/passwd/MD5\n```\n\n#### SSL/TLS support\n\nIf `tls` is given it will be used:\n\n```crystal\nCrest.get(\"https://expired.badssl.com\", tls: OpenSSL::SSL::Context::Client.insecure)\n```\n\n#### Proxy\n\nIf you need to use a proxy, you can configure individual requests with the proxy host and port arguments to any request method:\n\n```crystal\nCrest.get(\n \"http://httpbin.org/ip\",\n p_addr: \"localhost\",\n p_port: 3128\n)\n```\n\nTo use authentication with your proxy, use next syntax:\n\n```crystal\nCrest.get(\n \"http://httpbin.org/ip\",\n p_addr: \"localhost\",\n p_port: 3128,\n p_user: \"user\",\n p_pass: \"qwerty\"\n)\n```\n\n#### Logging\n\n> `Logger` class is completely taken from [halite](https://github.com/icyleaf/halite) shard.\n> Thanks [icyleaf](https://github.com/icyleaf)!\n\nBy default, the `Crest` does not enable logging. You can enable it per request by setting `logging: true`:\n\n```crystal\nCrest.get(\"http://httpbin.org/get\", logging: true)\n```\n\n##### Filter sensitive information from logs with a regex matcher\n\n```crystal\nresource = Crest::Request.get(\"http://httpbin.org/get\", params: {api_key => \"secret\"}, logging: true) do |request|\n request.logger.filter(/(api_key=)(\\w+)/, \"\\\\1[REMOVED]\")\nend\n\n# => crest | 2018-07-04 14:49:49 | GET | http://httpbin.org/get?api_key=[REMOVED]\n```\n\n##### Customize logger\n\nYou can create the custom logger by integration `Crest::Logger` abstract class.\nHere has two methods must be implement: `Crest::Logger.request` and `Crest::Logger.response`.\n\n```crystal\nclass MyLogger < Crest::Logger\n def request(request)\n @logger.info { \">> | %s | %s\" % [request.method, request.url] }\n end\n\n def response(response)\n @logger.info { \"<< | %s | %s\" % [response.status_code, response.url] }\n end\nend\n\nCrest.get(\"http://httpbin.org/get\", logging: true, logger: MyLogger.new)\n```\n\n#### Redirection\n\nBy default, `crest` will follow HTTP 30x redirection requests.\n\nTo disable automatic redirection, set `:max_redirects => 0`.\n\n```crystal\nCrest::Request.execute(method: :get, url: \"http://httpbin.org/redirect/1\", max_redirects: 0)\n# => Crest::Found: 302 Found\n```\n\n#### Access HTTP::Client\n\nYou can access `HTTP::Client` via the `http_client` instance method.\n\nThis is usually used to set additional options (e.g. read timeout, authorization header etc.)\n\n```crystal\nclient = HTTP::Client.new(\"httpbin.org\")\nclient.read_timeout = 1.second\n\nbegin\n Crest::Request.new(:get,\n \"http://httpbin.org/delay/10\",\n http_client: client\n )\nrescue IO::TimeoutError\n puts \"Timeout!\"\nend\n```\n\n```crystal\nclient = HTTP::Client.new(\"httpbin.org\")\nclient.read_timeout = 1.second\n\nbegin\n resource = Crest::Resource.new(\"http://httpbin.org\", http_client: client)\n resource.get(\"/delay/10\")\nrescue IO::TimeoutError\n puts \"Timeout!\"\nend\n```\n\n#### Convert Request object to cURL command\n\nUse `to_curl` method on instance of `Crest::Request` to convert request to cURL command.\n\n```crystal\nrequest = Crest::Request.new(\n :post,\n \"http://httpbin.org/post\",\n {\"title\" => \"New Title\", \"author\" => \"admin\"}\n)\nrequest.to_curl\n# => curl -X POST http://httpbin.org/post -d 'title=New+Title&author=admin' -H 'Content-Type: application/x-www-form-urlencoded'\n```\n\n```crystal\nrequest = Crest::Request.new(\n :get,\n \"http://httpbin.org/basic-auth/user/passwd\",\n user: \"user\",\n password: \"passwd\"\n)\nrequest.to_curl\n# => curl -X GET http://httpbin.org/basic-auth/user/passwd --user user:passwd\n```\n\nAlso you can directly use `Crest::Curlify` which accept instance of `Crest::Request`\n\n```crystal\nrequest = Crest::Request.new(:get, \"http://httpbin.org\")\nCrest::Curlify.new(request).to_curl\n# => curl -X GET http://httpbin.org\n```\n\n#### Params decoder\n\n`Crest::ParamsDecoder` is a module for decoding query-string into parameters.\n\n```crystal\nquery = \"size=small&topping[1]=bacon&topping[2]=onion\"\nCrest::ParamsDecoder.decode(query)\n# => {\"size\" => \"small\", \"topping\" => [\"bacon\", \"onion\"]}\n```\n\n## Development\n\nInstall dependencies:\n\n```console\nshards\n```\n\nTo run test:\n\n```console\ncrystal spec\n```\n\n### Workbook\n\n```console\ncrystal play\nopen http://localhost:8080\n```\n\nThen select the Workbook -> Requests from the menu.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n\n\n\n\n \n \n \n \n \n \n \n \n
\"Anton
Anton Maminov

💻
\"Chao
Chao Yang

💻
\"psikoz\"/
psikoz

🎨
\"jphaward\"/
jphaward

💻
\n\n\n\n\n\n\n\n\n\n\n\n\n\n## License\n\nCopyright: 2017-2024 Anton Maminov (anton.maminov@gmail.com)\n\nThis library is distributed under the MIT license. Please see the LICENSE file.\n","program":{"html_id":"crest/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"crest","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"crest/Crest","path":"Crest.html","kind":"module","full_name":"Crest","name":"Crest","abstract":false,"locations":[{"filename":"src/crest.cr","line_number":38,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L38"},{"filename":"src/crest/curlify.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L1"},{"filename":"src/crest/exceptions.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L3"},{"filename":"src/crest/form.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L1"},{"filename":"src/crest/forms/data_form.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L3"},{"filename":"src/crest/forms/json_form.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/json_form.cr#L3"},{"filename":"src/crest/forms/urlencoded_form.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L3"},{"filename":"src/crest/logger.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L3"},{"filename":"src/crest/loggers/common_logger.cr","line_number":8,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L8"},{"filename":"src/crest/params_decoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L1"},{"filename":"src/crest/params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L1"},{"filename":"src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr#L1"},{"filename":"src/crest/redirector.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L1"},{"filename":"src/crest/request.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L3"},{"filename":"src/crest/resource.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L3"},{"filename":"src/crest/response.cr","line_number":5,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L5"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"EXCEPTIONS_MAP","name":"EXCEPTIONS_MAP","value":"{} of Int32 => Crest::RequestFailed.class"},{"id":"HTTP_METHODS","name":"HTTP_METHODS","value":"[\"get\", \"delete\", \"post\", \"put\", \"patch\", \"options\", \"head\"] of ::String"},{"id":"STATUSES","name":"STATUSES","value":"{100 => \"Continue\", 101 => \"Switching Protocols\", 102 => \"Processing\", 200 => \"OK\", 201 => \"Created\", 202 => \"Accepted\", 203 => \"Non-Authoritative Information\", 204 => \"No Content\", 205 => \"Reset Content\", 206 => \"Partial Content\", 207 => \"Multi-Status\", 208 => \"Already Reported\", 226 => \"IM Used\", 300 => \"Multiple Choices\", 301 => \"Moved Permanently\", 302 => \"Found\", 303 => \"See Other\", 304 => \"Not Modified\", 305 => \"Use Proxy\", 306 => \"Switch Proxy\", 307 => \"Temporary Redirect\", 308 => \"Permanent Redirect\", 400 => \"Bad Request\", 401 => \"Unauthorized\", 402 => \"Payment Required\", 403 => \"Forbidden\", 404 => \"Not Found\", 405 => \"Method Not Allowed\", 406 => \"Not Acceptable\", 407 => \"Proxy Authentication Required\", 408 => \"Request Timeout\", 409 => \"Conflict\", 410 => \"Gone\", 411 => \"Length Required\", 412 => \"Precondition Failed\", 413 => \"Payload Too Large\", 414 => \"URI Too Long\", 415 => \"Unsupported Media Type\", 416 => \"Range Not Satisfiable\", 417 => \"Expectation Failed\", 418 => \"I\\\"m A Teapot\", 421 => \"Too Many Connections From This IP\", 422 => \"Unprocessable Entity\", 423 => \"Locked\", 424 => \"Failed Dependency\", 425 => \"Unordered Collection\", 426 => \"Upgrade Required\", 428 => \"Precondition Required\", 429 => \"Too Many Requests\", 431 => \"Request Header Fields Too Large\", 449 => \"Retry With\", 450 => \"Blocked By Windows Parental Controls\", 500 => \"Internal Server Error\", 501 => \"Not Implemented\", 502 => \"Bad Gateway\", 503 => \"Service Unavailable\", 504 => \"Gateway Timeout\", 505 => \"HTTP Version Not Supported\", 506 => \"Variant Also Negotiates\", 507 => \"Insufficient Storage\", 508 => \"Loop Detected\", 509 => \"Bandwidth Limit Exceeded\", 510 => \"Not Extended\", 511 => \"Network Authentication Required\"}","doc":"Hash of HTTP status code => message.","summary":"

Hash of HTTP status code => message.

"},{"id":"USER_AGENT","name":"USER_AGENT","value":"\"Crest/#{Crest::VERSION} (Crystal/#{Crystal::VERSION})\""},{"id":"VERSION","name":"VERSION","value":"{{ (`shards version /home/runner/work/crest/crest/src`).chomp.stringify }}"}],"doc":"This module's static methods are the entry point for using the Crest client.\n\nSupported HTTP methods: `get`, `put`, `post`, `patch` `delete`, `options`, `head`\n\nExamples:\n\n```\nCrest.get(\n \"http://httpbin.org/get\",\n headers: {\"Content-Type\" => \"image/jpg\"},\n params: {\"lang\" => \"en\"}\n)\n\nCrest.post(\n \"http://httpbin.org/post\",\n headers: {\"Access-Token\" => [\"secret1\", \"secret2\"]},\n form: {\"fizz\" => \"buz\"},\n logging: true,\n)\n\nCrest.get(\"http://httpbin.org/stream/5\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

This module's static methods are the entry point for using the Crest client.

","class_methods":[{"html_id":"delete(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.\n\n```\nCrest.delete(\"http://httpbin.org/delete\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"delete(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.\n\n```\nCrest.delete(\"http://httpbin.org/delete\")\n```","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nrequest.execute\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.\n\n```\nCrest.get(\"http://httpbin.org/get\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.\n\n```\nCrest.get(\"http://httpbin.org/get\")\n```","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nrequest.execute\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.\n\n```\nCrest.head(\"http://httpbin.org/head\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.\n\n```\nCrest.head(\"http://httpbin.org/head\")\n```","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nrequest.execute\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.\n\n```\nCrest.options(\"http://httpbin.org/options\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.\n\n```\nCrest.options(\"http://httpbin.org/options\")\n```","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nrequest.execute\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.\n\n```\nCrest.patch(\"http://httpbin.org/patch\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.\n\n```\nCrest.patch(\"http://httpbin.org/patch\")\n```","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nrequest.execute\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.\n\n```\nCrest.post(\"http://httpbin.org/post\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.\n\n```\nCrest.post(\"http://httpbin.org/post\")\n```","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nrequest.execute\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.\n\n```\nCrest.put(\"http://httpbin.org/put\") do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.\n\n```\nCrest.put(\"http://httpbin.org/put\")\n```","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L47"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nrequest.execute\n"}}],"types":[{"html_id":"crest/Crest/CommonLogger","path":"Crest/CommonLogger.html","kind":"class","full_name":"Crest::CommonLogger","name":"CommonLogger","abstract":false,"superclass":{"html_id":"crest/Crest/Logger","kind":"class","full_name":"Crest::Logger","name":"Logger"},"ancestors":[{"html_id":"crest/Crest/Logger","kind":"class","full_name":"Crest::Logger","name":"Logger"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/loggers/common_logger.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L9"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"instance_methods":[{"html_id":"request(request:Crest::Request):Nil-instance-method","name":"request","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request) : Nil","args_html":"(request : Crest::Request) : Nil","location":{"filename":"src/crest/loggers/common_logger.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L10"},"def":{"name":"request","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"return_type":"Nil","visibility":"Public","body":"message = String.build do |io|\n (io << \"| \") << (colorful_method(request.method))\n (io << \" | \") << request.url\n if request.form_data.nil?\n else\n (io << \" | \") << request.form_data.to_s.inspect\n end\nend.to_s\ninfo(message)\nmessage\n"}},{"html_id":"response(response:Crest::Response):Nil-instance-method","name":"response","abstract":false,"args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"args_string":"(response : Crest::Response) : Nil","args_html":"(response : Crest::Response) : Nil","location":{"filename":"src/crest/loggers/common_logger.cr","line_number":22,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/loggers/common_logger.cr#L22"},"def":{"name":"response","args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"return_type":"Nil","visibility":"Public","body":"message = String.build do |io|\n (io << \"| \") << (colorful_status_code(response.status_code))\n (io << \" | \") << response.url\n (io << \" | \") << response.body.inspect\nend.to_s\ninfo(message)\nmessage\n"}}]},{"html_id":"crest/Crest/Curlify","path":"Crest/Curlify.html","kind":"class","full_name":"Crest::Curlify","name":"Curlify","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/curlify.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L9"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Class to convert `Crest::Request` object to cURL command\n\n```\nrequest = Crest::Request.new(:post, \"http://httpbin.org/post\", form: {\"title\" => \"New Title\"})\nCrest::Curlify.to_curl(request)\n=> \"curl -X POST http://httpbin.org/post -d 'title=New+Title' -H 'Content-Type: application/x-www-form-urlencoded'\"\n```","summary":"

Class to convert Crest::Request object to cURL command

","class_methods":[{"html_id":"to_curl(request:Crest::Request)-class-method","name":"to_curl","doc":"Returns string with cURL command by provided `Crest::Request` object","summary":"

Returns string with cURL command by provided Crest::Request object

","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request)","args_html":"(request : Crest::Request)","location":{"filename":"src/crest/curlify.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L11"},"def":{"name":"to_curl","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"(new(request)).to_curl"}}],"constructors":[{"html_id":"new(request:Crest::Request)-class-method","name":"new","abstract":false,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request)","args_html":"(request : Crest::Request)","location":{"filename":"src/crest/curlify.cr","line_number":15,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L15"},"def":{"name":"new","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"_ = allocate\n_.initialize(request)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"to_curl-instance-method","name":"to_curl","abstract":false,"location":{"filename":"src/crest/curlify.cr","line_number":18,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/curlify.cr#L18"},"def":{"name":"to_curl","visibility":"Public","body":"[\"curl\", method, url, proxy, basic_auth, form_data, headers].reject(&.empty?).join(\" \")"}}]},{"html_id":"crest/Crest/DataForm","path":"Crest/DataForm.html","kind":"class","full_name":"Crest::DataForm(T)","name":"DataForm","abstract":false,"superclass":{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},"ancestors":[{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/forms/data_form.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L9"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_MIME_TYPE","name":"DEFAULT_MIME_TYPE","value":"\"application/octet-stream\""}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This class lets `crest` emulate a filled-in form\nin which a user has pressed the submit button.\nThis causes `crest` to POST data using the\n\"Content-Type\" `multipart/form-data according` to RFC 2388.\nThis enables uploading of binary files etc.","summary":"

This class lets crest emulate a filled-in form in which a user has pressed the submit button.

","instance_methods":[{"html_id":"generate-instance-method","name":"generate","abstract":false,"location":{"filename":"src/crest/forms/data_form.cr","line_number":12,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L12"},"def":{"name":"generate","visibility":"Public","body":"content_type_ch = Channel(String).new(1)\nio = IO::Memory.new\nHTTP::FormData.build(io) do |formdata|\n content_type_ch.send(formdata.content_type)\n parsed_params.each do |name, value|\n add_field(formdata, name.to_s, value)\n end\nend\n@form_data = io.to_s\n@content_type = content_type_ch.receive\nself\n"}},{"html_id":"parsed_params-instance-method","name":"parsed_params","abstract":false,"location":{"filename":"src/crest/forms/data_form.cr","line_number":32,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/data_form.cr#L32"},"def":{"name":"parsed_params","visibility":"Public","body":"@params_encoder.flatten_params(@params)"}}]},{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","path":"Crest/EnumeratedFlatParamsEncoder.html","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/ZeroEnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::ZeroEnumeratedFlatParamsEncoder","name":"ZeroEnumeratedFlatParamsEncoder"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"array_start_index-class-method","name":"array_start_index","abstract":false,"location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L3"},"def":{"name":"array_start_index","visibility":"Public","body":"@@array_start_index"}},{"html_id":"flatten_params(object:Hash,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"```\nCrest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => \"123\"}})\n# => [{\"key1[key2]\", \"123\"}]\n```","summary":"

Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:key2 => "123"}}) # => [{"key1[key2]", "123"}]

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L21"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_89|\n k, v = __temp_89\n processed_key = parent_key ? \"#{parent_key}[#{k}]\" : k.to_s\n case v\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(v, processed_key))\n else\n memo << {processed_key, v}\n end\nend"}},{"html_id":"flatten_params(object:Array,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"```\nCrest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => [\"1\", \"2\", \"3\"]}})\n# => [{\"key1[arr][1]\", \"1\"}, {\"key1[arr][2]\", \"2\"}, {\"key1[arr][3]\", \"3\"}]\n```","summary":"

Crest::EnumeratedFlatParamsEncoder.flatten_params({:key1 => {:arr => ["1", "2", "3"]}}) # => [{"key1[arr][1]", "1"}, {"key1[arr][2]", "2"}, {"key1[arr][3]", "3"}]

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":38,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L38"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"(object.each_with_index(array_start_index)).reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_90|\n item, index = __temp_90\n processed_key = parent_key ? \"#{parent_key}[#{index}]\" : \"\"\n case item\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(item, processed_key))\n else\n memo << {processed_key, item}\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","doc":"```\nCrest::EnumeratedFlatParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'\n```","summary":"

Crest::EnumeratedFlatParamsEncoder.encode({"a" => ["one", "two", "three"], "b" => true, "c" => "C", "d" => 1}) # => 'a[1]=one&a[2]=two&a[3]=three&b=true&c=C&d=1'

","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoders/enumerated_flat_params_encoder.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/enumerated_flat_params_encoder.cr#L9"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"HTTP::Params.build do |form|\n (self.class.flatten_params(params)).each do |name, value|\n form.add(name.to_s, value.to_s)\n end\nend"}}]},{"html_id":"crest/Crest/FlatParamsEncoder","path":"Crest/FlatParamsEncoder.html","kind":"class","full_name":"Crest::FlatParamsEncoder","name":"FlatParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"flatten_params(object:Hash,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n`parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::FlatParamsEncoder.flatten_params({:key1 => {:key2 => \"123\"}})\n# => [{\"key1[key2]\", \"123\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":26,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L26"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_91|\n k, v = __temp_91\n processed_key = parent_key ? \"#{parent_key}[#{k}]\" : k.to_s\n case v\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(v, processed_key))\n else\n memo << {processed_key, v}\n end\nend"}},{"html_id":"flatten_params(object:Array,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n# `parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::FlatParamsEncoder.flatten_params({:key1 => {:arr => [\"1\", \"2\", \"3\"]}})\n# => [{\"key1[arr][]\", \"1\"}, {\"key1[arr][]\", \"2\"}, {\"key1[arr][]\", \"3\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L47"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, item|\n processed_key = parent_key ? \"#{parent_key}[]\" : \"\"\n case item\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(item, processed_key))\n else\n memo << {processed_key, item}\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","doc":"Converts the given params into a URI query string. Keys and values\nwill converted to strings and appropriately escaped for the URI.\n\n```\nCrest::FlatParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a[]=one&a[]=two&a[]=three&b=true&c=C&d=1'\n```","summary":"

Converts the given params into a URI query string.

","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoders/flat_params_encoder.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/flat_params_encoder.cr#L10"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"HTTP::Params.build do |form|\n (self.class.flatten_params(params)).each do |name, value|\n form.add(name.to_s, value.to_s)\n end\nend"}}]},{"html_id":"crest/Crest/Form","path":"Crest/Form.html","kind":"class","full_name":"Crest::Form(T)","name":"Form","abstract":true,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/form.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/DataForm","kind":"class","full_name":"Crest::DataForm(T)","name":"DataForm"},{"html_id":"crest/Crest/JSONForm","kind":"class","full_name":"Crest::JSONForm(T)","name":"JSONForm"},{"html_id":"crest/Crest/UrlencodedForm","kind":"class","full_name":"Crest::UrlencodedForm(T)","name":"UrlencodedForm"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"generate(params:Hash,params_encoder:Crest::ParamsEncoder.class)-class-method","name":"generate","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"},{"name":"params_encoder","external_name":"params_encoder","restriction":"Crest::ParamsEncoder.class"}],"args_string":"(params : Hash, params_encoder : Crest::ParamsEncoder.class)","args_html":"(params : Hash, params_encoder : Crest::ParamsEncoder.class)","location":{"filename":"src/crest/form.cr","line_number":8,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L8"},"def":{"name":"generate","args":[{"name":"params","external_name":"params","restriction":"Hash"},{"name":"params_encoder","external_name":"params_encoder","restriction":"Crest::ParamsEncoder.class"}],"visibility":"Public","body":"(new(params, params_encoder)).generate"}}],"instance_methods":[{"html_id":"content_type-instance-method","name":"content_type","abstract":false,"location":{"filename":"src/crest/form.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L6"},"def":{"name":"content_type","visibility":"Public","body":"@content_type"}},{"html_id":"form_data-instance-method","name":"form_data","abstract":false,"location":{"filename":"src/crest/form.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L6"},"def":{"name":"form_data","visibility":"Public","body":"@form_data"}},{"html_id":"generate-instance-method","name":"generate","abstract":true,"location":{"filename":"src/crest/form.cr","line_number":15,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L15"},"def":{"name":"generate","visibility":"Public","body":""}},{"html_id":"params-instance-method","name":"params","abstract":false,"location":{"filename":"src/crest/form.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/form.cr#L6"},"def":{"name":"params","visibility":"Public","body":"@params"}}]},{"html_id":"crest/Crest/JSONForm","path":"Crest/JSONForm.html","kind":"class","full_name":"Crest::JSONForm(T)","name":"JSONForm","abstract":false,"superclass":{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},"ancestors":[{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/forms/json_form.cr","line_number":7,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/json_form.cr#L7"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This class lets `crest` convert request hash to JSON\nThis causes `crest` to POST data using the\n\"Content-Type\" `application/json`.","summary":"

This class lets crest convert request hash to JSON This causes crest to POST data using the "Content-Type" application/json.

","instance_methods":[{"html_id":"generate-instance-method","name":"generate","abstract":false,"location":{"filename":"src/crest/forms/json_form.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/json_form.cr#L10"},"def":{"name":"generate","visibility":"Public","body":"@form_data = @params.to_json\nself\n"}}]},{"html_id":"crest/Crest/Logger","path":"Crest/Logger.html","kind":"class","full_name":"Crest::Logger","name":"Logger","abstract":true,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/logger.cr","line_number":4,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L4"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/CommonLogger","kind":"class","full_name":"Crest::CommonLogger","name":"CommonLogger"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"constructors":[{"html_id":"new(filename:String)-class-method","name":"new","abstract":false,"args":[{"name":"filename","external_name":"filename","restriction":"String"}],"args_string":"(filename : String)","args_html":"(filename : String)","location":{"filename":"src/crest/logger.cr","line_number":5,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L5"},"def":{"name":"new","args":[{"name":"filename","external_name":"filename","restriction":"String"}],"visibility":"Public","body":"new(File.open(filename, \"w\"))"}},{"html_id":"new(io:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"io","default_value":"STDOUT","external_name":"io","restriction":"IO"}],"args_string":"(io : IO = STDOUT)","args_html":"(io : IO = STDOUT)","location":{"filename":"src/crest/logger.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L11"},"def":{"name":"new","args":[{"name":"io","default_value":"STDOUT","external_name":"io","restriction":"IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(io)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"default_formatter:Log::Formatter-instance-method","name":"default_formatter","abstract":false,"location":{"filename":"src/crest/logger.cr","line_number":23,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L23"},"def":{"name":"default_formatter","return_type":"::Log::Formatter","visibility":"Public","body":"::Log::Formatter.new do |entry, io|\n io << entry.source\n (io << \" | \") << (entry.timestamp.to_s(\"%F %T\"))\n (io << \" \") << entry.message\nend"}},{"html_id":"filter(pattern:String|Regex,replacement:String)-instance-method","name":"filter","abstract":false,"args":[{"name":"pattern","external_name":"pattern","restriction":"String | Regex"},{"name":"replacement","external_name":"replacement","restriction":"String"}],"args_string":"(pattern : String | Regex, replacement : String)","args_html":"(pattern : String | Regex, replacement : String)","location":{"filename":"src/crest/logger.cr","line_number":35,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L35"},"def":{"name":"filter","args":[{"name":"pattern","external_name":"pattern","restriction":"String | Regex"},{"name":"replacement","external_name":"replacement","restriction":"String"}],"visibility":"Public","body":"@filters.push({pattern, replacement})"}},{"html_id":"info(message:String)-instance-method","name":"info","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String"}],"args_string":"(message : String)","args_html":"(message : String)","location":{"filename":"src/crest/logger.cr","line_number":31,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L31"},"def":{"name":"info","args":[{"name":"message","external_name":"message","restriction":"String"}],"visibility":"Public","body":"@logger.info do\n apply_filters(message)\nend"}},{"html_id":"request(request:Crest::Request):Nil-instance-method","name":"request","abstract":true,"args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(request : Crest::Request) : Nil","args_html":"(request : Crest::Request) : Nil","location":{"filename":"src/crest/logger.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L20"},"def":{"name":"request","args":[{"name":"request","external_name":"request","restriction":"Crest::Request"}],"return_type":"Nil","visibility":"Public","body":""}},{"html_id":"response(response:Crest::Response):Nil-instance-method","name":"response","abstract":true,"args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"args_string":"(response : Crest::Response) : Nil","args_html":"(response : Crest::Response) : Nil","location":{"filename":"src/crest/logger.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L21"},"def":{"name":"response","args":[{"name":"response","external_name":"response","restriction":"Crest::Response"}],"return_type":"Nil","visibility":"Public","body":""}}],"macros":[{"html_id":"method_missing(call)-macro","name":"method_missing","abstract":false,"args":[{"name":"call","external_name":"call","restriction":""}],"args_string":"(call)","args_html":"(call)","location":{"filename":"src/crest/logger.cr","line_number":9,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/logger.cr#L9"},"def":{"name":"method_missing","args":[{"name":"call","external_name":"call","restriction":""}],"visibility":"Public","body":" @logger.\n{{ call }}\n\n \n"}}]},{"html_id":"crest/Crest/NestedParamsEncoder","path":"Crest/NestedParamsEncoder.html","kind":"class","full_name":"Crest::NestedParamsEncoder","name":"NestedParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"flatten_params(object:Hash,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n`parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::NestedParamsEncoder.flatten_params({:key1 => {:key2 => \"123\"}})\n# => [{\"key1[key2]\", \"123\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Hash, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":26,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L26"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Hash"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, __temp_92|\n k, v = __temp_92\n processed_key = parent_key ? \"#{parent_key}[#{k}]\" : k.to_s\n case v\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(v, processed_key))\n else\n memo << {processed_key, v}\n end\nend"}},{"html_id":"flatten_params(object:Array,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform deeply nested params containers into a flat array of `{key, value}`.\n\n`parent_key` — Should not be passed (used for recursion)\n\n```\nCrest::NestedParamsEncoder.flatten_params({:key1 => {:arr => [\"1\", \"2\", \"3\"]}})\n# => [{\"key1[arr]\", \"1\"}, {\"key1[arr]\", \"2\"}, {\"key1[arr]\", \"3\"}]\n```","summary":"

Transform deeply nested params containers into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : Array, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":47,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L47"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"Array"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"object.reduce([] of Tuple(String, Crest::ParamsValue)) do |memo, item|\n processed_key = parent_key ? parent_key : \"\"\n case item\n when Hash, Array, JSON::Any\n memo = memo + (flatten_params(item, processed_key))\n else\n memo << {processed_key, item}\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","doc":"Converts the given params into a URI query string. Keys and values\nwill converted to strings and appropriately escaped for the URI.\n\n```\nCrest::NestedParamsEncoder.encode({\"a\" => [\"one\", \"two\", \"three\"], \"b\" => true, \"c\" => \"C\", \"d\" => 1})\n# => 'a=one&a=two&a=three&b=true&c=C&d=1'\n```","summary":"

Converts the given params into a URI query string.

","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoders/nested_params_encoder.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/nested_params_encoder.cr#L10"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"HTTP::Params.build do |form|\n (self.class.flatten_params(params)).each do |name, value|\n form.add(name.to_s, value.to_s)\n end\nend"}}]},{"html_id":"crest/Crest/ParamsDecoder","path":"Crest/ParamsDecoder.html","kind":"module","full_name":"Crest::ParamsDecoder","name":"ParamsDecoder","abstract":false,"locations":[{"filename":"src/crest/params_decoder.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L3"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ARRAY_REGEX","name":"ARRAY_REGEX","value":"/[\\[\\]]+\\Z/"},{"id":"SUBKEYS_REGEX","name":"SUBKEYS_REGEX","value":"/[^\\[\\]]+(?:\\]?\\[\\])?/"}],"extended_modules":[{"html_id":"crest/Crest/ParamsDecoder","kind":"module","full_name":"Crest::ParamsDecoder","name":"ParamsDecoder"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Module for decoding query-string into parameters.","summary":"

Module for decoding query-string into parameters.

","instance_methods":[{"html_id":"decode(query:String):Hash(String,Type)-instance-method","name":"decode","doc":"Converts the given URI query string into a hash.\n\n```\nCrest::ParamsDecoder.decode(\"a[]=one&a[]=two&a[]=three&b=true&c=C&d=1\")\n# => {\"a\" => [\"one\", \"two\", \"three\"], \"b\" => \"true\", \"c\" => \"C\", \"d\" => \"1\"}\n\nCrest::ParamsDecoder.decode(\"a=one&a=two&a=three&b=true&c=C&d=1\")\n# => {\"a\" => [\"one\", \"two\", \"three\"], \"b\" => \"true\", \"c\" => \"C\", \"d\" => \"1\"}\n```","summary":"

Converts the given URI query string into a hash.

","abstract":false,"args":[{"name":"query","external_name":"query","restriction":"String"}],"args_string":"(query : String) : Hash(String, Type)","args_html":"(query : String) : Hash(String, Type)","location":{"filename":"src/crest/params_decoder.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L20"},"def":{"name":"decode","args":[{"name":"query","external_name":"query","restriction":"String"}],"return_type":"Hash(String, Type)","visibility":"Public","body":"params = {} of String => Type\n(query.split('&')).each do |pair|\n if pair.empty?\n next\n end\n key, value = pair.split('=', 2)\n key = URI.decode(key)\n value = URI.decode(value)\n decode_pair(key, value, params)\nend\n(dehash(params)).as(Hash)\n"}},{"html_id":"match_context(context,subkey):Type|Nil-instance-method","name":"match_context","abstract":false,"args":[{"name":"context","external_name":"context","restriction":""},{"name":"subkey","external_name":"subkey","restriction":""}],"args_string":"(context, subkey) : Type | Nil","args_html":"(context, subkey) : Type | Nil","location":{"filename":"src/crest/params_decoder.cr","line_number":72,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L72"},"def":{"name":"match_context","args":[{"name":"context","external_name":"context","restriction":""},{"name":"subkey","external_name":"subkey","restriction":""}],"return_type":"Type | Nil","visibility":"Public","body":"if (!context.last?.is_a?(Hash)) || ((context.last.as(Hash)).has_key?(subkey))\n context << ({} of String => Type)\nend\ncontext.last?\n"}}],"types":[{"html_id":"crest/Crest/ParamsDecoder/Type","path":"Crest/ParamsDecoder/Type.html","kind":"alias","full_name":"Crest::ParamsDecoder::Type","name":"Type","abstract":false,"locations":[{"filename":"src/crest/params_decoder.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_decoder.cr#L6"}],"repository_name":"crest","program":false,"enum":false,"alias":true,"aliased":"(Array(Crest::ParamsDecoder::Type) | Hash(String, Crest::ParamsDecoder::Type) | String | Nil)","aliased_html":"Array(Crest::ParamsDecoder::Type) | Hash(String, Crest::ParamsDecoder::Type) | String | Nil","const":false,"namespace":{"html_id":"crest/Crest/ParamsDecoder","kind":"module","full_name":"Crest::ParamsDecoder","name":"ParamsDecoder"}}]},{"html_id":"crest/Crest/ParamsEncoder","path":"Crest/ParamsEncoder.html","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder","abstract":true,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoder.cr","line_number":10,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L10"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder"},{"html_id":"crest/Crest/FlatParamsEncoder","kind":"class","full_name":"Crest::FlatParamsEncoder","name":"FlatParamsEncoder"},{"html_id":"crest/Crest/NestedParamsEncoder","kind":"class","full_name":"Crest::NestedParamsEncoder","name":"NestedParamsEncoder"}],"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Custom serializers\n\nYou can build your custom encoder, if you like.\nThe value of `params_encoder` can be any `Crest::ParamsEncoder` object that responds to: `#encode(Hash) #=> String`\n\nThe encoder will affect both how Crest processes query strings and how it serializes POST bodies.\n\nThe default encoder is `Crest::FlatParamsEncoder`.","summary":"

Custom serializers

","class_methods":[{"html_id":"encode(params:Hash):String-class-method","name":"encode","abstract":false,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoder.cr","line_number":13,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L13"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":"new.encode(params)"}},{"html_id":"flatten_params(object:JSON::Any,parent_key:String|Nil=nil):Array(Tuple(String,Crest::ParamsValue))-class-method","name":"flatten_params","doc":"Transform JSON::Any `object` into a flat array of `{key, value}`.\n\n# `parent_key` — Should not be passed (used for recursion)\n\n```\nparams = JSON.parse(%({\"access\": [{\"name\": \"mapping\", \"speed\": \"fast\"}, {\"name\": \"any\", \"speed\": \"slow\"}]}))\n\nCrest::FlatParamsEncoder.flatten_params(params)\n# => [{\"access[][name]\", \"mapping\"}, {\"access[][speed]\", \"fast\"}, {\"access[][name]\", \"any\"}, {\"access[][speed]\", \"slow\"}]\n\nCrest::EnumeratedFlatParamsEncoder.flatten_params(params)\n# => [{\"access[1][name]\", \"mapping\"}, {\"access[1][speed]\", \"fast\"}, {\"access[2][name]\", \"any\"}, {\"access[2][speed]\", \"slow\"}]\n```","summary":"

Transform JSON::Any object into a flat array of {key, value}.

","abstract":false,"args":[{"name":"object","external_name":"object","restriction":"JSON::Any"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"args_string":"(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","args_html":"(object : JSON::Any, parent_key : String | Nil = nil) : Array(Tuple(String, Crest::ParamsValue))","location":{"filename":"src/crest/params_encoder.cr","line_number":30,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L30"},"def":{"name":"flatten_params","args":[{"name":"object","external_name":"object","restriction":"JSON::Any"},{"name":"parent_key","default_value":"nil","external_name":"parent_key","restriction":"String | ::Nil"}],"return_type":"Array(Tuple(String, Crest::ParamsValue))","visibility":"Public","body":"if hash = object.as_h?\n flatten_params(hash, parent_key)\nelse\n if array = object.as_a?\n flatten_params(array, parent_key)\n else\n processed_key = parent_key ? parent_key : \"\"\n value : Crest::ParamsValue = nil\n if value.nil?\n value = object.as_i64?\n end\n if value.nil?\n value = object.as_f?\n end\n if value.nil?\n value = object.as_bool?\n end\n if value.nil?\n value = object.as_s?\n end\n [{processed_key, value.as(Crest::ParamsValue)}]\n end\nend"}}],"instance_methods":[{"html_id":"encode(params:Hash):String-instance-method","name":"encode","abstract":true,"args":[{"name":"params","external_name":"params","restriction":"Hash"}],"args_string":"(params : Hash) : String","args_html":"(params : Hash) : String","location":{"filename":"src/crest/params_encoder.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoder.cr#L11"},"def":{"name":"encode","args":[{"name":"params","external_name":"params","restriction":"Hash"}],"return_type":"String","visibility":"Public","body":""}}]},{"html_id":"crest/Crest/ParamsValue","path":"Crest/ParamsValue.html","kind":"alias","full_name":"Crest::ParamsValue","name":"ParamsValue","abstract":false,"locations":[{"filename":"src/crest.cr","line_number":42,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L42"}],"repository_name":"crest","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil)","aliased_html":"Bool | Float32 | Float64 | IO | Int32 | Int64 | String | Symbol | Nil","const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"}},{"html_id":"crest/Crest/Redirector","path":"Crest/Redirector.html","kind":"class","full_name":"Crest::Redirector","name":"Redirector","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/redirector.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"constructors":[{"html_id":"new(response:Crest::Response,request:Crest::Request)-class-method","name":"new","abstract":false,"args":[{"name":"response","external_name":"response","restriction":"Crest::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(response : Crest::Response, request : Crest::Request)","args_html":"(response : Crest::Response, request : Crest::Request)","location":{"filename":"src/crest/redirector.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L3"},"def":{"name":"new","args":[{"name":"response","external_name":"response","restriction":"Crest::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"_ = allocate\n_.initialize(response, request)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"follow:Crest::Response-instance-method","name":"follow","abstract":false,"location":{"filename":"src/crest/redirector.cr","line_number":6,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L6"},"def":{"name":"follow","return_type":"Crest::Response","visibility":"Public","body":"case @response\nwhen .success?\n @response\nwhen .redirect?\n check_max_redirects\n @request.max_redirects > 0 ? follow_redirection : @response\nelse\n if @request.handle_errors\n raise_exception!\n end\n @response\nend"}},{"html_id":"follow(&block:Crest::Response->)-instance-method","name":"follow","abstract":false,"location":{"filename":"src/crest/redirector.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/redirector.cr#L20"},"def":{"name":"follow","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"visibility":"Public","body":"case @response\nwhen .success?\n @response\nwhen .redirect?\n check_max_redirects\n @request.max_redirects > 0 ? follow_redirection(&block) : @response\nelse\n if @request.handle_errors\n raise_exception!\n end\n @response\nend"}}]},{"html_id":"crest/Crest/Request","path":"Crest/Request.html","kind":"class","full_name":"Crest::Request","name":"Request","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/request.cr","line_number":57,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L57"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"A class that used to make the requests\nThe result of a `Crest::Request` is a `Crest::Response` object.\n\nSimple example:\n\n```\nrequest = Crest::Request.new(:post, \"http://httpbin.org/post\", {\"age\" => 27}, params: {:name => \"Kurt\"})\nrequest.execute\n\nCrest::Request.execute(:post, \"http://httpbin.org/post\", {\"age\" => 27}, json: true)\n\nCrest::Request.post(\"http://httpbin.org/post\", {\"age\" => 27}, json: true)\n```\n\nBlock style:\n\n```\nrequest = Crest::Request.new(:get, \"http://httpbin.org/get\") do |request|\n request.headers.add(\"foo\", \"bar\")\n request.user = \"username\"\n request.password = \"password\"\nend\n\nresponse = request.execute\n```\n\nMandatory parameters:\n- `method`\n- `url`\n\nOptional parameters:\n- `headers` a hash containing the request headers\n- `cookies` a hash containing the request cookies\n- `form` a hash containing form data (or a raw string)\n- `params` a hash that represent query params (or a raw string) - a string separated from the preceding part by a question mark (?)\n and a sequence of attribute–value pairs separated by a delimiter (&).\n- `params_encoder` params encoder (default to `Crest::FlatParamsEncoder`)\n- `auth` access authentication method `basic` or `digest` (default to `basic`)\n- `user` and `password` for authentication\n- `tls` configuring TLS settings\n- `p_addr`, `p_port`, `p_user`, `p_pass` for proxy\n- `json` make a JSON request with the appropriate HTTP headers (default to `false`)\n- `multipart` make a multipart request with the appropriate HTTP headers even if not sending a file (default to `false`)\n- `user_agent` set \"User-Agent\" HTTP header (default to `Crest::USER_AGENT`)\n- `max_redirects` maximum number of redirects (default to `10`)\n- `logging` enable logging (default to `false`)\n- `logger` set logger (default to `Crest::CommonLogger`)\n- `handle_errors` error handling (default to `true`)\n- `close_connection` close the connection after request is completed (default to `true`)\n- `http_client` instance of `HTTP::Client`\n- `read_timeout` read timeout (default to `nil`)\n- `write_timeout` write timeout (default to `nil`)\n- `connect_timeout` connect timeout (default to `nil`)","summary":"

A class that used to make the requests The result of a Crest::Request is a Crest::Response object.

","class_methods":[{"html_id":"delete(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.delete(\"http://httpbin.org/delete\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"delete(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.\n\n```\nCrest::Request.delete(\"http://httpbin.org/delete\")\n```","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"delete","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:delete, url, form, **args)\nrequest.execute\n"}},{"html_id":"execute(method,url,form={}ofString=>String,**args):Crest::Response-class-method","name":"execute","abstract":false,"args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(method, url, form = {} of String => String, **args) : Crest::Response","args_html":"(method, url, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":95,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L95"},"def":{"name":"execute","args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = new(method, url, form, **args)\nrequest.execute\n"}},{"html_id":"execute(method,url,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"execute","abstract":false,"args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(method, url, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(method, url, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":100,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L100"},"def":{"name":"execute","args":[{"name":"method","external_name":"method","restriction":""},{"name":"url","external_name":"url","restriction":""},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = new(method, url, form, **args)\nrequest.execute(&block)\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.get(\"http://httpbin.org/get\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"get(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.\n\n```\nCrest::Request.get(\"http://httpbin.org/get\")\n```","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"get","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:get, url, form, **args)\nrequest.execute\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.head(\"http://httpbin.org/head\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"head(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.\n\n```\nCrest::Request.head(\"http://httpbin.org/head\")\n```","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"head","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:head, url, form, **args)\nrequest.execute\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.options(\"http://httpbin.org/options\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"options(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.\n\n```\nCrest::Request.options(\"http://httpbin.org/options\")\n```","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"options","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:options, url, form, **args)\nrequest.execute\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.patch(\"http://httpbin.org/patch\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"patch(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.\n\n```\nCrest::Request.patch(\"http://httpbin.org/patch\")\n```","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"patch","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:patch, url, form, **args)\nrequest.execute\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.post(\"http://httpbin.org/post\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"post(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.\n\n```\nCrest::Request.post(\"http://httpbin.org/post\")\n```","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"post","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:post, url, form, **args)\nrequest.execute\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args,&block:Crest::Response->):Nil-class-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.\n\n```\nCrest::Request.put(\"http://httpbin.org/put\") do |resp|\n while line = resp.body_io.gets\n puts line\n end\nend\n```","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(url : String, form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nresponse = request.execute(&block)\n"}},{"html_id":"put(url:String,form={}ofString=>String,**args):Crest::Response-class-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.\n\n```\nCrest::Request.put(\"http://httpbin.org/put\")\n```","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(url : String, form = {} of String => String, **args) : Crest::Response","args_html":"(url : String, form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/request.cr","line_number":167,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L167"},"def":{"name":"put","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"request = Request.new(:put, url, form, **args)\nrequest.execute\n"}}],"constructors":[{"html_id":"new(method:Symbol,url:String,form={}ofString=>String,*,headers={}ofString=>String,cookies={}ofString=>String,params={}ofString=>String,max_redirects:Int32=10,**options,&)-class-method","name":"new","abstract":false,"args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"max_redirects","default_value":"10","external_name":"max_redirects","restriction":"::Int32"}],"args_string":"(method : Symbol, url : String, form = {} of String => String, *, headers = {} of String => String, cookies = {} of String => String, params = {} of String => String, max_redirects : Int32 = 10, **options, &)","args_html":"(method : Symbol, url : String, form = {} of String => String, *, headers = {} of String => String, cookies = {} of String => String, params = {} of String => String, max_redirects : Int32 = 10, **options, &)","location":{"filename":"src/crest/request.cr","line_number":105,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L105"},"def":{"name":"new","args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"max_redirects","default_value":"10","external_name":"max_redirects","restriction":"::Int32"}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":3,"yields":1,"block_arity":1,"visibility":"Public","body":"_ = allocate\n_.initialize(method, url, form, **options, headers: headers, cookies: cookies, params: params, max_redirects: max_redirects) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(method:Symbol,url:String,form={}ofString=>String,**args)-class-method","name":"new","doc":"When block is not given.","summary":"

When block is not given.

","abstract":false,"args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(method : Symbol, url : String, form = {} of String => String, **args)","args_html":"(method : Symbol, url : String, form = {} of String => String, **args)","location":{"filename":"src/crest/request.cr","line_number":163,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L163"},"def":{"name":"new","args":[{"name":"method","external_name":"method","restriction":"Symbol"},{"name":"url","external_name":"url","restriction":"String"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"_ = allocate\n_.initialize(method, url, form, **args)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"auth:String-instance-method","name":"auth","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"auth","visibility":"Public","body":"@auth"}},{"html_id":"close(*args,**options)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.close(*args, **options)"}},{"html_id":"close(*args,**options,&)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.close(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"close_connection:Bool-instance-method","name":"close_connection","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"close_connection","visibility":"Public","body":"@close_connection"}},{"html_id":"closed?-instance-method","name":"closed?","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":229,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L229"},"def":{"name":"closed?","visibility":"Public","body":"http_client.@io ? false : true"}},{"html_id":"connect_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"connect_timeout","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"connect_timeout","visibility":"Public","body":"@connect_timeout"}},{"html_id":"cookies:HTTP::Cookies-instance-method","name":"cookies","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"cookies","visibility":"Public","body":"@cookies"}},{"html_id":"execute:Crest::Response-instance-method","name":"execute","doc":"Execute HTTP request","summary":"

Execute HTTP request

","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":196,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L196"},"def":{"name":"execute","return_type":"Crest::Response","visibility":"Public","body":"begin\n @proxy.try do |proxy|\n @http_client.proxy = proxy\n end\n authenticate!\n if @logging\n @logger.request(self)\n end\n @http_request = new_http_request(@method, @url, @headers, @form_data)\n http_response = @http_client.exec(@http_request)\n process_result(http_response)\nensure\n if @close_connection\n @http_client.close\n end\nend"}},{"html_id":"execute(&block:Crest::Response->):Nil-instance-method","name":"execute","doc":"Execute streaming HTTP request","summary":"

Execute streaming HTTP request

","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":211,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L211"},"def":{"name":"execute","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"begin\n @proxy.try do |proxy|\n @http_client.proxy = proxy\n end\n authenticate!\n if @logging\n @logger.request(self)\n end\n @http_request = new_http_request(@method, @url, @headers, @form_data)\n @http_client.exec(@http_request) do |http_response|\n response = process_result(http_response, &block)\n if response\n yield response\n end\n end\nensure\n if @close_connection\n @http_client.close\n end\nend"}},{"html_id":"form_data:IO|Slice(UInt8)|String|Nil-instance-method","name":"form_data","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"form_data","visibility":"Public","body":"@form_data"}},{"html_id":"handle_errors:Bool-instance-method","name":"handle_errors","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"handle_errors","visibility":"Public","body":"@handle_errors"}},{"html_id":"headers:HTTP::Headers-instance-method","name":"headers","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"headers","visibility":"Public","body":"@headers"}},{"html_id":"host(*args,**options)-instance-method","name":"host","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"host","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.host(*args, **options)"}},{"html_id":"host(*args,**options,&)-instance-method","name":"host","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"host","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.host(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"http_client:HTTP::Client-instance-method","name":"http_client","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"http_client","visibility":"Public","body":"@http_client"}},{"html_id":"http_request:HTTP::Request-instance-method","name":"http_request","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"http_request","visibility":"Public","body":"@http_request"}},{"html_id":"json:Bool-instance-method","name":"json","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"json","visibility":"Public","body":"@json"}},{"html_id":"logger:Crest::Logger-instance-method","name":"logger","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"logger","visibility":"Public","body":"@logger"}},{"html_id":"logging:Bool-instance-method","name":"logging","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"logging","visibility":"Public","body":"@logging"}},{"html_id":"max_redirects:Int32-instance-method","name":"max_redirects","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"max_redirects","visibility":"Public","body":"@max_redirects"}},{"html_id":"method:String-instance-method","name":"method","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"method","visibility":"Public","body":"@method"}},{"html_id":"multipart:Bool-instance-method","name":"multipart","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"multipart","visibility":"Public","body":"@multipart"}},{"html_id":"p_addr:String?-instance-method","name":"p_addr","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_addr","visibility":"Public","body":"@p_addr"}},{"html_id":"p_pass:String?-instance-method","name":"p_pass","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_pass","visibility":"Public","body":"@p_pass"}},{"html_id":"p_port:Int32?-instance-method","name":"p_port","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_port","visibility":"Public","body":"@p_port"}},{"html_id":"p_user:String?-instance-method","name":"p_user","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"p_user","visibility":"Public","body":"@p_user"}},{"html_id":"password:String?-instance-method","name":"password","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"password","visibility":"Public","body":"@password"}},{"html_id":"password=(password:Nil|String)-instance-method","name":"password=","abstract":false,"args":[{"name":"password","external_name":"password","restriction":"::Nil | ::String"}],"args_string":"(password : Nil | String)","args_html":"(password : Nil | String)","location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"password=","args":[{"name":"password","external_name":"password","restriction":"::Nil | ::String"}],"visibility":"Public","body":"@password = password"}},{"html_id":"port(*args,**options)-instance-method","name":"port","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"port","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.port(*args, **options)"}},{"html_id":"port(*args,**options,&)-instance-method","name":"port","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"port","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.port(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"proxy:HTTP::Proxy::Client?-instance-method","name":"proxy","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"proxy","visibility":"Public","body":"@proxy"}},{"html_id":"read_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"read_timeout","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"read_timeout","visibility":"Public","body":"@read_timeout"}},{"html_id":"redirection_history:Array(Crest::Response)-instance-method","name":"redirection_history","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"redirection_history","visibility":"Public","body":"@redirection_history"}},{"html_id":"redirection_history=(redirection_history:Array(Crest::Response))-instance-method","name":"redirection_history=","abstract":false,"args":[{"name":"redirection_history","external_name":"redirection_history","restriction":"::Array(::Crest::Response)"}],"args_string":"(redirection_history : Array(Crest::Response))","args_html":"(redirection_history : Array(Crest::Response))","location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"redirection_history=","args":[{"name":"redirection_history","external_name":"redirection_history","restriction":"::Array(::Crest::Response)"}],"visibility":"Public","body":"@redirection_history = redirection_history"}},{"html_id":"tls:OpenSSL::SSL::Context::Client?-instance-method","name":"tls","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"tls","visibility":"Public","body":"@tls"}},{"html_id":"tls?(*args,**options)-instance-method","name":"tls?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"tls?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@http_client.tls?(*args, **options)"}},{"html_id":"tls?(*args,**options,&)-instance-method","name":"tls?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/request.cr","line_number":93,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L93"},"def":{"name":"tls?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@http_client.tls?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_curl-instance-method","name":"to_curl","doc":"Convert `Request` object to cURL command","summary":"

Convert Request object to cURL command

","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":246,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L246"},"def":{"name":"to_curl","visibility":"Public","body":"Crest::Curlify.to_curl(self)"}},{"html_id":"url:String-instance-method","name":"url","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"url","visibility":"Public","body":"@url"}},{"html_id":"user:String?-instance-method","name":"user","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"user","visibility":"Public","body":"@user"}},{"html_id":"user=(user:Nil|String)-instance-method","name":"user=","abstract":false,"args":[{"name":"user","external_name":"user","restriction":"::Nil | ::String"}],"args_string":"(user : Nil | String)","args_html":"(user : Nil | String)","location":{"filename":"src/crest/request.cr","line_number":91,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L91"},"def":{"name":"user=","args":[{"name":"user","external_name":"user","restriction":"::Nil | ::String"}],"visibility":"Public","body":"@user = user"}},{"html_id":"user_agent:String?-instance-method","name":"user_agent","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"user_agent","visibility":"Public","body":"@user_agent"}},{"html_id":"write_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"write_timeout","abstract":false,"location":{"filename":"src/crest/request.cr","line_number":86,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/request.cr#L86"},"def":{"name":"write_timeout","visibility":"Public","body":"@write_timeout"}}]},{"html_id":"crest/Crest/RequestFailed","path":"Crest/RequestFailed.html","kind":"class","full_name":"Crest::RequestFailed","name":"RequestFailed","abstract":false,"superclass":{"html_id":"crest/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"crest/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/exceptions.cr","line_number":95,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L95"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This is the base `Crest` exception class. Rescue it if you want to\ncatch any exception that your request might raise\nYou can see anything about the response via `e.response`.\nFor example, the entire result body (which is\nprobably an HTML error page) is `e.response.body`.\n\nHash of HTTP status `code => message`.\n\n- `1xx`: Informational - Request received, continuing process\n- `2xx`: Success - The action was successfully received, understood, and\n accepted\n- `3xx`: Redirection - Further action must be taken in order to complete the\n request\n- `4xx`: Client Error - The request contains bad syntax or cannot be fulfilled\n- `5xx`: Server Error - The server failed to fulfill an apparently valid\n request\n\nSee [HTTP Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)\nfor more Information.","summary":"

This is the base Crest exception class.

","class_methods":[{"html_id":"subclass_by_status_code(status_code)-class-method","name":"subclass_by_status_code","abstract":false,"args":[{"name":"status_code","external_name":"status_code","restriction":""}],"args_string":"(status_code)","args_html":"(status_code)","location":{"filename":"src/crest/exceptions.cr","line_number":100,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L100"},"def":{"name":"subclass_by_status_code","args":[{"name":"status_code","external_name":"status_code","restriction":""}],"visibility":"Public","body":"EXCEPTIONS_MAP.fetch(status_code, self)"}}],"constructors":[{"html_id":"new(response:Crest::Response)-class-method","name":"new","abstract":false,"args":[{"name":"response","external_name":"response","restriction":"::Crest::Response"}],"args_string":"(response : Crest::Response)","args_html":"(response : Crest::Response)","location":{"filename":"src/crest/exceptions.cr","line_number":104,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L104"},"def":{"name":"new","args":[{"name":"response","external_name":"response","restriction":"::Crest::Response"}],"visibility":"Public","body":"_ = allocate\n_.initialize(response)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"http_code-instance-method","name":"http_code","abstract":false,"location":{"filename":"src/crest/exceptions.cr","line_number":108,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L108"},"def":{"name":"http_code","visibility":"Public","body":"@response.status_code.to_i"}},{"html_id":"message-instance-method","name":"message","abstract":false,"location":{"filename":"src/crest/exceptions.cr","line_number":112,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L112"},"def":{"name":"message","visibility":"Public","body":"\"HTTP status code #{http_code}: #{STATUSES[http_code]}\""}},{"html_id":"response:Crest::Response-instance-method","name":"response","abstract":false,"location":{"filename":"src/crest/exceptions.cr","line_number":96,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/exceptions.cr#L96"},"def":{"name":"response","visibility":"Public","body":"@response"}}]},{"html_id":"crest/Crest/Resource","path":"Crest/Resource.html","kind":"class","full_name":"Crest::Resource","name":"Resource","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/resource.cr","line_number":62,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L62"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"A class that can be instantiated for access to a RESTful resource,\nincluding authentication, proxy and logging.\n\nSimple example:\n\n```\nresource = Crest::Resource.new(\"https://httpbin.org/get\")\nresponse = resource.get\n```\n\nBlock style:\n\n```\nresource = Crest::Resource.new(\"http://httpbin.org\") do |res|\n res.headers.merge!({\"foo\" => \"bar\"})\nend\n\nresponse = resource[\"/headers\"].get\n```\n\nWith HTTP basic authentication:\n\n```\nresource = Crest::Resource.new(\"https://httpbin.org/get\", user: \"user\", password: \"password\")\n```\n\nUse the `[]` syntax to allocate subresources:\n\n```\nresource = Crest::Resource.new(\"https://httpbin.org\")\nresource[\"/get\"].get\n```\n\nYou can pass advanced parameters like default `params`, `headers`, or `cookies`:\n\n```\nresource = Crest::Resource.new(\n \"https://httpbin.org\",\n params: {\"key\" => \"key\"},\n headers: {\"Content-Type\" => \"application/json\"},\n cookies: {\"lang\"=> \"ua\"}\n)\nresponse = response[\"/post\"].post(\n form: {:height => 100, \"width\" => \"100\"},\n params: {:secret => \"secret\"},\n cookies: {\"locale\"=> \"en_US\"}\n)\n```\nIf you want to stream the data from the response you can pass a block:\n\n```\nresource = Crest::Resource.new(\"http://httpbin.org\")\nresource[\"/stream/5\"].get do |response|\n while line = response.body_io.gets\n puts line\n end\nend\n```","summary":"

A class that can be instantiated for access to a RESTful resource, including authentication, proxy and logging.

","constructors":[{"html_id":"new(url:String,*,headers:Hash(String,String)={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,**options,&)-class-method","name":"new","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":"::Hash(::String, ::String)"},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(url : String, *, headers : Hash(String, String) = {} of String => String, params = {} of String => String, cookies = {} of String => String, **options, &)","args_html":"(url : String, *, headers : Hash(String, String) = {} of String => String, params = {} of String => String, cookies = {} of String => String, **options, &)","location":{"filename":"src/crest/resource.cr","line_number":77,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L77"},"def":{"name":"new","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":"::Hash(::String, ::String)"},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":1,"yields":1,"block_arity":1,"visibility":"Public","body":"_ = allocate\n_.initialize(url, **options, headers: headers, params: params, cookies: cookies) do |_arg0|\n yield _arg0\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(url:String,**args)-class-method","name":"new","doc":"When block is not given.","summary":"

When block is not given.

","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"}],"args_string":"(url : String, **args)","args_html":"(url : String, **args)","location":{"filename":"src/crest/resource.cr","line_number":112,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L112"},"def":{"name":"new","args":[{"name":"url","external_name":"url","restriction":"String"}],"double_splat":{"name":"args","external_name":"args","restriction":""},"visibility":"Public","body":"_ = allocate\n_.initialize(url, **args)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"[](suburl)-instance-method","name":"[]","abstract":false,"args":[{"name":"suburl","external_name":"suburl","restriction":""}],"args_string":"(suburl)","args_html":"(suburl)","location":{"filename":"src/crest/resource.cr","line_number":163,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L163"},"def":{"name":"[]","args":[{"name":"suburl","external_name":"suburl","restriction":""}],"visibility":"Public","body":"@url = concat_urls(@base_url, suburl)\nself\n"}},{"html_id":"close(*args,**options)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/resource.cr","line_number":72,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L72"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client.close(*args, **options)"}},{"html_id":"close(*args,**options,&)-instance-method","name":"close","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/resource.cr","line_number":72,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L72"},"def":{"name":"close","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client.close(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"close_connection:Bool-instance-method","name":"close_connection","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"close_connection","visibility":"Public","body":"@close_connection"}},{"html_id":"closed?-instance-method","name":"closed?","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":169,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L169"},"def":{"name":"closed?","visibility":"Public","body":"http_client.@io ? false : true"}},{"html_id":"connect_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"connect_timeout","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"connect_timeout","visibility":"Public","body":"@connect_timeout"}},{"html_id":"cookies:Hash(String,Bool|Float32|Float64|IO|Int32|Int64|String|Symbol|Nil)-instance-method","name":"cookies","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"cookies","visibility":"Public","body":"@cookies"}},{"html_id":"delete(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:delete, form)\n"}},{"html_id":"delete(form={}ofString=>String,**args):Crest::Response-instance-method","name":"delete","doc":"Execute a DELETE request and returns a `Crest::Response`.","summary":"

Execute a DELETE request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"delete(nil, form, **args)"}},{"html_id":"delete(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:delete, form, &block)\n"}},{"html_id":"delete(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"delete","doc":"Execute a DELETE request and and yields the `Crest::Response` to the block.","summary":"

Execute a DELETE request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"delete","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"delete(nil, form, **args, &block)"}},{"html_id":"get(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:get, form)\n"}},{"html_id":"get(form={}ofString=>String,**args):Crest::Response-instance-method","name":"get","doc":"Execute a GET request and returns a `Crest::Response`.","summary":"

Execute a GET request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"get(nil, form, **args)"}},{"html_id":"get(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:get, form, &block)\n"}},{"html_id":"get(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"get","doc":"Execute a GET request and and yields the `Crest::Response` to the block.","summary":"

Execute a GET request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"get","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"get(nil, form, **args, &block)"}},{"html_id":"handle_errors:Bool-instance-method","name":"handle_errors","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"handle_errors","visibility":"Public","body":"@handle_errors"}},{"html_id":"head(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:head, form)\n"}},{"html_id":"head(form={}ofString=>String,**args):Crest::Response-instance-method","name":"head","doc":"Execute a HEAD request and returns a `Crest::Response`.","summary":"

Execute a HEAD request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"head(nil, form, **args)"}},{"html_id":"head(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:head, form, &block)\n"}},{"html_id":"head(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"head","doc":"Execute a HEAD request and and yields the `Crest::Response` to the block.","summary":"

Execute a HEAD request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"head","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"head(nil, form, **args, &block)"}},{"html_id":"headers:Hash(String,String)-instance-method","name":"headers","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"headers","visibility":"Public","body":"@headers"}},{"html_id":"http_client:HTTP::Client-instance-method","name":"http_client","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"http_client","visibility":"Public","body":"@http_client"}},{"html_id":"json:Bool-instance-method","name":"json","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"json","visibility":"Public","body":"@json"}},{"html_id":"logger:Crest::Logger-instance-method","name":"logger","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"logger","visibility":"Public","body":"@logger"}},{"html_id":"logging:Bool-instance-method","name":"logging","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"logging","visibility":"Public","body":"@logging"}},{"html_id":"options(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:options, form)\n"}},{"html_id":"options(form={}ofString=>String,**args):Crest::Response-instance-method","name":"options","doc":"Execute a OPTIONS request and returns a `Crest::Response`.","summary":"

Execute a OPTIONS request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"options(nil, form, **args)"}},{"html_id":"options(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:options, form, &block)\n"}},{"html_id":"options(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"options","doc":"Execute a OPTIONS request and and yields the `Crest::Response` to the block.","summary":"

Execute a OPTIONS request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"options","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"options(nil, form, **args, &block)"}},{"html_id":"p_addr:String?-instance-method","name":"p_addr","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_addr","visibility":"Public","body":"@p_addr"}},{"html_id":"p_pass:String?-instance-method","name":"p_pass","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_pass","visibility":"Public","body":"@p_pass"}},{"html_id":"p_port:Int32?-instance-method","name":"p_port","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_port","visibility":"Public","body":"@p_port"}},{"html_id":"p_user:String?-instance-method","name":"p_user","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"p_user","visibility":"Public","body":"@p_user"}},{"html_id":"params:Hash(String,Bool|Float32|Float64|IO|Int32|Int64|String|Symbol|Nil)-instance-method","name":"params","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"params","visibility":"Public","body":"@params"}},{"html_id":"password:String?-instance-method","name":"password","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"password","visibility":"Public","body":"@password"}},{"html_id":"patch(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:patch, form)\n"}},{"html_id":"patch(form={}ofString=>String,**args):Crest::Response-instance-method","name":"patch","doc":"Execute a PATCH request and returns a `Crest::Response`.","summary":"

Execute a PATCH request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"patch(nil, form, **args)"}},{"html_id":"patch(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:patch, form, &block)\n"}},{"html_id":"patch(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"patch","doc":"Execute a PATCH request and and yields the `Crest::Response` to the block.","summary":"

Execute a PATCH request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"patch","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"patch(nil, form, **args, &block)"}},{"html_id":"post(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:post, form)\n"}},{"html_id":"post(form={}ofString=>String,**args):Crest::Response-instance-method","name":"post","doc":"Execute a POST request and returns a `Crest::Response`.","summary":"

Execute a POST request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"post(nil, form, **args)"}},{"html_id":"post(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:post, form, &block)\n"}},{"html_id":"post(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"post","doc":"Execute a POST request and and yields the `Crest::Response` to the block.","summary":"

Execute a POST request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"post","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"post(nil, form, **args, &block)"}},{"html_id":"put(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String):Crest::Response-instance-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"return_type":"Crest::Response","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:put, form)\n"}},{"html_id":"put(form={}ofString=>String,**args):Crest::Response-instance-method","name":"put","doc":"Execute a PUT request and returns a `Crest::Response`.","summary":"

Execute a PUT request and returns a Crest::Response.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args) : Crest::Response","args_html":"(form = {} of String => String, **args) : Crest::Response","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"return_type":"Crest::Response","visibility":"Public","body":"put(nil, form, **args)"}},{"html_id":"put(suburl:String|Nil=nil,form={}ofString=>String,*,headers={}ofString=>String,params={}ofString=>String,cookies={}ofString=>String,&block:Crest::Response->):Nil-instance-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"args_string":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","args_html":"(suburl : String | Nil = nil, form = {} of String => String, *, headers = {} of String => String, params = {} of String => String, cookies = {} of String => String, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"suburl","default_value":"nil","external_name":"suburl","restriction":"String | ::Nil"},{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"headers","default_value":"{} of String => String","external_name":"headers","restriction":""},{"name":"params","default_value":"{} of String => String","external_name":"params","restriction":""},{"name":"cookies","default_value":"{} of String => String","external_name":"cookies","restriction":""}],"splat_index":2,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"if suburl\n @url = concat_urls(@base_url, suburl)\nend\n@headers = @headers.merge(headers)\n@params = merge_params(params)\n@cookies = merge_cookies(cookies)\nexecute_request(:put, form, &block)\n"}},{"html_id":"put(form={}ofString=>String,**args,&block:Crest::Response->):Nil-instance-method","name":"put","doc":"Execute a PUT request and and yields the `Crest::Response` to the block.","summary":"

Execute a PUT request and and yields the Crest::Response to the block.

","abstract":false,"args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"args_string":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","args_html":"(form = {} of String => String, **args, &block : Crest::Response -> ) : Nil","location":{"filename":"src/crest/resource.cr","line_number":116,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L116"},"def":{"name":"put","args":[{"name":"form","default_value":"{} of String => String","external_name":"form","restriction":""}],"double_splat":{"name":"args","external_name":"args","restriction":""},"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"return_type":"Nil","visibility":"Public","body":"put(nil, form, **args, &block)"}},{"html_id":"read_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"read_timeout","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"read_timeout","visibility":"Public","body":"@read_timeout"}},{"html_id":"url:String-instance-method","name":"url","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"url","visibility":"Public","body":"@url"}},{"html_id":"user:String?-instance-method","name":"user","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"user","visibility":"Public","body":"@user"}},{"html_id":"user_agent:String?-instance-method","name":"user_agent","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"user_agent","visibility":"Public","body":"@user_agent"}},{"html_id":"write_timeout:Float32|Int32|Time::Span|Nil-instance-method","name":"write_timeout","abstract":false,"location":{"filename":"src/crest/resource.cr","line_number":63,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/resource.cr#L63"},"def":{"name":"write_timeout","visibility":"Public","body":"@write_timeout"}}]},{"html_id":"crest/Crest/Response","path":"Crest/Response.html","kind":"class","full_name":"Crest::Response","name":"Response","abstract":false,"superclass":{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/response.cr","line_number":17,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L17"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"Response objects have several useful methods:\n\n- `body`: The response body as a `String`\n- `body_io`: The response body as a `IO`\n- `status`: The response status as a `HTTP::Status`\n- `status_code`: The HTTP response code\n- `headers`: A hash of HTTP response headers\n- `cookies`: A hash of HTTP cookies set by the server\n- `request`: The `Crest::Request` object used to make the request\n- `http_client_res`: The `HTTP::Client::Response` object\n- `history`: A list of each response received in a redirection chain","summary":"

Response objects have several useful methods:

","constructors":[{"html_id":"new(http_client_res:HTTP::Client::Response,request:Crest::Request)-class-method","name":"new","abstract":false,"args":[{"name":"http_client_res","external_name":"http_client_res","restriction":"HTTP::Client::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"args_string":"(http_client_res : HTTP::Client::Response, request : Crest::Request)","args_html":"(http_client_res : HTTP::Client::Response, request : Crest::Request)","location":{"filename":"src/crest/response.cr","line_number":27,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L27"},"def":{"name":"new","args":[{"name":"http_client_res","external_name":"http_client_res","restriction":"HTTP::Client::Response"},{"name":"request","external_name":"request","restriction":"Crest::Request"}],"visibility":"Public","body":"_ = allocate\n_.initialize(http_client_res, request)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"body(*args,**options)-instance-method","name":"body","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L20"},"def":{"name":"body","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.body(*args, **options)"}},{"html_id":"body(*args,**options,&)-instance-method","name":"body","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":20,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L20"},"def":{"name":"body","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.body(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"body_io(*args,**options)-instance-method","name":"body_io","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L21"},"def":{"name":"body_io","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.body_io(*args, **options)"}},{"html_id":"body_io(*args,**options,&)-instance-method","name":"body_io","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":21,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L21"},"def":{"name":"body_io","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.body_io(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"client_error?(*args,**options)-instance-method","name":"client_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"client_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.client_error?(*args, **options)"}},{"html_id":"client_error?(*args,**options,&)-instance-method","name":"client_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"client_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.client_error?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"content_length:Int64-instance-method","name":"content_length","doc":"Size of the message body in bytes taken from \"Content-Length\" header","summary":"

Size of the message body in bytes taken from "Content-Length" header

","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":67,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L67"},"def":{"name":"content_length","return_type":"Int64","visibility":"Public","body":"http_client_res.headers[\"Content-Length\"].to_i64"}},{"html_id":"cookies-instance-method","name":"cookies","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":49,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L49"},"def":{"name":"cookies","visibility":"Public","body":"request_cookies.merge(response_cookies)"}},{"html_id":"filename:String|Nil-instance-method","name":"filename","doc":"Extracts filename from \"Content-Disposition\" header","summary":"

Extracts filename from "Content-Disposition" header

","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":58,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L58"},"def":{"name":"filename","return_type":"String | ::Nil","visibility":"Public","body":"filename_regex = /filename\\*?=['\"]?(?:UTF-\\d['\"]*)?([^;\\r\\n\"']*)['\"]?;?/ix\nif match_data = (http_client_res.headers.fetch(\"Content-Disposition\", \"\")).match(filename_regex)\n return match_data[1]\nend\n"}},{"html_id":"headers-instance-method","name":"headers","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":45,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L45"},"def":{"name":"headers","visibility":"Public","body":"normalize_headers(http_client_res.headers)"}},{"html_id":"history:Array-instance-method","name":"history","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":53,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L53"},"def":{"name":"history","return_type":"Array","visibility":"Public","body":"@request.redirection_history"}},{"html_id":"http_client_res:HTTP::Client::Response-instance-method","name":"http_client_res","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":18,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L18"},"def":{"name":"http_client_res","visibility":"Public","body":"@http_client_res"}},{"html_id":"informational?(*args,**options)-instance-method","name":"informational?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"informational?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.informational?(*args, **options)"}},{"html_id":"informational?(*args,**options,&)-instance-method","name":"informational?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"informational?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.informational?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"inspect-instance-method","name":"inspect","doc":"Returns an unambiguous and information-rich string representation of this\nobject, typically intended for developers.\n\nThis method should usually **not** be overridden. It delegates to\n`#inspect(IO)` which can be overridden for custom implementations.\n\nAlso see `#to_s`.","summary":"

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":87,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L87"},"def":{"name":"inspect","visibility":"Public","body":"\"\""}},{"html_id":"invalid?-instance-method","name":"invalid?","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":71,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L71"},"def":{"name":"invalid?","visibility":"Public","body":"status_code < 100 || status_code >= 600"}},{"html_id":"redirect?-instance-method","name":"redirect?","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":75,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L75"},"def":{"name":"redirect?","visibility":"Public","body":"[301, 302, 303, 307, 308].includes?(status_code)"}},{"html_id":"redirection?(*args,**options)-instance-method","name":"redirection?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"redirection?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.redirection?(*args, **options)"}},{"html_id":"redirection?(*args,**options,&)-instance-method","name":"redirection?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"redirection?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.redirection?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"request:Crest::Request-instance-method","name":"request","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":18,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L18"},"def":{"name":"request","visibility":"Public","body":"@request"}},{"html_id":"return!:Crest::Response-instance-method","name":"return!","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":31,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L31"},"def":{"name":"return!","return_type":"Crest::Response","visibility":"Public","body":"redirector = Redirector.new(self, request)\nredirector.follow\n"}},{"html_id":"return!(&block:Crest::Response->)-instance-method","name":"return!","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":36,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L36"},"def":{"name":"return!","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crest::Response ->)"},"visibility":"Public","body":"redirector = Redirector.new(self, request)\nredirector.follow(&block)\n"}},{"html_id":"server_error?(*args,**options)-instance-method","name":"server_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"server_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.server_error?(*args, **options)"}},{"html_id":"server_error?(*args,**options,&)-instance-method","name":"server_error?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"server_error?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.server_error?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"status(*args,**options)-instance-method","name":"status","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":22,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L22"},"def":{"name":"status","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.status(*args, **options)"}},{"html_id":"status(*args,**options,&)-instance-method","name":"status","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":22,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L22"},"def":{"name":"status","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.status(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"status_code(*args,**options)-instance-method","name":"status_code","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":23,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L23"},"def":{"name":"status_code","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"http_client_res.status_code(*args, **options)"}},{"html_id":"status_code(*args,**options,&)-instance-method","name":"status_code","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":23,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L23"},"def":{"name":"status_code","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"http_client_res.status_code(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"success?(*args,**options)-instance-method","name":"success?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"success?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.success?(*args, **options)"}},{"html_id":"success?(*args,**options,&)-instance-method","name":"success?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":24,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L24"},"def":{"name":"success?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.success?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_curl(*args,**options)-instance-method","name":"to_curl","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/crest/response.cr","line_number":25,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L25"},"def":{"name":"to_curl","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"request.to_curl(*args, **options)"}},{"html_id":"to_curl(*args,**options,&)-instance-method","name":"to_curl","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/crest/response.cr","line_number":25,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L25"},"def":{"name":"to_curl","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"request.to_curl(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"to_s(io:IO):Nil-instance-method","name":"to_s","doc":"Appends a short String representation of this object\nwhich includes its class name and its object address.\n\n```\nclass Person\n def initialize(@name : String, @age : Int32)\n end\nend\n\nPerson.new(\"John\", 32).to_s # => #\n```","summary":"

Appends a short String representation of this object which includes its class name and its object address.

","abstract":false,"args":[{"name":"io","external_name":"io","restriction":"IO"}],"args_string":"(io : IO) : Nil","args_html":"(io : IO) : Nil","location":{"filename":"src/crest/response.cr","line_number":79,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L79"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":"IO"}],"return_type":"Nil","visibility":"Public","body":"{% if (compare_versions(Crystal::VERSION, \"1.1.1\")) > 0 %}\n io.write_string(body.to_slice)\n {% else %}\n io.write_utf8(body.to_slice)\n {% end %}"}},{"html_id":"url:String-instance-method","name":"url","abstract":false,"location":{"filename":"src/crest/response.cr","line_number":41,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/response.cr#L41"},"def":{"name":"url","return_type":"String","visibility":"Public","body":"@request.url"}}]},{"html_id":"crest/Crest/TimeoutValue","path":"Crest/TimeoutValue.html","kind":"alias","full_name":"Crest::TimeoutValue","name":"TimeoutValue","abstract":false,"locations":[{"filename":"src/crest.cr","line_number":43,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest.cr#L43"}],"repository_name":"crest","program":false,"enum":false,"alias":true,"aliased":"(Float32 | Int32 | Time::Span)","aliased_html":"Float32 | Int32 | Time::Span","const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"}},{"html_id":"crest/Crest/UrlencodedForm","path":"Crest/UrlencodedForm.html","kind":"class","full_name":"Crest::UrlencodedForm(T)","name":"UrlencodedForm","abstract":false,"superclass":{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},"ancestors":[{"html_id":"crest/Crest/Form","kind":"class","full_name":"Crest::Form","name":"Form"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/forms/urlencoded_form.cr","line_number":8,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L8"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"doc":"This class lets `crest` emulate a filled-in form\nin which a user has pressed the submit button.\nThis causes `crest` to POST data using the\n\"Content-Type\" `application/x-www-form-urlencoded`.","summary":"

This class lets crest emulate a filled-in form in which a user has pressed the submit button.

","instance_methods":[{"html_id":"generate-instance-method","name":"generate","abstract":false,"location":{"filename":"src/crest/forms/urlencoded_form.cr","line_number":11,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L11"},"def":{"name":"generate","visibility":"Public","body":"@form_data = parsed_params\nself\n"}},{"html_id":"parsed_params-instance-method","name":"parsed_params","abstract":false,"location":{"filename":"src/crest/forms/urlencoded_form.cr","line_number":17,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/forms/urlencoded_form.cr#L17"},"def":{"name":"parsed_params","visibility":"Public","body":"@params_encoder.encode(@params)"}}]},{"html_id":"crest/Crest/ZeroEnumeratedFlatParamsEncoder","path":"Crest/ZeroEnumeratedFlatParamsEncoder.html","kind":"class","full_name":"Crest::ZeroEnumeratedFlatParamsEncoder","name":"ZeroEnumeratedFlatParamsEncoder","abstract":false,"superclass":{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder"},"ancestors":[{"html_id":"crest/Crest/EnumeratedFlatParamsEncoder","kind":"class","full_name":"Crest::EnumeratedFlatParamsEncoder","name":"EnumeratedFlatParamsEncoder"},{"html_id":"crest/Crest/ParamsEncoder","kind":"class","full_name":"Crest::ParamsEncoder","name":"ParamsEncoder"},{"html_id":"crest/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr#L2"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"crest/Crest","kind":"module","full_name":"Crest","name":"Crest"},"class_methods":[{"html_id":"array_start_index-class-method","name":"array_start_index","abstract":false,"location":{"filename":"src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr","line_number":3,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/crest/params_encoders/zero_enumerated_flat_params_encoder.cr#L3"},"def":{"name":"array_start_index","visibility":"Public","body":"@@array_start_index"}}]}]},{"html_id":"crest/Float","path":"Float.html","kind":"struct","full_name":"Float","name":"Float","abstract":true,"superclass":{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},"ancestors":[{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},{"html_id":"crest/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"crest/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"crest/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ext/float.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/float.cr#L1"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"doc":"Float is the base type of all floating point numbers.\n\nThere are two floating point types, `Float32` and `Float64`,\nwhich correspond to the [binary32](http://en.wikipedia.org/wiki/Single_precision_floating-point_format)\nand [binary64](http://en.wikipedia.org/wiki/Double_precision_floating-point_format)\ntypes defined by IEEE.\n\nA floating point literal is an optional `+` or `-` sign, followed by\na sequence of numbers or underscores, followed by a dot,\nfollowed by numbers or underscores, followed by an optional exponent suffix,\nfollowed by an optional type suffix. If no suffix is present, the literal's type is `Float64`.\n\n```\n1.0 # Float64\n1.0_f32 # Float32\n1_f32 # Float32\n\n1e10 # Float64\n1.5e10 # Float64\n1.5e-7 # Float64\n\n+1.3 # Float64\n-0.5 # Float64\n```\n\nThe underscore `_` before the suffix is optional.\n\nUnderscores can be used to make some numbers more readable:\n\n```\n1_000_000.111_111 # better than 1000000.111111\n```\n\nSee [`Float` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/floats.html) in the language reference.","summary":"

Float is the base type of all floating point numbers.

","instance_methods":[{"html_id":"to_time_span:Time::Span-instance-method","name":"to_time_span","abstract":false,"location":{"filename":"src/ext/float.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/float.cr#L2"},"def":{"name":"to_time_span","return_type":"Time::Span","visibility":"Public","body":"seconds = self.to_i\nnanoseconds = ((self - seconds) * 1000000000).to_i\nTime::Span.new(seconds: seconds, nanoseconds: nanoseconds)\n"}}]},{"html_id":"crest/Int","path":"Int.html","kind":"struct","full_name":"Int","name":"Int","abstract":true,"superclass":{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},"ancestors":[{"html_id":"crest/Number","kind":"struct","full_name":"Number","name":"Number"},{"html_id":"crest/Steppable","kind":"module","full_name":"Steppable","name":"Steppable"},{"html_id":"crest/Comparable","kind":"module","full_name":"Comparable","name":"Comparable"},{"html_id":"crest/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"crest/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ext/int.cr","line_number":1,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/int.cr#L1"}],"repository_name":"crest","program":false,"enum":false,"alias":false,"const":false,"doc":"Int is the base type of all integer types.\n\nThere are four signed integer types: `Int8`, `Int16`, `Int32` and `Int64`,\nbeing able to represent numbers of 8, 16, 32 and 64 bits respectively.\nThere are four unsigned integer types: `UInt8`, `UInt16`, `UInt32` and `UInt64`.\n\nAn integer literal is an optional `+` or `-` sign, followed by\na sequence of digits and underscores, optionally followed by a suffix.\nIf no suffix is present, the literal's type is `Int32`, or `Int64` if the\nnumber doesn't fit into an `Int32`:\n\n```\n1 # Int32\n\n1_i8 # Int8\n1_i16 # Int16\n1_i32 # Int32\n1_i64 # Int64\n\n1_u8 # UInt8\n1_u16 # UInt16\n1_u32 # UInt32\n1_u64 # UInt64\n\n+10 # Int32\n-20 # Int32\n\n2147483648 # Int64\n```\n\nLiterals without a suffix that are larger than `Int64::MAX` represent a\n`UInt64` if the number fits, e.g. `9223372036854775808` and\n`0x80000000_00000000`. This behavior is deprecated and will become an error in\nthe future.\n\nThe underscore `_` before the suffix is optional.\n\nUnderscores can be used to make some numbers more readable:\n\n```\n1_000_000 # better than 1000000\n```\n\nBinary numbers start with `0b`:\n\n```\n0b1101 # == 13\n```\n\nOctal numbers start with `0o`:\n\n```\n0o123 # == 83\n```\n\nHexadecimal numbers start with `0x`:\n\n```\n0xFE012D # == 16646445\n0xfe012d # == 16646445\n```\n\nSee [`Integer` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/integers.html) in the language reference.","summary":"

Int is the base type of all integer types.

","instance_methods":[{"html_id":"to_time_span:Time::Span-instance-method","name":"to_time_span","abstract":false,"location":{"filename":"src/ext/int.cr","line_number":2,"url":"https://github.com/mamantoha/crest/blob/f13381c8c6ab57a49f66f3466c40a188000dbce6/src/ext/int.cr#L2"},"def":{"name":"to_time_span","return_type":"Time::Span","visibility":"Public","body":"Time::Span.new(seconds: self)"}}]}]}}) \ No newline at end of file