class DDAPI::Item
Represents a DRPG item.
Attributes
desc[RW]
@return [String] The description of the item.
description[RW]
@return [String] The description of the item.
image[RW]
@return [String] The image URL to the item. `nil` if there is no image.
level[RW]
@return [Integer] The level of the item.
name[RW]
@return [String] The name of the item.
plural[RW]
@return [String] The plural name of the item.
prefix[RW]
@return [String] The prefix name of the item.
sell_price[RW]
@return [Integer, nil] The cost of the item. `nil` if not buyable.
sellable[RW]
@return [true, false] Whether the item is sellable.
tradeable[RW]
@return [true, false] Whether the item is tradeable.
type[RW]
@return [String] The type of the item.
Public Class Methods
new(data, app)
click to toggle source
# File lib/dd-api/classes.rb, line 214 def initialize(data, app) @data = data @name = data['name'] @level = data['level'] @description = data['desc'] @type = data['type'] @image = data['image'].nil? ? nil : API.image_url(data['image']) #@id = data['id'] @prefix = data['prefix'] @prefix = data['plural'] @sellable = data['sellable'] @tradeable = data['tradeable'] @sell_price = data['sell'] == -1 ? nil : data['sell'] @cost = data['cost'] == -1 ? nil : data['cost'] @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 232 def inspect "#<DDAPI::Item name=#{@name} id=#{@id} level=#{@level}>" end