Class: LibDiscord::Response
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- LibDiscord::Response
- Defined in:
- lib/lib_discord/response.rb
Overview
Response
Response represents an HTTP response from Discord.
Instance Method Summary collapse
-
#body_parsed ⇒ Hash, ...
Returns the deserialized HTTP response body, usually parsed from JSON.
-
#body_raw ⇒ String
Returns the raw HTTP response body.
-
#code ⇒ Integer
Returns the HTTP response status code.
-
#headers ⇒ Hash{String=>(String, Array(String))}
Returns the HTTP response headers.
Instance Method Details
#body_parsed ⇒ Hash, ...
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.
41 |
# File 'lib/lib_discord/response.rb', line 41 attribute :body_parsed, Types::ResponseBody.optional |
#body_raw ⇒ String
Returns the raw HTTP response body.
30 |
# File 'lib/lib_discord/response.rb', line 30 attribute :body_raw, Types::Strict::String |
#code ⇒ Integer
Returns the HTTP response status code.
18 |
# File 'lib/lib_discord/response.rb', line 18 attribute :code, Types::Strict::Integer |
#headers ⇒ Hash{String=>(String, Array(String))}
Returns the HTTP response headers.
24 |
# File 'lib/lib_discord/response.rb', line 24 attribute :headers, Types::ResponseHeaders |