Class: Turntabler::Preferences
- Defined in:
- lib/turntabler/preferences.rb
Overview
Represents the site preferences for the authorized user
Instance Attribute Summary collapse
-
#facebook_awesome ⇒ Boolean
readonly
Publishes to facebook songs voted up in public rooms.
-
#facebook_dj ⇒ Boolean
readonly
Publishes to facebook when DJing in a public room.
-
#facebook_join ⇒ Boolean
readonly
Publishes to facebook when a public room is joined.
-
#notify_dj ⇒ Boolean
readonly
Send e-mails if a fan starts DJing.
-
#notify_fan ⇒ Boolean
readonly
Send e-mails when someone becomes a fan.
-
#notify_news ⇒ Boolean
readonly
Sends infrequent e-mails about news.
-
#notify_random ⇒ Boolean
readonly
Sends e-mails at random times with a different subsection of the digits of pi.
Attributes inherited from Resource
Instance Method Summary collapse
-
#load ⇒ true
Loads the user’s current Turntable preferences.
-
#update(attributes = {}) ⇒ true
Updates the user’s preferences.
Methods inherited from Resource
#==, attribute, #attributes=, #hash, #initialize, #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
#facebook_awesome ⇒ Boolean (readonly)
Publishes to facebook songs voted up in public rooms
24 |
# File 'lib/turntabler/preferences.rb', line 24 attribute :facebook_awesome |
#facebook_dj ⇒ Boolean (readonly)
Publishes to facebook when DJing in a public room
32 |
# File 'lib/turntabler/preferences.rb', line 32 attribute :facebook_dj |
#facebook_join ⇒ Boolean (readonly)
Publishes to facebook when a public room is joined
28 |
# File 'lib/turntabler/preferences.rb', line 28 attribute :facebook_join |
#notify_dj ⇒ Boolean (readonly)
Send e-mails if a fan starts DJing
8 |
# File 'lib/turntabler/preferences.rb', line 8 attribute :notify_dj |
#notify_fan ⇒ Boolean (readonly)
Send e-mails when someone becomes a fan
12 |
# File 'lib/turntabler/preferences.rb', line 12 attribute :notify_fan |
#notify_news ⇒ Boolean (readonly)
Sends infrequent e-mails about news
16 |
# File 'lib/turntabler/preferences.rb', line 16 attribute :notify_news |
#notify_random ⇒ Boolean (readonly)
Sends e-mails at random times with a different subsection of the digits of pi
20 |
# File 'lib/turntabler/preferences.rb', line 20 attribute :notify_random |
Instance Method Details
#load ⇒ true
Loads the user’s current Turntable preferences.
41 42 43 44 45 46 47 48 |
# File 'lib/turntabler/preferences.rb', line 41 def load data = api('user.get_prefs') self.attributes = data['result'].inject({}) do |result, (preference, value, *)| result[preference] = value result end super end |
#update(attributes = {}) ⇒ true
Updates the user’s preferences.
64 65 66 67 68 69 |
# File 'lib/turntabler/preferences.rb', line 64 def update(attributes = {}) assert_valid_values(attributes, :notify_dj, :notify_fan, :notify_news, :notify_random, :facebook_awesome, :facebook_join, :facebook_dj) api('user.edit_prefs', attributes) self.attributes = attributes true end |