Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nudded/GoogleReaderAPI
a google reader api (unofficial) written in ruby
https://github.com/nudded/GoogleReaderAPI
Last synced: 3 months ago
JSON representation
a google reader api (unofficial) written in ruby
- Host: GitHub
- URL: https://github.com/nudded/GoogleReaderAPI
- Owner: nudded
- License: mit
- Created: 2010-02-01T19:43:04.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2013-04-09T08:30:36.000Z (almost 12 years ago)
- Last Synced: 2024-10-19T16:47:48.570Z (4 months ago)
- Language: Ruby
- Homepage:
- Size: 166 KB
- Stars: 60
- Watchers: 5
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.mdown
- License: License
Awesome Lists containing this 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.phpUsage
-----If you would like to implement your own methods, you can quite easily use
the api class provided.
api = GoogleReaderApi::Api.new {:email => '[email protected]', :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 => :subscribeThe 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 => '[email protected]', :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 easyuser.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.