Class: BackpackTF::SpecialItem
- Defined in:
- lib/backpack_tf/special_item.rb
Constant Summary collapse
- INTERFACE =
:IGetSpecialItems- @@items =
{}
Instance Attribute Summary collapse
-
#appid ⇒ Object
readonly
Returns the value of attribute appid.
-
#defindex ⇒ Object
readonly
Returns the value of attribute defindex.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#image_url_large ⇒ Object
readonly
Returns the value of attribute image_url_large.
-
#image_url_large_orig ⇒ Object
readonly
Returns the value of attribute image_url_large_orig.
-
#image_url_orig ⇒ Object
readonly
Returns the value of attribute image_url_orig.
-
#item_class ⇒ Object
readonly
Returns the value of attribute item_class.
-
#item_description ⇒ Object
readonly
Returns the value of attribute item_description.
-
#item_name ⇒ Object
readonly
Returns the value of attribute item_name.
-
#item_quality ⇒ Object
readonly
Returns the value of attribute item_quality.
-
#item_type_name ⇒ Object
readonly
Returns the value of attribute item_type_name.
-
#max_ilevel ⇒ Object
readonly
Returns the value of attribute max_ilevel.
-
#min_ilevel ⇒ Object
readonly
Returns the value of attribute min_ilevel.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#proper_name ⇒ Object
readonly
Returns the value of attribute proper_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, attr) ⇒ SpecialItem
constructor
A new instance of SpecialItem.
Methods inherited from Response
hash_keys_to_sym, interface, responses, to_sym
Constructor Details
#initialize(name, attr) ⇒ SpecialItem
Returns a new instance of SpecialItem.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/backpack_tf/special_item.rb', line 38 def initialize name, attr attr = check_attr_keys(attr) @name = name @item_name = attr[:item_name] @defindex = attr[:defindex] @item_class = attr[:item_class] @item_type_name = attr[:item_type_name] @item_description = attr[:item_description] @proper_name = attr[:proper_name] @item_quality = attr[:item_quality] @min_ilevel = attr[:min_ilevel] @max_ilevel = attr[:max_ilevel] @image_url = attr[:image_url] @image_url_large = attr[:image_url_large] @image_url_orig = attr[:image_url_orig] @image_url_large_orig = attr[:image_url_large_orig] @appid = attr[:appid] end |
Instance Attribute Details
#appid ⇒ Object (readonly)
Returns the value of attribute appid.
36 37 38 |
# File 'lib/backpack_tf/special_item.rb', line 36 def appid @appid end |
#defindex ⇒ Object (readonly)
Returns the value of attribute defindex.
24 25 26 |
# File 'lib/backpack_tf/special_item.rb', line 24 def defindex @defindex end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
32 33 34 |
# File 'lib/backpack_tf/special_item.rb', line 32 def image_url @image_url end |
#image_url_large ⇒ Object (readonly)
Returns the value of attribute image_url_large.
33 34 35 |
# File 'lib/backpack_tf/special_item.rb', line 33 def image_url_large @image_url_large end |
#image_url_large_orig ⇒ Object (readonly)
Returns the value of attribute image_url_large_orig.
35 36 37 |
# File 'lib/backpack_tf/special_item.rb', line 35 def image_url_large_orig @image_url_large_orig end |
#image_url_orig ⇒ Object (readonly)
Returns the value of attribute image_url_orig.
34 35 36 |
# File 'lib/backpack_tf/special_item.rb', line 34 def image_url_orig @image_url_orig end |
#item_class ⇒ Object (readonly)
Returns the value of attribute item_class.
25 26 27 |
# File 'lib/backpack_tf/special_item.rb', line 25 def item_class @item_class end |
#item_description ⇒ Object (readonly)
Returns the value of attribute item_description.
27 28 29 |
# File 'lib/backpack_tf/special_item.rb', line 27 def item_description @item_description end |
#item_name ⇒ Object (readonly)
Returns the value of attribute item_name.
23 24 25 |
# File 'lib/backpack_tf/special_item.rb', line 23 def item_name @item_name end |
#item_quality ⇒ Object (readonly)
Returns the value of attribute item_quality.
29 30 31 |
# File 'lib/backpack_tf/special_item.rb', line 29 def item_quality @item_quality end |
#item_type_name ⇒ Object (readonly)
Returns the value of attribute item_type_name.
26 27 28 |
# File 'lib/backpack_tf/special_item.rb', line 26 def item_type_name @item_type_name end |
#max_ilevel ⇒ Object (readonly)
Returns the value of attribute max_ilevel.
31 32 33 |
# File 'lib/backpack_tf/special_item.rb', line 31 def max_ilevel @max_ilevel end |
#min_ilevel ⇒ Object (readonly)
Returns the value of attribute min_ilevel.
30 31 32 |
# File 'lib/backpack_tf/special_item.rb', line 30 def min_ilevel @min_ilevel end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/backpack_tf/special_item.rb', line 22 def name @name end |
#proper_name ⇒ Object (readonly)
Returns the value of attribute proper_name.
28 29 30 |
# File 'lib/backpack_tf/special_item.rb', line 28 def proper_name @proper_name end |
Class Method Details
.items ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/backpack_tf/special_item.rb', line 12 def self.items return @response if @response.nil? @@items = response[:items].inject({}) do |hash, item| #item = hash_keys_to_sym(item) name = item['name'] hash[name] = new(name, item) hash end end |
.response ⇒ Object
8 9 10 |
# File 'lib/backpack_tf/special_item.rb', line 8 def self.response @response = superclass.responses[to_sym] end |