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.
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.
form a hash containing form data (or a raw string)
+
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 (&).
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.
+
+
1xx: Informational - Request received, continuing process
+
2xx: Success - The action was successfully received, understood, and
+accepted
+
3xx: Redirection - Further action must be taken in order to complete the
+request
+
4xx: Client Error - The request contains bad syntax or cannot be fulfilled
+
5xx: Server Error - The server failed to fulfill an apparently valid
+request
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
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.
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.
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:
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:
:form - a hash containing form data (or a raw string or IO or Bytes)
+
:headers - a hash containing the request headers
+
:cookies - a hash containing the request cookies
+
: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 (&)
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:
+
+
default parameters from initializer
+
parameters provided in call method (get, post, etc)
+
+
This is especially useful if you wish to define your site in one place and
+call it in multiple locations.
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.
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.
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\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
"},{"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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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.
","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.
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":"
","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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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":"
","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) = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
'
+ );
+
+ 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\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
"},{"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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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.
","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.
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":"
","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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>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":"
","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":"
","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) = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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":"
","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 = {} ofString=>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 = {} ofString=>String, *, headers = {} ofString=>String, params = {} ofString=>String, cookies = {} ofString=>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 = {} ofString=>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