~tim/wuparty

e9f837fda53b1ce110d636821a71fb7b12129094 — Tim Morgan 10 years ago 73a01ee + 1205d4e
Merge pull request #5 from GrooveStomp/master

add/delete webhook wrapper attached to the form interface
2 files changed, 17 insertions(+), 0 deletions(-)

M README.rdoc
M lib/wuparty.rb
M README.rdoc => README.rdoc +9 -0
@@ 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


M lib/wuparty.rb => lib/wuparty.rb +8 -0
@@ 228,6 228,14 @@ class WuParty
      @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)