kimotter

A Ruby client for posting tweets from the command line. Instead of using the Twitter API directly, it posts by driving the mala API (a web posting form that lived at http://api.ma.la/twitter/) with Mechanize. It was published as a gem.

Usage

Requires Ruby 1.9 plus nokogiri and mechanize (per the README).

gem install kimotter
kimotter "ツイート本文"

Before posting, you are asked to agree to a confirmation message extracted from the page. Example run from the README.

> kimotter "EventSource知らんかった、普通に便利そう"
嘘偽りなく自分がキモトであると誓います[y/N] y
hi kimoto. try to tweet your cool message
done!

There are two options: -d, --debug (debug mode) and -f, --force (run while ignoring the API limit).

Internals

Component layout. It’s a small gem of roughly 170 lines total, built as two layers: the Kimotter class that drives the form, and KimotterCLI which handles the interactive side.

Component diagram of kimotter

The flow of a single post looks like this.

Sequence diagram of kimotter’s tweet flow

Exit codes: 0 on success, 1 when stopped by the API limit, 2 when the confirmation prompt got EOF, and 3 when declined with anything other than y.