Class: DDAPI::Item
- Inherits:
-
Object
- Object
- DDAPI::Item
- Defined in:
- lib/dd-api/classes.rb,
lib/dd-api/classes.rb
Overview
Represents a DRPG guild item.
Instance Attribute Summary collapse
-
#description ⇒ String
(also: #desc)
The description of the item.
-
#image ⇒ String
The image URL to the item.
-
#level ⇒ Integer
(also: #lvl)
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 cost 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) ⇒ Integer
constructor
attr_accessor :id.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Constructor Details
#initialize(data, app) ⇒ Integer
attr_accessor :id
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/dd-api/classes.rb', line 229 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.
157 158 159 |
# File 'lib/dd-api/classes.rb', line 157 def description @description end |
#image ⇒ String
Returns The image URL to the item.
161 162 163 |
# File 'lib/dd-api/classes.rb', line 161 def image @image end |
#level ⇒ Integer Also known as: lvl
Returns The level of the item.
164 165 166 |
# File 'lib/dd-api/classes.rb', line 164 def level @level end |
#name ⇒ String
Returns The name of the item.
142 143 144 |
# File 'lib/dd-api/classes.rb', line 142 def name @name end |
#plural ⇒ String
Returns The plural name of the item.
151 152 153 |
# File 'lib/dd-api/classes.rb', line 151 def plural @plural end |
#prefix ⇒ String
Returns The prefix name of the item.
148 149 150 |
# File 'lib/dd-api/classes.rb', line 148 def prefix @prefix end |
#sell_price ⇒ Integer?
Returns The cost of the item. nil if not buyable.
145 146 147 |
# File 'lib/dd-api/classes.rb', line 145 def sell_price @sell_price end |
#sellable ⇒ true, false
Returns Whether the item is sellable.
171 172 173 |
# File 'lib/dd-api/classes.rb', line 171 def sellable @sellable end |
#tradeable ⇒ true, false
Returns Whether the item is tradeable.
177 178 179 |
# File 'lib/dd-api/classes.rb', line 177 def tradeable @tradeable end |
#type ⇒ String
Returns The type of the item.
154 155 156 |
# File 'lib/dd-api/classes.rb', line 154 def type @type end |
Instance Method Details
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
197 198 199 |
# File 'lib/dd-api/classes.rb', line 197 def inspect "#<DDAPI::Item name=#{@name} id=#{@id} level=#{@level}>" end |