Sha256: ef3847c68e97d3c17c1be38022bd27a6f4d8ecb96febc308e79bd93b346f2a15
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
#!/usr/bin/env ruby # This code nabbed from http://developer.37signals.com/campfire/ [http://developer.37signals.com/campfire/campfire.rb] require 'rubygems' require 'uri' require 'httparty' require 'json' class Campfire include HTTParty base_uri 'https://37s.campfirenow.com' basic_auth 'find_your_auth_key_on_member_slash_edit', 'x' headers 'Content-Type' => 'application/json' def self.rooms Campfire.get('/rooms.json')["rooms"] end def self.room(room_id) Room.new(room_id) end def self.user(id) Campfire.get("/users/#{id}.json")["user"] end end class Room attr_reader :room_id def initialize(room_id) @room_id = room_id end def join post 'join' end def leave post 'leave' end def lock post 'lock' end def unlock post 'unlock' end def message(message) send_message message end def paste(paste) send_message paste, 'PasteMessage' end def play_sound(sound) send_message sound, 'SoundMessage' end def transcript get('transcript')['messages'] end private def send_message(message, type = 'Textmessage') post 'speak', :body => {:message => {:body => message, :type => type}}.to_json end def get(action, options = {}) Campfire.get room_url_for(action), options end def post(action, options = {}) Campfire.post room_url_for(action), options end def room_url_for(action) "/room/#{room_id}/#{action}.json" end end report = JSON.parse(STDIN.read) campfire_url = URI.parse(ARGV[0]) Campfire.base_uri campfire_url.scheme + '://' + campfire_url.host Campfire.basic_auth ARGV[1], 'x' campfire_room_id = campfire_url.path[/\d+/] campfire_room = Campfire.room(campfire_room_id) campfire_room.message "#{report['project_name']} broke. Please take a look at #{ARGV[2]}"
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
crazy_ivan-1.1.1 | bin/test_report2campfire |
crazy_ivan-1.1.0 | bin/test_report2campfire |
crazy_ivan-1.0.0 | bin/test_report2campfire |