Skip to content

Commit

Permalink
Add add/delete webhook methods to the form itself, for added convenie…
Browse files Browse the repository at this point in the history
…nce.
  • Loading branch information
GrooveStomp committed May 13, 2011
1 parent 75c6e7c commit 1205d4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.rdoc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ Make sure you have latest version installed (1.0.0 or higher).


# Add a webhook to your Wufoo form. # Add a webhook to your Wufoo form.
# Any submission to this form will now post to the given url. # 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"]) result = wufoo.delete_webhook(FORM_ID, result["WebHookPutResult"]["Hash"])


== Feedback == Feedback
Expand Down
8 changes: 8 additions & 0 deletions lib/wuparty.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ def [](id)
@details[id] @details[id]
end 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. # Returns fields and subfields, as a flattened array, e.g.
# [{'ID' => 'Field1', 'Title' => 'Name - First', 'Type' => 'shortname', 'Required' => true }, # (subfield) # [{'ID' => 'Field1', 'Title' => 'Name - First', 'Type' => 'shortname', 'Required' => true }, # (subfield)
# {'ID' => 'Field2', 'Title' => 'Name - Last', 'Type' => 'shortname', 'Required' => true }, # (subfield) # {'ID' => 'Field2', 'Title' => 'Name - Last', 'Type' => 'shortname', 'Required' => true }, # (subfield)
Expand Down

0 comments on commit 1205d4e

Please sign in to comment.