mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-04-27 14:57:44 +00:00
update readme examples for 1.0
This commit is contained in:
parent
6e606f516c
commit
0a94dce118
1 changed files with 26 additions and 44 deletions
70
README.md
70
README.md
|
|
@ -1,4 +1,8 @@
|
||||||
# Instapaper
|
# Instapaper [][travis] [][gemnasium]
|
||||||
|
|
||||||
|
[travis]: http://travis-ci.org/stve/instapaper
|
||||||
|
[gemnasium]: https://gemnasium.com/stve/instapaper
|
||||||
|
|
||||||
|
|
||||||
Instapaper is a ruby wrapper for interacting with [Instapaper's Full Developer API](http://www.instapaper.com/api/full). Note that access to the Full API is restricted to Instapaper subscribers only.
|
Instapaper is a ruby wrapper for interacting with [Instapaper's Full Developer API](http://www.instapaper.com/api/full). Note that access to the Full API is restricted to Instapaper subscribers only.
|
||||||
|
|
||||||
|
|
@ -13,11 +17,11 @@ Instapaper offers full support for all methods exposed through the Full API. No
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.configure do |config|
|
client = Instapaper::Client.new do |client|
|
||||||
config.consumer_key = YOUR_CONSUMER_KEY
|
client.consumer_key = YOUR_CONSUMER_KEY
|
||||||
config.consumer_secret = YOUR_CONSUMER_SECRET
|
client.consumer_secret = YOUR_CONSUMER_SECRET
|
||||||
config.oauth_token = YOUR_OAUTH_TOKEN
|
client.access_token = YOUR_OAUTH_TOKEN
|
||||||
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
|
client.access_token_secret = YOUR_OAUTH_TOKEN_SECRET
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -26,13 +30,13 @@ end
|
||||||
To obtain an access token via xAuth:
|
To obtain an access token via xAuth:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.access_token(username, password)
|
client.token(username, password)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also verify credentials once you have received tokens:
|
You can also verify credentials once you have received tokens:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.verify_credentials
|
client.verify_credentials
|
||||||
```
|
```
|
||||||
|
|
||||||
## Bookmark Operations
|
## Bookmark Operations
|
||||||
|
|
@ -40,51 +44,51 @@ Instapaper.verify_credentials
|
||||||
Retrieve a list of bookmarks:
|
Retrieve a list of bookmarks:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.bookmarks
|
clientclient.bookmarks
|
||||||
```
|
```
|
||||||
|
|
||||||
Add a new bookmark:
|
Add a new bookmark:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.add_bookmark('http://someurl.com', :title => 'This is the title', :description => 'This is the description')
|
client.add_bookmark('http://someurl.com', :title => 'This is the title', :description => 'This is the description')
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove a bookmark:
|
Remove a bookmark:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.delete_bookmark(bookmark_id)
|
client.delete_bookmark(bookmark_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
Update read progress:
|
Update read progress:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.update_read_progress(bookmark_id, 0.5)
|
client.update_read_progress(bookmark_id, 0.5)
|
||||||
```
|
```
|
||||||
|
|
||||||
Star/Un-star a bookmark:
|
Star/Un-star a bookmark:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.star(bookmark_id)
|
client.star_bookmark(bookmark_id)
|
||||||
Instapaper.unstar(bookmark_id)
|
client.unstar_bookmark(bookmark_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
Archive/Un-archive a bookmark:
|
Archive/Un-archive a bookmark:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.archive(bookmark_id)
|
client.archive_bookmark(bookmark_id)
|
||||||
Instapaper.unarchive(bookmark_id)
|
client.unarchive_bookmark(bookmark_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
Move a bookmark to a folder:
|
Move a bookmark to a folder:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.move(bookmark_id, folder_id)
|
client.move_bookmark(bookmark_id, folder_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
Obtain the text of a bookmark:
|
Obtain the text of a bookmark:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.text(bookmark_id)
|
client.get_text(bookmark_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Folder Operations
|
## Folder Operations
|
||||||
|
|
@ -93,49 +97,27 @@ Instapaper.text(bookmark_id)
|
||||||
To obtain the list of folders:
|
To obtain the list of folders:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.folders
|
client.folders
|
||||||
```
|
```
|
||||||
|
|
||||||
You can add by passing a name:
|
You can add by passing a name:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.add_folder('eventmachine')
|
client.add_folder('eventmachine')
|
||||||
```
|
```
|
||||||
|
|
||||||
And remove folders by referencing a folder by it's id.
|
And remove folders by referencing a folder by it's id.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.delete_folder(folder_id)
|
client.delete_folder(folder_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
Lastly, the folders can be reordered:
|
Lastly, the folders can be reordered:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Instapaper.set_order(['folder_id1:2','folder_id2:1'])
|
client.set_order(['folder_id1:2','folder_id2:1'])
|
||||||
```
|
```
|
||||||
|
|
||||||
## Restrictions
|
|
||||||
|
|
||||||
Users without an Instapaper Subscription may only invoke the following calls:
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
Instapaper.access_token
|
|
||||||
Instapaper.verify_credentials
|
|
||||||
Instapaper.add_bookmark
|
|
||||||
Instapaper.folders
|
|
||||||
```
|
|
||||||
|
|
||||||
## <a name="build"></a>Build Status
|
|
||||||
[][travis]
|
|
||||||
|
|
||||||
[travis]: http://travis-ci.org/stve/instapaper
|
|
||||||
|
|
||||||
## <a name="dependencies"></a>Dependency Status
|
|
||||||
[][gemnasium]
|
|
||||||
|
|
||||||
[gemnasium]: https://gemnasium.com/stve/instapaper
|
|
||||||
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
[http://rdoc.info/gems/instapaper](http://rdoc.info/gems/instapaper)
|
[http://rdoc.info/gems/instapaper](http://rdoc.info/gems/instapaper)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue