GithubHelp home page GithubHelp logo

alistar79 / firering Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emmanueloga/firering

0.0 1.0 0.0 224 KB

Eventmachine powered Campfire API

Home Page: http://www.rubydoc.info/github/EmmanuelOga/firering/master/frames

License: MIT License

Ruby 100.00%

firering's Introduction

firering

Campfire API interface powered by eventmachine, em-http-request and yajl-ruby.

require 'firering'

print "Enter subdomain: "; subdomain = gets.chomp
print "Enter user: "     ; login     = gets.chomp
print "Enter password: " ; password  = gets.chomp

conn = Firering::Connection.new("http://#{subdomain}.campfirenow.com") do |c|
  c.login = login
  c.password = password
  c.max_retries = 10 # default to -1, which means perform connection retries on drop forever.
end

EM.run do
  conn.authenticate do |user|
    conn.rooms do |rooms|

      rooms.each do |room|
        if room.name == "Room Name"

          room.stream do |message|
            message.user { |user| puts "#{user}: #{message}" }
          end

        end
      end

    end
  end

  trap("INT") { EM.stop }
end

campf-notify

The gem bundles an executable script for spawning libnotify powered notifications. To be able to use it, check your distro package repositories for the apropriate package containing the “notify-send” command line utility. In the case of archlinux, the package name is “libnotify”.

The script needs the following environment variables in place:

CAMPFIRE_SUBDOMAIN
CAMPFIRE_TOKEN

Once the variables are set, run the script as follows:

campf-notify room-name /path/to/an/icon.png

And watch the lovely notifications each time something is posted to a room.

Running the specs

When the specs are run a process is forked where a Rack application is run. This rack application serves all the fixtured responses that mimic the working of the real campfire app. The only caveat here is you may get a conflict if you are already running something on the port (8909). If this happens you’ll need to open the specs/spec_helper.rb file and change the port used to run the fixtures server.

For more details take a look at spec/fixtures/load_server.rb file.

TODO

  • Better API documentation

  • Post files to a room

  • Retrieve recently uploaded files

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Contributors

Copyright © 2010 Emmanuel Oga. See LICENSE for details.

firering's People

Contributors

indirect avatar caius avatar franckverrot avatar gdb avatar semanticart avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.