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

Author:

  • Sebastian Staudt

Constant Summary collapse

@@golden_wrenches =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dateTime (readonly)

Returns the date this Golden Wrench has been crafted

Returns:

  • (Time)

    The crafting date of this wrench



21
22
23
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 21

def date
  @date
end

#idFixnum (readonly)

Returns the unique item ID of this Golden Wrench

Returns:

  • (Fixnum)

    The ID of this wrench



26
27
28
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 26

def id
  @id
end

#numberFixnum (readonly)

Returns the serial number of this Golden Wrench

Returns:

  • (Fixnum)

    The serial of this wrench



31
32
33
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 31

def number
  @number
end

#ownerSteamId (readonly)

Returns the SteamID of the owner of this Golden Wrench

Returns:

  • (SteamId)

    The owner of this wrench



36
37
38
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 36

def owner
  @owner
end

Class Method Details

.golden_wrenchesArray<GoldenWrench>

Returns all Golden Wrenches

Returns:

  • (Array<GoldenWrench>)

    All Golden Wrenches

Raises:



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/steam/community/tf2/tf2_golden_wrench.rb', line 45

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

    data = MultiJson.load(WebApi.json('ITFItems_440', 'GetGoldenWrenches', 2), { :symbolize_keys => true })
    data[:results][:wrenches].each do |wrench_data|
      @@golden_wrenches << TF2GoldenWrench.new(wrench_data)
    end
  end

  @@golden_wrenches
end