Class: DDAPI::Item
- Inherits:
-
Object
- Object
- DDAPI::Item
- Defined in:
- lib/dd-api/classes.rb
Overview
Represents a DRPG item.
Instance Attribute Summary collapse
-
#description ⇒ String
(also: #desc)
The description of the item.
-
#image ⇒ String
The image URL to the item.
-
#level ⇒ Integer
The level of the item.
-
#name ⇒ String
The name of the item.
-
#plural ⇒ String
The plural name of the item.
-
#prefix ⇒ String
The prefix name of the item.
-
#sell_price ⇒ Integer?
The sell price of the item.
-
#sellable ⇒ true, false
Whether the item is sellable.
-
#tradeable ⇒ true, false
Whether the item is tradeable.
-
#type ⇒ String
The type of the item.
Instance Method Summary collapse
-
#initialize(data, app) ⇒ Item
constructor
A new instance of Item.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Constructor Details
#initialize(data, app) ⇒ Item
Returns a new instance of Item.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/dd-api/classes.rb', line 209 def initialize(data, app) @data = data @name = data['name'] @level = data['level'] @description = data['desc'] @type = data['type'] @image = 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 |
Instance Attribute Details
#description ⇒ String Also known as: desc
Returns The description of the item.
188 189 190 |
# File 'lib/dd-api/classes.rb', line 188 def description @description end |
#image ⇒ String
Returns The image URL to the item.
192 193 194 |
# File 'lib/dd-api/classes.rb', line 192 def image @image end |
#level ⇒ Integer
Returns The level of the item.
195 196 197 |
# File 'lib/dd-api/classes.rb', line 195 def level @level end |
#name ⇒ String
Returns The name of the item.
173 174 175 |
# File 'lib/dd-api/classes.rb', line 173 def name @name end |
#plural ⇒ String
Returns The plural name of the item.
182 183 184 |
# File 'lib/dd-api/classes.rb', line 182 def plural @plural end |
#prefix ⇒ String
Returns The prefix name of the item.
179 180 181 |
# File 'lib/dd-api/classes.rb', line 179 def prefix @prefix end |
#sell_price ⇒ Integer?
Returns The sell price of the item. nil if not sellable.
176 177 178 |
# File 'lib/dd-api/classes.rb', line 176 def sell_price @sell_price end |
#sellable ⇒ true, false
Returns Whether the item is sellable.
201 202 203 |
# File 'lib/dd-api/classes.rb', line 201 def sellable @sellable end |
#tradeable ⇒ true, false
Returns Whether the item is tradeable.
207 208 209 |
# File 'lib/dd-api/classes.rb', line 207 def tradeable @tradeable end |
#type ⇒ String
Returns The type of the item.
185 186 187 |
# File 'lib/dd-api/classes.rb', line 185 def type @type end |
Instance Method Details
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
227 228 229 |
# File 'lib/dd-api/classes.rb', line 227 def inspect "#<DDAPI::Item name=#{@name} id=#{@id} level=#{@level}>" end |