Class: BackpackTF::User

Inherits:
Response show all
Defined in:
lib/backpack_tf/user.rb

Constant Summary collapse

INTERFACE =
:IGetUsers
@@players =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Response

hash_keys_to_sym, interface, responses, to_sym

Constructor Details

#initialize(attr) ⇒ User

Returns a new instance of User.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/backpack_tf/user.rb', line 35

def initialize attr
  attr = check_attr_keys(attr)

  @steamid                = attr[:steamid]
  @success                = attr[:success]
  @backpack_value         = attr[:backpack_value]
  @backpack_update        = attr[:backpack_update]
  @name                   = attr[:name]
  @backpack_tf_reputation = attr[:backpack_tf_reputation]
  @backpack_tf_group      = attr[:backpack_tf_group]
  @backpack_tf_banned     = attr[:backpack_tf_banned]
  @backpack_tf_trust      = attr[:backpack_tf_trust]
  @steamrep_scammer       = attr[:steamrep_scammer]
  @ban_economy            = attr[:ban_economy]
  @ban_community          = attr[:ban_community]
  @ban_vac                = attr[:ban_vac]
  @notifications          = attr[:notifications]
end

Instance Attribute Details

#backpack_tf_bannedObject (readonly)

Returns the value of attribute backpack_tf_banned.



27
28
29
# File 'lib/backpack_tf/user.rb', line 27

def backpack_tf_banned
  @backpack_tf_banned
end

#backpack_tf_groupObject (readonly)

Returns the value of attribute backpack_tf_group.



26
27
28
# File 'lib/backpack_tf/user.rb', line 26

def backpack_tf_group
  @backpack_tf_group
end

#backpack_tf_reputationObject (readonly)

Returns the value of attribute backpack_tf_reputation.



25
26
27
# File 'lib/backpack_tf/user.rb', line 25

def backpack_tf_reputation
  @backpack_tf_reputation
end

#backpack_tf_trustObject (readonly)

Returns the value of attribute backpack_tf_trust.



28
29
30
# File 'lib/backpack_tf/user.rb', line 28

def backpack_tf_trust
  @backpack_tf_trust
end

#backpack_updateObject (readonly)

Returns the value of attribute backpack_update.



23
24
25
# File 'lib/backpack_tf/user.rb', line 23

def backpack_update
  @backpack_update
end

#backpack_valueObject (readonly)

Returns the value of attribute backpack_value.



22
23
24
# File 'lib/backpack_tf/user.rb', line 22

def backpack_value
  @backpack_value
end

#ban_communityObject (readonly)

Returns the value of attribute ban_community.



31
32
33
# File 'lib/backpack_tf/user.rb', line 31

def ban_community
  @ban_community
end

#ban_economyObject (readonly)

Returns the value of attribute ban_economy.



30
31
32
# File 'lib/backpack_tf/user.rb', line 30

def ban_economy
  @ban_economy
end

#ban_vacObject (readonly)

Returns the value of attribute ban_vac.



32
33
34
# File 'lib/backpack_tf/user.rb', line 32

def ban_vac
  @ban_vac
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/backpack_tf/user.rb', line 24

def name
  @name
end

#notificationsObject (readonly)

Returns the value of attribute notifications.



33
34
35
# File 'lib/backpack_tf/user.rb', line 33

def notifications
  @notifications
end

#steamidObject (readonly)

Returns the value of attribute steamid.



20
21
22
# File 'lib/backpack_tf/user.rb', line 20

def steamid
  @steamid
end

#steamrep_scammerObject (readonly)

Returns the value of attribute steamrep_scammer.



29
30
31
# File 'lib/backpack_tf/user.rb', line 29

def steamrep_scammer
  @steamrep_scammer
end

#successObject (readonly)

Returns the value of attribute success.



21
22
23
# File 'lib/backpack_tf/user.rb', line 21

def success
  @success
end

Class Method Details

.playersObject



12
13
14
15
16
17
18
# File 'lib/backpack_tf/user.rb', line 12

def self.players
  return @response if response.nil?
  @@players = response[:players].inject({}) do |players, (steamid, attr)|
    players[steamid] = new(attr)
    players 
  end
end

.responseObject



8
9
10
# File 'lib/backpack_tf/user.rb', line 8

def self.response
  @response = superclass.responses[to_sym]
end