Module: Ezcomet

Defined in:
lib/ezcomet.rb,
lib/ezcomet/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.flush(api_key, user_name, channel) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/ezcomet.rb', line 19

def self.flush(api_key, user_name, channel)
  data = {:qname => "#{user_name}-#{channel}", :api_key => api_key, :flush => 1}

  http = Curl.post @ezcomet_write_url, data
  ret = JSON.parse http.body_str

  return false if 'ok' != ret['code']
  ret['code']

end

.push(api_key, user_name, channel, msg) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/ezcomet.rb', line 8

def self.push(api_key, user_name, channel, msg)
  data = {:qname => "#{user_name}-#{channel}", :api_key => api_key, :msg => msg}

  http = Curl.post @ezcomet_write_url, data
  ret = JSON.parse http.body_str

  return false if 'ok' != ret['code']
  ret['tick']

end