Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tonytonyjan/tjplurk
Plurk API wrapper
https://github.com/tonytonyjan/tjplurk
Last synced: about 1 month ago
JSON representation
Plurk API wrapper
- Host: GitHub
- URL: https://github.com/tonytonyjan/tjplurk
- Owner: tonytonyjan
- Created: 2014-06-13T16:28:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-15T01:17:46.000Z (over 7 years ago)
- Last Synced: 2024-10-13T07:52:46.574Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Install
```
$ gem install tjplurk
```## Usage
```ruby
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:
```ruby
api = Tjplurk::API.new
api.request('/APP/Users/me')
```Set `ENV['TJPLURK_FILE']` to customize the config file path.
### Real Time Notification
```ruby
require 'tjplurk'api = Tjplurk::API.new
api.real_time do |plurk|
jj plurk
end
```### Examples
- [Echo](https://github.com/tonytonyjan/tjplurk/blob/master/examples/echo.rb)
- [Plurk Robot](https://github.com/tonytonyjan/tjplurk/blob/master/examples/robot.rb)## 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.