Class: Pocket::Client
- Inherits:
-
API
- Object
- API
- Pocket::Client
- Defined in:
- lib/pocket/client.rb
Overview
Wrapper for the Pocket REST API
Instance Method Summary collapse
-
#add(params) ⇒ Object
http://getpocket.com/developer/docs/v3/add required params: url, consumer_key, access_token.
- #favorite(item_id) ⇒ Object
-
#modify(actions) ⇒ Object
http://getpocket.com/developer/docs/v3/modify required params: actions, consumer_key, access_token.
-
#retrieve(params = {}) ⇒ Object
http://getpocket.com/developer/docs/v3/retrieve required params: consumer_key, access_token.
- #unfavorite(item_id) ⇒ Object
Methods included from OAuth
#authorize_url, #get_access_token, #get_code, #get_result
Instance Method Details
#add(params) ⇒ Object
http://getpocket.com/developer/docs/v3/add required params: url, consumer_key, access_token
6 7 8 9 |
# File 'lib/pocket/client.rb', line 6 def add params response = connection.post("/v3/add", params) response.body end |
#favorite(item_id) ⇒ Object
25 26 27 |
# File 'lib/pocket/client.rb', line 25 def favorite(item_id) modify([action: "favorite", item_id: item_id]) end |
#modify(actions) ⇒ Object
http://getpocket.com/developer/docs/v3/modify required params: actions, consumer_key, access_token
13 14 15 16 |
# File 'lib/pocket/client.rb', line 13 def modify actions response = connection.post("/v3/send", {actions: actions}) response.body end |
#retrieve(params = {}) ⇒ Object
http://getpocket.com/developer/docs/v3/retrieve required params: consumer_key, access_token
20 21 22 23 |
# File 'lib/pocket/client.rb', line 20 def retrieve params = {} response = connection.post("/v3/get", params) response.body end |
#unfavorite(item_id) ⇒ Object
29 30 31 |
# File 'lib/pocket/client.rb', line 29 def unfavorite(item_id) modify([action: "unfavorite", item_id: item_id]) end |