4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/testpayboard.rb', line 4
def self.world2
begin
if current_user
uri = URI.parse("http://app.payboard.com")
payload = [{ "customerId" => "2", "customerName" => "General+", "customerUserFirstName" => current_user.first, "customerUserLastName" => current_user.last, "customerUserEmail" => current_user.email, "customerUserId" => current_user.id, "eventName" => self.controller_name + "-" + self.action_name + "-" + request.method + "-" + (flash[:notice].nil? ? "" : flash[:notice].truncate(50)) }].to_json
req = Net::HTTP::Post.new("/api/organizations/a5078a13-2ea5-4dc9-929b-9913ca2c0741/customeruserevents", = {'Content-Type' =>'application/json'})
req.body = payload
response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }
end
rescue
puts "no data logged"
end
end
|