Class: Google::Reader::Preference

Inherits:
Base
  • Object
show all
Defined in:
lib/google/reader/preference.rb

Constant Summary collapse

@@greader_preferences =
{}

Class Method Summary collapse

Methods inherited from Base

get_entries, get_token, parse, parse_json, user_info

Class Method Details

.[](pref) ⇒ Object

Gives access to an individual preference. Replace any dash in preference key with an underscore. (ie: mobile-num-entries is accessed using mobile_num_entries)

Usage:

Google::Reader::Preference[:design]
Google::Reader::Preference[:mobile_use_transcoder]


23
24
25
26
# File 'lib/google/reader/preference.rb', line 23

def [](pref)
  ensure_preferences_loaded
  @@greader_preferences[pref.to_s.gsub('_', '-')]
end

.availableObject

Returns a sorted list of all the available preference keys

Usage:

Google::Reader::Preference.available


11
12
13
14
# File 'lib/google/reader/preference.rb', line 11

def available
  ensure_preferences_loaded
  @@greader_preferences.keys.sort
end

.streamObject

Returns any preferences set for each feed and label. Not sure what this could be helpful for so I’m not sure how to make things easily accessible. Right now just returns straight up hash, not very useful.



32
33
34
# File 'lib/google/reader/preference.rb', line 32

def stream #:nodoc:
  parse_json(get(PREFERENCE_STREAM_URL))['streamprefs'].reject { |k,v| v == [] }
end