Class: DBio::DiscordConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/dbio/discord_connection.rb

Overview

Find information about a Discord Connection.

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ DiscordConnection

Initialize the connection


4
5
6
# File 'lib/dbio/discord_connection.rb', line 4

def initialize(data)
  @data = data
end

Instance Method Details

#iconString

The icon is used on the website, it's a Font Awesome icon code. Not really useful unless you're making a site with the gem, in which case you'd probably do: <a href=“<%= @connection.url %>”><i class=“<%= @connection.icon %>”></i> <%= @connection.name %></a> Which could return: <a href=“twitter.com/twitter”> class=“fab fa-twitter”></i> Twitter</a>

Returns:

  • (String)

    the font awesome icon code for this connection


30
31
32
# File 'lib/dbio/discord_connection.rb', line 30

def icon
  @data['icon']
end

#nameString

Returns the name as it appears on the Discord profile.

Returns:

  • (String)

    the name as it appears on the Discord profile


15
16
17
# File 'lib/dbio/discord_connection.rb', line 15

def name
  @data['name']
end

#typeString

The type of Discord connection, e.g. Twitter, YouTube, etc.

Returns:

  • (String)

    the type of connection


10
11
12
# File 'lib/dbio/discord_connection.rb', line 10

def type
  @data['connection_type']
end

#urlString

Returns the URL to the connection as it is on the Discord profile.

Returns:

  • (String)

    the URL to the connection as it is on the Discord profile


20
21
22
# File 'lib/dbio/discord_connection.rb', line 20

def url
  @data['url']
end