Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

a simple api client for readability

branch: master

Merge pull request #9 from 29decibel/confidence-api

READY add confidence api support #8
latest commit f352941719
dongbin li authored May 20, 2013
Octocat-spinner-32 features add tags support December 31, 2012
Octocat-spinner-32 lib bump version to 0.1.0 May 20, 2013
Octocat-spinner-32 spec add confidence api support May 20, 2013
Octocat-spinner-32 .gitignore add rails support January 21, 2012
Octocat-spinner-32 .travis.yml update travis.yml March 27, 2013
Octocat-spinner-32 Gemfile add confidence api support May 20, 2013
Octocat-spinner-32 Guardfile add test January 18, 2012
Octocat-spinner-32 Rakefile init January 18, 2012
Octocat-spinner-32 Readme.md add codeclimate status image March 26, 2013
Octocat-spinner-32 readit.gemspec change respond result to Mash type February 20, 2012
Readme.md

Simple api client of Readability Build Status Code Climate

Installation

gem install readit

or in your rails gemfile

gem 'readit'
# or latest (recommend)
gem 'readit',:git=>'git@github.com:29decibel/readit.git'

Configuration

Rails

config/readability.yml

development:
  consumer_key: some_key
  consumer_secret: some_secret
  parser_token: some_parser_token

or in your code

Readit::Config.consumer_key = some_key
Readit::Config.consumer_secret = some_value
Readit::Config.parser_token = some_parser_token

API usage

Initialize api client

@api = Readit::API.new 'access_token','access_token_secret'

User info

# get user info
@api.me

Bookmarks

# get all bookmarks, result will be a hash array
@api.bookmarks
# get bookmarks along with meta info :
# item_count, item_count_total, num_pages, page
bookmarks,meta = @api.bookmarks(:include_meta => true)

# add bookmark
bookmark_info = @api.bookmark(:url=>'http://some_article_url.html')
# check bookmarked infos
# bookmark_info.bookmark_id
# bookmark_info.article_id

# get bookmark by bookmark_id
@api.bookmarks :bookmark_id => some_bookmark_id

# archive a bookmark
@api.archive some_bookmark_id

# favorite a bookmark
@api.favorite some_bookmark_id

# or you can just call update_bookmark to
# update a bookmark to favorited or archived
@api.update_bookmark bookmark_id,:favorite => 1,:archive => 0

Tags

# get all tags of current user
@api.all_tags # [#<Hashie::Mash id=39086 text="rails">, #<Hashie::Mash id=39085 text="ruby">, #<Hashie::Mash id=39087 text="tag3">]

# add tags to one bookmark
@api.add_tags bookmark_id, "tag1,tag2,tag3"

# fetch all tags of one bookmark
@api.tags bookmark_id

# remove tag from one bookmark
@api.remove_tag bookmark_id, tag_id

Get Article

# get one artile by article_id
@api.article 'article_id'

Parser

# create a parser client
@parser = Readit::Parser.new "some_parser_token"
# parse one url
@parser.parse some_url
# now you will get a object with title, content, etc.

At last but not least

Contributions are welcome!

Something went wrong with that request. Please try again.