Sha256: 3ffca6d280478cfa437f04fc1bd18f21437a82367b1c3cad288f4dabc019643f

Contents?: true

Size: 552 Bytes

Versions: 3

Compression:

Stored size: 552 Bytes

Contents

require 'yaml'

require 'rubygems'
require 'httparty'
require 'json'

class CampfireNotifier
  include HTTParty

  headers     'Content-type' => 'application/json'
  format      :json

  def self.config
    @config ||= YAML.load_file(File.expand_path("~/.campfire_notifier.yml"))
  end

  def self.speak(message)
    base_uri    "http://#{config['subdomain']}.campfirenow.com"
    basic_auth  config["token"], 'x'
    post "/room/#{config['room_id']}/speak.json", :body => { :message => { :body => message, :type => 'Textmessage' } }.to_json
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
campfire-notifier-0.1.2 lib/campfire_notifier.rb
campfire-notifier-0.1.1 lib/campfire_notifier.rb
campfire-notifier-0.1.0 lib/campfire_notifier.rb