Class: Jaconda::Notification

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/jaconda/notification.rb

Class Method Summary collapse

Class Method Details

.authenticate(options) ⇒ Object



6
7
8
9
10
11
# File 'lib/jaconda/notification.rb', line 6

def self.authenticate(options)
  self.site = "https://#{options[:subdomain]}.jaconda.im"
  @room_id = options[:room_id]
  self.user = options[:room_token]
  self.password = "x"
end

.notify(params = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/jaconda/notification.rb', line 13

def self.notify(params = {})
  options = {:room_id => @room_id}
  headers = {"Content-Type"=>"application/x-www-form-urlencoded"}
  body = CGI.unescape({message: params}.to_query)
  connection.post(custom_method_collection_url(:notify, options), body, headers)
end