Class: Google::Reader::Base

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

Direct Known Subclasses

Count, Item, Label, Preference, Search, Stream, Subscription

Class Method Summary collapse

Class Method Details

.get_entries(url, o = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/google/reader/base.rb', line 19

def get_entries(url, o={})
  options = {:continuation => true,}.merge(o)
  body    = get(url)
  if options[:continuation]
    entries = parse(body).entries
    entries.class.class_eval "attr_accessor :continuation"
    entries.continuation = extract_continuation(body)
    entries
  else
    parse(body).entries
  end
end

.get_tokenObject

Gets a new token which can be used with all non-get requests.



33
34
35
# File 'lib/google/reader/base.rb', line 33

def get_token
  get(TOKEN_URL)
end

.normalize_feed_url(feed_url) ⇒ Object



5
6
7
8
# File 'lib/google/reader/base.rb', line 5

def normalize_feed_url(feed_url)
  feed_url[0,5] = "" if feed_url[0,5] == "feed/"
  feed_url
end

.parse(atom_feed) ⇒ Object



10
11
12
# File 'lib/google/reader/base.rb', line 10

def parse(atom_feed)
  Atom::Feed.new(atom_feed)
end

.parse_json(json_str) ⇒ Object



14
15
16
17
# File 'lib/google/reader/base.rb', line 14

def parse_json(json_str)
  # JSON.parse(json_str)
  ActiveSupport::JSON.decode(json_str)
end

.user_infoObject

Last time I checked this returns a hash like:

{"isBloggerUser": true, "userId": "<user id number>", "userEmail": "[email protected]"}


39
40
41
# File 'lib/google/reader/base.rb', line 39

def 
  parse_json(get(USER_INFO_URL))
end