Method: Libfchat::WebAPI#post

Defined in:
lib/libfchat/webapi.rb

#post(endpoint, params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/libfchat/webapi.rb', line 18

def post(endpoint, params)
  uri = URI("#{@baseurl}#{endpoint}")
  if @ticket
    params['ticket'] = @ticket
  end
  res = Net::HTTP.post_form(uri, params)
  json = MultiJson.load(res.body)
  if json['error'] != ""
    raise json['error']
  end
  return json
end