Module: Discordrb::API::Invite

Defined in:
lib/discordrb/api/invite.rb

Overview

API calls for Invite object

Class Method Summary collapse

Class Method Details

.accept(token, invite_code) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/discordrb/api/invite.rb', line 34

def accept(token, invite_code)
  Discordrb::API.request(
    :invite_code,
    nil,
    :post,
    "#{Discordrb::API.api_base}/invites/#{invite_code}",
    nil,
    Authorization: token
  )
end

.delete(token, code, reason = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/discordrb/api/invite.rb', line 21

def delete(token, code, reason = nil)
  Discordrb::API.request(
    :invites_code,
    nil,
    :delete,
    "#{Discordrb::API.api_base}/invites/#{code}",
    Authorization: token,
    'X-Audit-Log-Reason': reason
  )
end

.resolve(token, invite_code, counts = true) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/discordrb/api/invite.rb', line 9

def resolve(token, invite_code, counts = true)
  Discordrb::API.request(
    :invite_code,
    nil,
    :get,
    "#{Discordrb::API.api_base}/invites/#{invite_code}#{counts ? '?with_counts=true' : ''}",
    Authorization: token
  )
end