Class: TF2GoldenWrench

Inherits:
Object
  • Object
show all
Defined in:
lib/steam/community/tf2/tf2_golden_wrench.rb

Overview

Represents the special Team Fortress 2 item Golden Wrench. It includes the ID of the item, the serial number of the wrench, a reference to the SteamId of the owner and the date this player crafted the wrench

Constant Summary collapse

@@golden_wrenches =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



15
16
17
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 15

def date
  @date
end

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 15

def id
  @id
end

#numberObject (readonly)

Returns the value of attribute number.



15
16
17
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 15

def number
  @number
end

#ownerObject (readonly)

Returns the value of attribute owner.



15
16
17
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 15

def owner
  @owner
end

Class Method Details

.golden_wrenchesObject

Returns an array of all golden wrenches (as instances of TF2GoldenWrench)



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 20

def self.golden_wrenches
  if @@golden_wrenches.nil?
    @@golden_wrenches = []

    data = JSON.parse(WebApi.json('ITFItems_440', 'GetGoldenWrenches'), { :symbolize_names => true })
    data[:results][:wrenches][:wrench].each do |wrench_data|
      @@golden_wrenches << TF2GoldenWrench.new(wrench_data)
    end
  end

  @@golden_wrenches
end