0.03
No commit activity in last 3 years
No release in over 3 years
a google reader api (unofficial) written in ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

GoogleReaderAPI

A Google Reader api. Programmed in ruby. This is an unofficial api. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

Usage

If you would like to implement your own methods, you can quite easily use the api class provided.

api = GoogleReaderApi::Api.new {:email => 'example@gmail.com', :password => 'the pass'}

# OR

api = GoogleReaderApi::Api.new {:auth => 'token'}

# OR If your token was getted from oauth2 (bearer token)

api = GoogleReaderApi::Api.new {:auth => 'token', :auth_type => :bearer}    

and then you can perform requests using the get_link and post_link methods.

# this will give the user info.
api.get_link "api/0/user-info"

# this will add a feed 
api.post_link 'api/0/subscription/edit', :s => "feed/#{url}" , :ac => :subscribe

The following methods all use the Api class, so there is no magic involved.

# password should be asked by the app using the api
# you probably don't want to type that in cleartext here
user = GoogleReaderApi::User.new {:email => 'example@gmail.com', :password => 'the pass'}

# OR

user = GoogleReaderApi::User.new {:auth => 'token'}

you can access your feeds from there

user.feeds

which will return an array of GoogleReader::Feed objects. then you can get the unread items, the read items, ...

hn = user.feeds.find {|feed| feed.title =~ /hacker news/i }
# return 3 unread items (ordered by date)
hn.unread_items(3)
# return all the read items
hn.read_items
# all the starred items
hn.starred_items

you get the idea. you can like items, star items, and mark them as read or unread.

hn.all_unread_items.each {|item| item.toggle_read}

subscribing to new feeds is also easy

user.subscriptions.add "any feed url here"

unsubscribing is best done via remove_if method

user.subscriptions.remove_if {|feed| feed.title =~ /hacker news/i}

Todo

  • provide nicer convenience methods. (user.subscriptions.feeds is not a good way to access your feeds).
  • labels should be part of the api.