Yet Another Qiita API Wrapper
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.rvmrc
.simplecov
.travis.yml
Gemfile
LICENSE.md
README.md
Rakefile
kiita.gemspec

README.md

Kiita

Yet Another Qiita API Wrapper.

Build Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'kiita'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kiita

Usage

Public APIs

See rate_limit

rate = Kiita::API.rate_limit

rate["remaning"] # => 148
rate["limit"]    # => 150

Get an authentication token

auth = Kiita::API.authenticate("user", "password")

auth["url_name"] # => "user"
auth["token"]    # => "a875scr65rc86a5s¡Ä"

Get a user's information

user = Kiita::API.user("yuki24")

user.class       # => Kiita:;User
user.name        # => "Yuki Nishijima"
user.location    # => "Tokyo, Japan"
user.description # => "I'm a guy."

Get a user's posts

posts = Kiita::API.user("yuki24").posts
post = posts.first

post.class # => Kiita::Post
post.title # => "I'm a title!"
post.body  # => "I'm a body!"

APIs that require authentication

First create an object with the token like this:

user = Kiita::API.new(token: "a875scr65rc86a5s")

then you can do the followings.

Get my information

user.me # => your information

Get your stocks

user.stocks # collection of the posts that you stocked before.

Stock a post

user.stock!("e6654a3b258b7c6b7d1") # => true if success

Unstock a post

user.unstock!("e6654a3b258b7c6b7d1") # => true if success

Configuration

Kiita currently doesn't allow to configure anything. But in the near future, it will support some confgurations like timeout and keep alive.

Support

  • Ruby 1.9.2, 1.9.3

Note that Ruby 1.8.7 is NOT supported.

TODO

  1. Implementation of the APIs that use POST, PUT or DELETE
  2. Writing up rdoc as well as this README

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2012 Yuki Nishijima. See LICENSE.md for further details.