/campy

Tiny Campfire Ruby client so you can get on with it.

Primary LanguageRubyMIT LicenseMIT

Campy Build Status Dependency Status

Tiny Campfire Ruby client so you can get on with it. It's implemented on top of Net::HTTP and only requires the multi_json gem for Ruby compatibilities.

Installation

Add this line to your application's Gemfile:

gem 'campy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install campy

Usage

First create a campfire.yml file in your home directory:

$ cat <<CAMPFIRE_YAML > $HOME/.campfire.yml
:account: mysubdomain
:token: mytoken123
:room: House of Hubot
CAMPFIRE_YAML

campy Command

Campy comes with the campy command so you can send messages from the command line:

$ campy speak "Campy says yello"
$ campy paste "Long pastes are long"
$ campy play ohmy

Or pipe in your message:

$ echo "Campy tries to honor unix conventions" | campy speak
$ cat ~/stackdump.log | campy paste
$ echo ohmy | campy play

Ruby Library

There's not much to the API; create a Campy::Room and go:

require 'campy'

campy = Campy::Room.new(:account => "mysubdomain",
  :token => "mytoken123", :room => "House of Hubot")
campy.speak "Campy says yello"
campy.paste "Long pastes are long"
campy.play "ohmy"

If you know the room ID and would prefer to use that instead of the name:

require 'campy'

campy = Campy::Room.new(:account => "mysubdomain",
  :token => "mytoken123", :room_id => "12345")
campy.speak "Campy says yello"
campy.paste "Long pastes are long"
campy.play "ohmy"

Why not use the campfire.yml config? Let's do that:

require 'campy'
require 'yaml'

campy = Campy::Room.new(YAML.load_file(
  File.expand_path("~/.campfire.yml")))
campy.speak "Campy says yello"
campy.paste "Long pastes are long"
campy.play "ohmy"

Development

Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:

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

Authors

Created and maintained by Fletcher Nichol (fnichol@nichol.ca)

License

MIT (see LICENSE)