lib/messenger/campfire.rb in messenger-0.3.0 vs lib/messenger/campfire.rb in messenger-0.3.1
- old
+ new
@@ -1,6 +1,6 @@
-require 'typhoeus'
+require 'httparty'
require 'json'
class Messenger::Campfire
def self.valid_url?(url)
@@ -13,10 +13,10 @@
# campfire://api-key:room-id@subdomain.campfirenow.com
def self.deliver(url, body, options={})
raise Messenger::URLError, "The URL provided is invalid" unless valid_url?(url)
ssl, api_key, room, subdomain = matcher(url)
options[:headers] ||= {}
- response = Typhoeus::Request.post(
+ response = HTTParty.post(
"http#{ssl ? "s" : ""}://#{api_key}:x@#{subdomain}.campfirenow.com/room/#{room}/speak.json",
:headers => { "Content-Type" => "application/json"}.merge(options[:headers]),
:body => { "message" => { "body" => body } }.to_json
)
Messenger::Result.new(success?(response), response)