wuparty/README.rdoc -rw-r--r-- 3.7 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
= WuParty

WuParty is a fairly lightweight wrapper for Wufoo's REST API[http://wufoo.com/docs/api/v3]
using HTTParty[http://httparty.rubyforge.org].

== API Support

Wufoo's REST API supports viewing and submitting entries, filtering entries,
viewing reports, and viewing users.

This library supports all methods of Wufoo's API version 3.0.

There is an older version of this library (version 0.1.x) that only supports version 2 of Wufoo's API.
Make sure you have latest version installed (1.0.0 or higher).

== Source & Download

* {Source Code}[http://github.com/seven1m/wuparty]
* {RDoc Documentation}[http://seven1m.github.com/wuparty]

== Installation

    gem install wuparty

== Usage

=== Setup

    require 'wuparty'

    ACCOUNT = 'accountname'
    API_KEY = 'AAAA-BBBB-CCCC-DDDD'
    FORM_ID = 'my-form-id'

    wufoo = WuParty.new(ACCOUNT, API_KEY)

=== Login

    result = WuParty.login(myIntegrationKey, users_email, users_password)
    api_key = result['LoginResult']['ApiKey']

=== Get Form Info

    wufoo.forms
    form = wufoo.form(FORM_ID)

=== Get Entries

    form.entries

    # ...or filter entries (see http://wufoo.com/docs/api/v3/entries/get/#filter)
    form.entries(filters: [['Field1', 'Is_equal_to', 'Tim']])

=== Submit

    # To submit, use field numbers shown on the 'API Information' page in Wufoo
    result = form.submit({
      'Field1' => 'Tim',
      'Field2' => 'Morgan'
    })
    if result['Success'] == 0
      puts result['ErrorText']
    end

=== Web Hooks

    # 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)

    wufoo.delete_webhook(FORM_ID, result["WebHookPutResult"]["Hash"])

== Feedback

I’d love to hear from you if you have suggestions for improvement, bug fixes, or whatever.
Email me at mailto:tim@timmorgan.org or fork the project[http://github.com/seven1m/wuparty] and send a pull request.

http://timmorgan.org

== Tests

To run the tests, you must create a form called "Test Form" and pass in its id via the
ENV variable WUFOO_FORM_ID. Give the form a standard name and address field.
Make the name field required. Then run:

    WUFOO_ACCOUNT=accountname \
    WUFOO_API_KEY=AAAA-BBBB-CCCC-DDDD \
    WUFOO_FORM_ID=test-form \
    rake test

== License

Copyright (c) 2014 Tim Morgan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.