Permalink
Browse files

Add add/delete webhook methods to the form itself, for added convenie…

…nce.
  • Loading branch information...
1 parent 75c6e7c commit 1205d4ea9e8c455fe8702bc8438317181bafae64 @GrooveStomp GrooveStomp committed May 13, 2011
Showing with 12 additions and 2 deletions.
  1. +4 −2 README.rdoc
  2. +8 −0 lib/wuparty.rb
View
@@ -52,9 +52,11 @@ Make sure you have latest version installed (1.0.0 or higher).
# Add a webhook to your Wufoo form.
# Any submission to this form will now post to the given url.
- result = wufoo.add_webhook(FORM_ID, 'http://www.postbin.org/zh9iy1')
+ result = form.add_webhook('http://www.postbin.org/zh9iy1')
+ result = form.delete_webhook(result["WebHookPutResult"]["Hash"])
- # Remove the specified webhook from your Wufoo form.
+ # 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 1205d4e

Please sign in to comment.