Class: LibDiscord::Response

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

Overview

A Response is returned from any Client public instance method call in which the HTTP request sent to Discord receives a response.

Instance Attribute Summary collapse

Instance Attribute Details

#bodyString (readonly)

Returns raw HTTP response body.

Returns:

  • (String)

    raw HTTP response body.



2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/lib_discord/client.rb', line 2728

Response = Struct.new(
  :success?,
  :body,
  :parsed,
  :code,
  :message,
  keyword_init: true
)

#codeString (readonly)

Returns HTTP response code.

Returns:

  • (String)

    HTTP response code.



2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/lib_discord/client.rb', line 2728

Response = Struct.new(
  :success?,
  :body,
  :parsed,
  :code,
  :message,
  keyword_init: true
)

#messageString (readonly)

Returns HTTP response message.

Returns:

  • (String)

    HTTP response message.

See Also:



2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/lib_discord/client.rb', line 2728

Response = Struct.new(
  :success?,
  :body,
  :parsed,
  :code,
  :message,
  keyword_init: true
)

#parsedObject? (readonly)

Returns object representation of the HTTP response body parsed with JSON.parse if the HTTP response’s content-type is application/json, nil otherwise.

Returns:

  • (Object, nil)

    object representation of the HTTP response body parsed with JSON.parse if the HTTP response’s content-type is application/json, nil otherwise.

See Also:



2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/lib_discord/client.rb', line 2728

Response = Struct.new(
  :success?,
  :body,
  :parsed,
  :code,
  :message,
  keyword_init: true
)

#success?Boolean (readonly)

Returns true if the HTTP response code is 2xx, false otherwise.

Returns:

  • (Boolean)

    true if the HTTP response code is 2xx, false otherwise.



2728
2729
2730
2731
2732
2733
2734
2735
# File 'lib/lib_discord/client.rb', line 2728

Response = Struct.new(
  :success?,
  :body,
  :parsed,
  :code,
  :message,
  keyword_init: true
)