Permalink
Browse files

Merge pull request #5 from GrooveStomp/master

add/delete webhook wrapper attached to the form interface
  • Loading branch information...
2 parents 73a01ee + 1205d4e commit e9f837fda53b1ce110d636821a71fb7b12129094 @seven1m committed May 13, 2011
Showing with 17 additions and 0 deletions.
  1. +9 −0 README.rdoc
  2. +8 −0 lib/wuparty.rb
View
@@ -49,6 +49,15 @@ Make sure you have latest version installed (1.0.0 or higher).
if result['Success'] == 0
puts result['ErrorText']
end
+
+ # Add a webhook to your Wufoo form.
+ # Any submission to this form will now post to the given url.
+ result = form.add_webhook('http://www.postbin.org/zh9iy1')
+ result = form.delete_webhook(result["WebHookPutResult"]["Hash"])
+
+ # Or, directly through wufoo:
+ result = wufoo.add_webhook(FORM_ID, 'http://www.postbin.org/zh9iy1')
+ result = wufoo.delete_webhook(FORM_ID, result["WebHookPutResult"]["Hash"])
== Feedback
View
@@ -228,6 +228,14 @@ def [](id)
@details[id]
end
+ def add_webhook(url)
+ @party.add_webhook(@details["Hash"], url)
+ end
+
+ def delete_webhook(webhook_id)
+ @party.delete_webhook(@details["Hash"], webhook_id)
+ end
+
# Returns fields and subfields, as a flattened array, e.g.
# [{'ID' => 'Field1', 'Title' => 'Name - First', 'Type' => 'shortname', 'Required' => true }, # (subfield)
# {'ID' => 'Field2', 'Title' => 'Name - Last', 'Type' => 'shortname', 'Required' => true }, # (subfield)

0 comments on commit e9f837f

Please sign in to comment.