From 96d49bf04ce77c975fe500f4d961e4a1ffed4c26 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 30 Dec 2012 14:43:00 +0200 Subject: Use sdoc to generate application code documentation --- doc/code/classes/WebHook.html | 168 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 doc/code/classes/WebHook.html (limited to 'doc/code/classes/WebHook.html') diff --git a/doc/code/classes/WebHook.html b/doc/code/classes/WebHook.html new file mode 100644 index 00000000000..54097dd30e5 --- /dev/null +++ b/doc/code/classes/WebHook.html @@ -0,0 +1,168 @@ + + + + + WebHook + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + +
Included Modules
+
    + +
  • + + HTTParty + +
  • + +
+ + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/web_hook.rb, line 25
+def execute(data)
+  parsed_url = URI.parse(url)
+  if parsed_url.userinfo.blank?
+    WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" })
+  else
+    post_url = url.gsub("#{parsed_url.userinfo}@", "")
+    WebHook.post(post_url,
+                 body: data.to_json,
+                 headers: {"Content-Type" => "application/json"},
+                 basic_auth: {username: parsed_url.user, password: parsed_url.password})
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file -- cgit v1.2.1