Class: DDAPI::GuildItem

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

Overview

Represents a DRPG guild item.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, app) ⇒ Integer

attr_accessor :id



263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/dd-api/classes.rb', line 263

def initialize(data, app)
  @data = data
  @name = data['name']
  @level = data['level']
  @description = data['desc']
  @image = data['image'].nil? ? nil : API.image_url(data['image'])
  #@id = data['id']

  @prefix = data['prefix']
  @prefix = data['plural']
  @cost = data['cost'] == -1 ? nil : data['cost']
  @app = app
end

Instance Attribute Details

#descriptionString Also known as: desc

Returns The description of the item.

Returns:

  • (String)

    The description of the item.



251
252
253
# File 'lib/dd-api/classes.rb', line 251

def description
  @description
end

#imageString?

Returns The image URL to the item. nil if there is no image.

Returns:

  • (String, nil)

    The image URL to the item. nil if there is no image.



255
256
257
# File 'lib/dd-api/classes.rb', line 255

def image
  @image
end

#levelInteger

Returns The level of the item.

Returns:

  • (Integer)

    The level of the item.



258
259
260
# File 'lib/dd-api/classes.rb', line 258

def level
  @level
end

#nameString

Returns The name of the item.

Returns:

  • (String)

    The name of the item.



239
240
241
# File 'lib/dd-api/classes.rb', line 239

def name
  @name
end

#pluralString

Returns The plural name of the item.

Returns:

  • (String)

    The plural name of the item.



248
249
250
# File 'lib/dd-api/classes.rb', line 248

def plural
  @plural
end

#prefixString

Returns The prefix name of the item.

Returns:

  • (String)

    The prefix name of the item.



245
246
247
# File 'lib/dd-api/classes.rb', line 245

def prefix
  @prefix
end

#sell_priceInteger?

Returns The cost of the item. nil if not buyable.

Returns:

  • (Integer, nil)

    The cost of the item. nil if not buyable.



242
243
244
# File 'lib/dd-api/classes.rb', line 242

def sell_price
  @sell_price
end

Instance Method Details

#inspectObject

The inspect method is overwritten to give more useful output



277
278
279
# File 'lib/dd-api/classes.rb', line 277

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