class DDAPI::Guild

Represents a DRPG guild.

Attributes

channel[RW]

@return [String, nil] The Discord Channel ID of the guild. `nil` if there is no channel.

deaths[RW]

@return [Integer] The combined deaths by the guild members.

desc[RW]

@return [String] The description of the guild.

description[RW]

@return [String] The description of the guild.

frags[RW]

@return [Integer] The combined deaths by the guild members.

gold[RW]

@return [Integer] The amount gold in the guild.

icon[RW]

@return [String] The icon of the guild.

icons[RW]

@return [Array<String>] Array of icons the guild has bought.

id[RW]

@return [Integer] The ID of the guild.

image[RW]

@return [String] The icon image URL to the guild's icon.

kills[RW]

@return [Integer] The combined enemies slain by the guild members.

leader[RW]

@return [User] The user object of the guild owner.

level[RW]

@return [Integer] The level of the guild.

level_requirement[RW]

@return [Integer] The level requirement of the guild.

max[RW]

@return [Integer] The maximum amount of people that can be in the guild.

name[RW]

@return [String] The name of the guild.

open[RW]

@return [true, false] Whether the guild is open.

owner[RW]

@return [User] The user object of the guild owner.

role[RW]

@return [String, nil] The Discord Role ID of the guild. `nil` if there is no role.

slain[RW]

@return [Integer] The combined enemies slain by the guild members.

Public Class Methods

new(data, app) click to toggle source
# File lib/dd-api/classes.rb, line 146
def initialize(data, app)
  @data = data
  # gdata = data['guild']
  gdata = data
  @name = data['name']
  @open = data['open']
  @level = gdata['level']
  @description = gdata['desc']
  @gold = gdata['gold']
  @kills = @data['slain']
  @deaths = @data['deaths']
  @icon = HTMLEntities.new.decode(gdata['icon'])
  @icon_url = API.guild_icon_url(gdata['icon'])
  @icons = gdata['icons'].map {|icon| HTMLEntities.new.decode(icon) }
  @id = data['id']
  @members = gdata['members']
  @level_requirement = gdata['levelreq']
  @max = gdata['max']
  @owner = @app.user(gdata['owner'])
  @role = gdata['role'].empty? ? nil : gdata['role']
  @channel = gdata['channel'].empty? ? nil : gdata['channel']
  @app = app
end

Public Instance Methods

inspect() click to toggle source

The inspect method is overwritten to give more useful output

# File lib/dd-api/classes.rb, line 171
def inspect
  "#<DDAPI::Guild name=#{@name} id=#{@id} level=#{@level}>"
end