~tim/wuparty

9de58bbcef5e97919568b8eb0ed2240c827cd851 — Joshua Siler 9 years ago e22ac3e
added metadata flag to webhook calls
2 files changed, 10 insertions(+), 4 deletions(-)

M README.rdoc
M lib/wuparty.rb
M README.rdoc => README.rdoc +6 -0
@@ 53,10 53,16 @@ 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 = form.add_webhook('http://www.postbin.org/zh9iy1')
    # Tell the webhook to include metadata in its postback
    result = form.add_webhook('http://www.postbin.org/zh9iy1', true)

    result = form.delete_webhook(result["WebHookPutResult"]["Hash"])

    # Or, directly through wufoo:
    result = wufoo.add_webhook(FORM_ID, 'http://www.postbin.org/zh9iy1')
     # Tell the webhook to include metadata in its postback
     result = wufoo.add_webhook(FORM_ID, 'http://www.postbin.org/zh9iy1', true)
     
    result = wufoo.delete_webhook(FORM_ID, result["WebHookPutResult"]["Hash"])
    
    # You can use the Login API (http://www.wufoo.com/docs/api/v3/login/), like so

M lib/wuparty.rb => lib/wuparty.rb +4 -4
@@ 141,8 141,8 @@ class WuParty
    end
  end

  def add_webhook(form_id, url)
    put("forms/#{form_id}/webhooks", :body => {'url' => url})
  def add_webhook(form_id, url, metadata = false)
    put("forms/#{form_id}/webhooks", :body => {'url' => url, 'metadata' => metadata})
  end

  def delete_webhook(form_id, webhook_hash)


@@ 241,8 241,8 @@ class WuParty
      @details[id]
    end

    def add_webhook(url)
      @party.add_webhook(@details["Hash"], url)
    def add_webhook(url, metadata = false)
      @party.add_webhook(@details["Hash"], url, metadata)
    end

    def delete_webhook(webhook_id)