Skip to content

windthunder/tjplurk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

$ gem install tjplurk

Usage

api = Tjplurk::API.new CONSUMER_KEY, CONSUMER_SECRET, TOKEN_KEY, TOKEN_SECRET
api.request('/APP/Users/me') # => Hash object
api.request('/APP/Timeline/plurkAdd', content: 'haha', qualifier: 'says') # => Hash object

You can save your CONSUMER_KEY, CONSUMER_SECRET, TOKEN_KEY, TOKEN_SECRET in $HOME/.tjplurk per line, and Tjplurk::API.new will work as well, for example:

api = Tjplurk::API.new
api.request('/APP/Users/me')

Set ENV['TJPLURK_FILE'] to customize the config file path.

Real Time Notification

require 'tjplurk'

api = Tjplurk::API.new
api.real_time do |plurk|
  jj plurk
end

Examples

Command Line Usage

For the first time, you should use tjplurk auth to get access token and secret:

$ tjplurk auth CONSUMER_KEY CONSUMER_SECRET
Authorize URL: http://www.plurk.com/OAuth/authorize?oauth_token=************
Enter Verification Number: *****
Key & secret successfully saved to "$HOME/.tjplurk".

Your consumer key/secret and token key/secret will be saved to $HOME/.tjplurk. Then you can use all Plurk API:

$ tjplurk api /APP/Users/me
$ tjplurk api /APP/Timeline/plurkAdd "content=hello world" qualifier=says

For more available API paths, see http://www.plurk.com/API

Pretty print

$ tjplurk api /APP/Users/me | python -mjson.tool
$ tjplurk api /APP/Users/me | ruby -rjson -e 'jj JSON.parse(ARGF.read)'

Commands

tjplurk auth CONSUMER_KEY CONSUMER_SECRET  # get access token interactivly.
tjplurk api PATH ["FOO=BAR" ...]           # send an API request.

Develop

Before running rspec, please create $HOME/.tjplurk first.

About

Plurk API wrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%