Class: GoogleReaderApi::Api
- Inherits:
-
Object
- Object
- GoogleReaderApi::Api
- Defined in:
- lib/google-reader-api-uniq/api.rb
Constant Summary collapse
- BASE_URL =
"http://www.google.com/reader/"
Instance Method Summary collapse
- #cached_unread_count ⇒ Object
-
#get_link(link, args = {}) ⇒ Object
do a get request to the link args is a hash of values that should be used in the request.
-
#initialize(options) ⇒ Api
constructor
specify either the :email and :password or the :auth token you got in the past.
- #post_link(link, args = {}) ⇒ Object
Constructor Details
#initialize(options) ⇒ Api
specify either the :email and :password or the :auth token you got in the past
-
the user’s email address for login purposes
- :password
-
the user’s password for login purposes
- :auth
-
the auth token you got from a previous authentication request if you provide this you do not need to provide the email and password
19 20 21 22 23 24 25 26 |
# File 'lib/google-reader-api-uniq/api.rb', line 19 def initialize() if [:auth] @auth = [:auth] else request_auth([:email],[:password]) end @cache = GoogleReaderApi::Cache.new(2) end |
Instance Method Details
#cached_unread_count ⇒ Object
40 41 42 |
# File 'lib/google-reader-api-uniq/api.rb', line 40 def cached_unread_count @cache['unread-count'] ||= get_link 'api/0/unread-count', :output => :json end |
#get_link(link, args = {}) ⇒ Object
do a get request to the link args is a hash of values that should be used in the request
30 31 32 33 |
# File 'lib/google-reader-api-uniq/api.rb', line 30 def get_link(link,args={}) link = BASE_URL + link get_request(link,args) end |
#post_link(link, args = {}) ⇒ Object
35 36 37 38 |
# File 'lib/google-reader-api-uniq/api.rb', line 35 def post_link(link,args={}) link = BASE_URL + link post_request(link,args) end |