Skip to content

Commit

Permalink
Merge pull request #5 from GrooveStomp/master
Browse files Browse the repository at this point in the history
add/delete webhook wrapper attached to the form interface
  • Loading branch information
seven1m committed May 13, 2011
2 parents 73a01ee + 1205d4e commit e9f837f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions lib/wuparty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e9f837f

Please sign in to comment.