Class: DDAPI::Guild

Inherits:
Object
  • Object
show all
Defined in:
lib/dd-api/classes.rb

Overview

Represents a DRPG guild.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, app) ⇒ Guild

Returns a new instance of Guild.



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/dd-api/classes.rb', line 120

def initialize(data, app)
  @data = data
  @gdata = data['guild']
  @name = data['name']
  @level = gdata['level']
  @description = gdata['desc']
  @gold = gdata['gold']
  @icon = HTMLEntities.new.decode(gdata['icon'])
  @id = data['id']
  @members = gdata['members']
  @owner = @app.user(gdata['owner'])
  @app = app
end

Instance Attribute Details

#descriptionString Also known as: desc

Returns The description of the guild.

Returns:

  • (String)

    The description of the guild.



104
105
106
# File 'lib/dd-api/classes.rb', line 104

def description
  @description
end

#goldInteger

Returns The amount gold in the guild.

Returns:

  • (Integer)

    The amount gold in the guild.



108
109
110
# File 'lib/dd-api/classes.rb', line 108

def gold
  @gold
end

#icontrue, false

Returns The icon of the guild.

Returns:

  • (true, false)

    The icon of the guild.



118
119
120
# File 'lib/dd-api/classes.rb', line 118

def icon
  @icon
end

#idInteger

Returns The ID of the guild.

Returns:

  • (Integer)

    The ID of the guild.



115
116
117
# File 'lib/dd-api/classes.rb', line 115

def id
  @id
end

#levelInteger Also known as: lvl

Returns The level of the guild.

Returns:

  • (Integer)

    The level of the guild.



111
112
113
# File 'lib/dd-api/classes.rb', line 111

def level
  @level
end

#nameString

Returns The name of the guild.

Returns:

  • (String)

    The name of the guild.



97
98
99
# File 'lib/dd-api/classes.rb', line 97

def name
  @name
end

#ownerUser Also known as: leader

Returns The user object of the guild owner.

Returns:

  • (User)

    The user object of the guild owner.



100
101
102
# File 'lib/dd-api/classes.rb', line 100

def owner
  @owner
end

Instance Method Details

#inspectObject

The inspect method is overwritten to give more useful output



135
136
137
# File 'lib/dd-api/classes.rb', line 135

def inspect
  "#<DDAPI::Guild name=#{@name} id=#{@id} level=#{@level}>"
end