Class: LibDiscord::Invite

Inherits:
Resource show all
Defined in:
lib/lib_discord/invite.rb

Overview

Invite Resource

Do not instantiate an Invite directly. Instead request one from an instance of Client.

client = LibDiscord::Client.new("Bot auth.token")
i = client["invite"]

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from LibDiscord::Resource

Instance Method Details

#delete_invite(invite_code:) ⇒ Response

Parameters:

  • invite_code (#to_s)

Returns:

Raises:

See Also:



43
44
45
# File 'lib/lib_discord/invite.rb', line 43

def delete_invite(invite_code:)
  send_request(:delete, "/invites/#{invite_code}")
end

#get_invite(invite_code:, params: {}) ⇒ Response

Parameters:

  • invite_code (#to_s)
  • params (Hash) (defaults to: {})

    optional HTTP query parameters

Returns:

Raises:

  • (TimeoutError)

    if the HTTP request times out

  • (ConstraintError)

    if params cannot be coerced into a valid query parameters string

See Also:



30
31
32
# File 'lib/lib_discord/invite.rb', line 30

def get_invite(invite_code:, params: {})
  send_request(:get, "/invites/#{invite_code}", params:)
end