Class: LibDiscord::Response

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/lib_discord/response.rb

Overview

Response

Response represents an HTTP response from Discord.

See Also:

Instance Method Summary collapse

Instance Method Details

#body_parsedHash, ...

Note:

If we receive a content-type that we cannot parse/deserialize, body_parsed will be nil.

Returns the deserialized HTTP response body, usually parsed from JSON. The exact structure and content-type differs per Discord API endpoint. Consult a given endpoint’s Discord documentation for details.

Returns:

  • (Hash, Array, nil)


41
# File 'lib/lib_discord/response.rb', line 41

attribute :body_parsed, Types::ResponseBody.optional

#body_rawString

Returns the raw HTTP response body.

Returns:

  • (String)


30
# File 'lib/lib_discord/response.rb', line 30

attribute :body_raw, Types::Strict::String

#codeInteger

Returns the HTTP response status code.

Returns:

  • (Integer)


18
# File 'lib/lib_discord/response.rb', line 18

attribute :code, Types::Strict::Integer

#headersHash{String=>(String, Array(String))}

Returns the HTTP response headers.

Returns:

  • (Hash{String=>(String, Array(String))})


24
# File 'lib/lib_discord/response.rb', line 24

attribute :headers, Types::ResponseHeaders