Class: Turntabler::Avatar
Overview
Represents an avatar for DJ’ing
Instance Attribute Summary collapse
-
#acl ⇒ Fixnum
readonly
The access control required to activate this avatar.
-
#minimum_points ⇒ Fixnum
readonly
The minimum points required to activate this avatar.
Attributes inherited from Resource
Instance Method Summary collapse
-
#available? ⇒ Boolean
Determines whether this avatar is available to the current user.
-
#set ⇒ true
Updates the current user’s avatar to this one.
Methods inherited from Resource
#==, attribute, #attributes=, #hash, #initialize, #load, #loaded?, #pretty_print, #pretty_print_instance_variables
Methods included from Assertions
#assert_valid_keys, #assert_valid_values
Methods included from DigestHelpers
Constructor Details
This class inherits a constructor from Turntabler::Resource
Instance Attribute Details
#acl ⇒ Fixnum (readonly)
The access control required to activate this avatar
12 |
# File 'lib/turntabler/avatar.rb', line 12 attribute :acl |
#minimum_points ⇒ Fixnum (readonly)
The minimum points required to activate this avatar
8 |
# File 'lib/turntabler/avatar.rb', line 8 attribute :minimum_points, :min |
Instance Method Details
#available? ⇒ Boolean
Determines whether this avatar is available to the current user.
17 18 19 |
# File 'lib/turntabler/avatar.rb', line 17 def available? client.user.points >= minimum_points && (!acl || client.user.acl >= acl) end |
#set ⇒ true
Updates the current user’s avatar to this one.
27 28 29 30 31 32 |
# File 'lib/turntabler/avatar.rb', line 27 def set api('user.set_avatar', :avatarid => id) client.user.attributes = {'avatarid' => id} client.user.avatar.attributes = {'min' => minimum_points, 'acl' => acl} true end |