nationbuilder-rb 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/README.md +9 -0
  4. data/VERSION +1 -1
  5. data/lib/api_spec/.ruby-gemset +1 -0
  6. data/lib/api_spec/.ruby-version +1 -0
  7. data/lib/api_spec/Gemfile +3 -0
  8. data/lib/api_spec/Gemfile.lock +13 -0
  9. data/lib/api_spec/LICENSE.txt +20 -0
  10. data/lib/api_spec/README.md +20 -0
  11. data/lib/api_spec/Rakefile +9 -0
  12. data/lib/api_spec/lib/api_spec.rb +26 -0
  13. data/lib/api_spec/lib/api_spec/generator.rb +113 -0
  14. data/lib/api_spec/lib/api_spec/specs/basic_pages.rb +106 -0
  15. data/lib/api_spec/lib/api_spec/specs/blog_posts.rb +160 -0
  16. data/lib/api_spec/lib/api_spec/specs/blogs.rb +128 -0
  17. data/lib/api_spec/lib/api_spec/specs/calendars.rb +128 -0
  18. data/lib/api_spec/lib/api_spec/specs/campaign_data.rb +15 -0
  19. data/lib/api_spec/lib/api_spec/specs/contacts.rb +155 -0
  20. data/lib/api_spec/lib/api_spec/specs/donations.rb +76 -0
  21. data/lib/api_spec/lib/api_spec/specs/events.rb +238 -0
  22. data/lib/api_spec/lib/api_spec/specs/exports.rb +42 -0
  23. data/lib/api_spec/lib/api_spec/specs/imports.rb +43 -0
  24. data/lib/api_spec/lib/api_spec/specs/lists.rb +215 -0
  25. data/lib/api_spec/lib/api_spec/specs/memberships.rb +94 -0
  26. data/lib/api_spec/lib/api_spec/specs/page_attachments.rb +121 -0
  27. data/lib/api_spec/lib/api_spec/specs/people.rb +500 -0
  28. data/lib/api_spec/lib/api_spec/specs/people_tags.rb +63 -0
  29. data/lib/api_spec/lib/api_spec/specs/precincts.rb +89 -0
  30. data/lib/api_spec/lib/api_spec/specs/sites.rb +32 -0
  31. data/lib/api_spec/lib/api_spec/specs/survey_responses.rb +64 -0
  32. data/lib/api_spec/lib/api_spec/specs/surveys.rb +106 -0
  33. data/lib/api_spec/lib/api_spec/specs/webhooks.rb +75 -0
  34. data/lib/{nationbuilder/api_spec.json → api_spec/spec.json} +143 -5
  35. data/lib/nationbuilder/client.rb +1 -1
  36. data/nationbuilder-rb.gemspec +35 -5
  37. data/spec/nationbuilder_client_spec.rb +1 -0
  38. data/update_subtree.sh +1 -0
  39. metadata +33 -3
@@ -0,0 +1,238 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Events' do |event|
4
+
5
+ event.method('Index') do |method|
6
+ method.synopsis = "Returns a list of events"
7
+ method.http_method = "GET"
8
+ method.uri = "/sites/:site_slug/pages/events"
9
+
10
+ method.parameter('site_slug') do |p|
11
+ p.required = 'Y'
12
+ p.type = 'string'
13
+ p.description = 'the site holding the event'
14
+ end
15
+
16
+ method.parameter('__token') do |p|
17
+ p.required = 'N'
18
+ p.type = 'string'
19
+ p.description = 'pagination token'
20
+ end
21
+
22
+ method.parameter('__nonce') do |p|
23
+ p.required = 'N'
24
+ p.type = 'string'
25
+ p.description = 'pagination nonce'
26
+ end
27
+
28
+ method.parameter('limit') do |p|
29
+ p.required = 'N'
30
+ p.default = '10'
31
+ p.type = 'int'
32
+ p.description = 'maximum number of results to return'
33
+ end
34
+
35
+ method.parameter('tags') do |p|
36
+ p.required = 'N'
37
+ p.type = 'string'
38
+ p.description = 'tags that must be present on the event'
39
+ end
40
+
41
+ method.parameter('starting') do |p|
42
+ p.required = 'N'
43
+ p.type = 'string'
44
+ p.description = 'earliest starting time'
45
+ end
46
+
47
+ method.parameter('until') do |p|
48
+ p.required = 'N'
49
+ p.type = 'string'
50
+ p.description = 'latest ending time'
51
+ end
52
+
53
+ method.parameter('calendar_id') do |p|
54
+ p.required = 'N'
55
+ p.type = 'int'
56
+ p.description = 'the ID of the calendar from which events should be scoped'
57
+ end
58
+
59
+ end
60
+
61
+ event.method('Show') do |method|
62
+ method.synopsis = "Returns an event"
63
+ method.http_method = "GET"
64
+ method.uri = "/sites/:site_slug/pages/events/:id"
65
+
66
+ method.parameter('site_slug') do |p|
67
+ p.required = 'Y'
68
+ p.type = 'string'
69
+ p.description = 'the site holding the event'
70
+ end
71
+
72
+ method.parameter('id') do |p|
73
+ p.required = 'Y'
74
+ p.type = 'int'
75
+ p.description = 'the ID of the event'
76
+ end
77
+
78
+ end
79
+
80
+ event.method('Create') do |method|
81
+ method.synopsis = "Creates a event with the provided data"
82
+ method.http_method = "POST"
83
+ method.uri = "/sites/:site_slug/pages/events"
84
+
85
+ method.parameter('site_slug') do |p|
86
+ p.required = 'Y'
87
+ p.type = 'string'
88
+ p.description = 'the site holding the event'
89
+ end
90
+
91
+ method.parameter('body') do |p|
92
+ p.required = 'Y'
93
+ p.default = '{}'
94
+ p.type = 'json'
95
+ p.description = 'JSON representation of a event'
96
+ end
97
+ end
98
+
99
+ event.method('Update') do |method|
100
+ method.synopsis = "Updates a event with the provided data"
101
+ method.http_method = "PUT"
102
+ method.uri = "/sites/:site_slug/pages/events/:id"
103
+
104
+ method.parameter('site_slug') do |p|
105
+ p.required = 'Y'
106
+ p.type = 'string'
107
+ p.description = 'the site holding the event'
108
+ end
109
+
110
+ method.parameter('id') do |p|
111
+ p.required = 'Y'
112
+ p.type = 'int'
113
+ p.description = "The event's ID"
114
+ end
115
+
116
+ method.parameter('body') do |p|
117
+ p.required = 'Y'
118
+ p.default = '{}'
119
+ p.type = 'json'
120
+ p.description = 'JSON attributes for updating the event'
121
+ end
122
+ end
123
+
124
+ event.method('Destroy') do |method|
125
+ method.synopsis = "Removes the event with the matching ID"
126
+ method.http_method = "DELETE"
127
+ method.uri = "/sites/:site_slug/pages/events/:id"
128
+
129
+ method.parameter('site_slug') do |p|
130
+ p.required = 'Y'
131
+ p.type = 'string'
132
+ p.description = 'the site holding the event'
133
+ end
134
+
135
+ method.parameter('id') do |p|
136
+ p.required = 'Y'
137
+ p.type = 'int'
138
+ p.description = "The event's ID"
139
+ end
140
+ end
141
+
142
+ event.method('RSVPs') do |method|
143
+ method.synopsis = "Lists all RSVPs for an event"
144
+ method.http_method = "GET"
145
+ method.uri = "/sites/:site_slug/pages/events/:id/rsvps"
146
+
147
+ method.parameter('site_slug') do |p|
148
+ p.required = 'Y'
149
+ p.type = 'string'
150
+ p.description = 'the site holding the event'
151
+ end
152
+
153
+ method.parameter('id') do |p|
154
+ p.required = 'Y'
155
+ p.type = 'int'
156
+ p.description = "The event's ID"
157
+ end
158
+
159
+ method.parameter('__token') do |p|
160
+ p.required = 'N'
161
+ p.type = 'string'
162
+ p.description = 'pagination token'
163
+ end
164
+
165
+ method.parameter('__nonce') do |p|
166
+ p.required = 'N'
167
+ p.type = 'string'
168
+ p.description = 'pagination nonce'
169
+ end
170
+
171
+ method.parameter('limit') do |p|
172
+ p.required = 'N'
173
+ p.default = '10'
174
+ p.type = 'int'
175
+ p.description = 'maximum number of results to return'
176
+ end
177
+
178
+ end
179
+
180
+ event.method('RSVP Create') do |method|
181
+ method.synopsis = "Creates an RSVP for an event"
182
+ method.http_method = "POST"
183
+ method.uri = "/sites/:site_slug/pages/events/:id/rsvps"
184
+
185
+ method.parameter('site_slug') do |p|
186
+ p.required = 'Y'
187
+ p.type = 'string'
188
+ p.description = 'the site holding the event'
189
+ end
190
+
191
+ method.parameter('id') do |p|
192
+ p.required = 'Y'
193
+ p.type = 'int'
194
+ p.description = "The event's ID"
195
+ end
196
+
197
+ method.parameter('body') do |p|
198
+ p.required = 'Y'
199
+ p.type = 'json'
200
+ p.description = 'A JSON representation of the new post'
201
+ end
202
+
203
+ end
204
+
205
+ event.method('RSVP Update') do |method|
206
+ method.synopsis = "Updates an existing RSVP"
207
+ method.http_method = "PUT"
208
+ method.uri = "/sites/:site_slug/pages/events/:event_id/rsvps/:rsvp_id"
209
+
210
+ method.parameter('site_slug') do |p|
211
+ p.required = 'Y'
212
+ p.type = 'string'
213
+ p.description = 'the site holding the event'
214
+ end
215
+
216
+ method.parameter('event_id') do |p|
217
+ p.required = 'Y'
218
+ p.type = 'int'
219
+ p.description = "The event's ID"
220
+ end
221
+
222
+ method.parameter('rsvp_id') do |p|
223
+ p.required = 'Y'
224
+ p.type = 'int'
225
+ p.description = "The RSVP's ID"
226
+ end
227
+
228
+ method.parameter('body') do |p|
229
+ p.required = 'Y'
230
+ p.type = 'json'
231
+ p.description = 'JSON attributes for updating the RSVP'
232
+ end
233
+
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,42 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Exports' do |export|
4
+
5
+ export.method('Create List') do |method|
6
+ method.synopsis = "Creates a list export with the provided data"
7
+ method.http_method = "POST"
8
+ method.uri = "/list/:list_id/exports"
9
+
10
+ method.parameter('body') do |p|
11
+ p.required = 'Y'
12
+ p.type = 'json'
13
+ p.description = 'JSON representation of the export'
14
+ end
15
+ end
16
+
17
+ export.method('Show') do |method|
18
+ method.synopsis = "Shows the status of a list export."
19
+ method.http_method = "GET"
20
+ method.uri = "/exports/:id"
21
+
22
+ method.parameter('id') do |p|
23
+ p.required = 'Y'
24
+ p.type = 'int'
25
+ p.description = 'the ID of the export'
26
+ end
27
+ end
28
+
29
+ export.method('Delete') do |method|
30
+ method.synopsis = "Delete the export"
31
+ method.http_method = "DELETE"
32
+ method.uri = "/exports/:id"
33
+
34
+ method.parameter('id') do |p|
35
+ p.required = 'Y'
36
+ p.type = 'int'
37
+ p.description = 'the ID of the export'
38
+ end
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,43 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Imports' do |import|
4
+
5
+ import.method('Show') do |method|
6
+ method.synopsis = "Shows the status of an import"
7
+ method.http_method = "GET"
8
+ method.uri = "/imports/:id"
9
+
10
+ method.parameter('id') do |p|
11
+ p.required = 'Y'
12
+ p.type = 'int'
13
+ p.description = 'the ID of the import'
14
+ end
15
+
16
+ end
17
+
18
+ import.method('Create') do |method|
19
+ method.synopsis = "Creates a import with the provided data"
20
+ method.http_method = "POST"
21
+ method.uri = "/imports"
22
+
23
+ method.parameter('body') do |p|
24
+ p.required = 'Y'
25
+ p.type = 'json'
26
+ p.description = 'JSON representation of the import'
27
+ end
28
+ end
29
+
30
+ import.method('Result') do |method|
31
+ method.synopsis = "Gets the import results and error csv file."
32
+ method.http_method = "GET"
33
+ method.uri = "/imports/:id/result"
34
+
35
+ method.parameter('id') do |p|
36
+ p.required = 'Y'
37
+ p.type = 'int'
38
+ p.description = 'the ID of the import'
39
+ end
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,215 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Lists' do |lists|
4
+
5
+ lists.method('Index') do |method|
6
+ method.synopsis = "Returns a list of created custom lists"
7
+ method.http_method = "GET"
8
+ method.uri = "/lists"
9
+
10
+ method.parameter('__token') do |p|
11
+ p.required = 'N'
12
+ p.type = 'string'
13
+ p.description = 'pagination token'
14
+ end
15
+
16
+ method.parameter('__nonce') do |p|
17
+ p.required = 'N'
18
+ p.type = 'string'
19
+ p.description = 'pagination nonce'
20
+ end
21
+
22
+ method.parameter('limit') do |p|
23
+ p.required = 'N'
24
+ p.default = '10'
25
+ p.type = 'int'
26
+ p.description = 'maximum number of results to return'
27
+ end
28
+ end
29
+
30
+ lists.method('People') do |method|
31
+ method.synopsis = "Returns people stored in a list"
32
+ method.http_method = "GET"
33
+ method.uri = "/lists/:id/people"
34
+
35
+ method.parameter('id') do |p|
36
+ p.required = 'Y'
37
+ p.type = 'int'
38
+ p.description = "The list's ID"
39
+ end
40
+
41
+ method.parameter('__token') do |p|
42
+ p.required = 'N'
43
+ p.type = 'string'
44
+ p.description = 'pagination token'
45
+ end
46
+
47
+ method.parameter('__nonce') do |p|
48
+ p.required = 'N'
49
+ p.type = 'string'
50
+ p.description = 'pagination nonce'
51
+ end
52
+
53
+ method.parameter('limit') do |p|
54
+ p.required = 'N'
55
+ p.default = '10'
56
+ p.type = 'int'
57
+ p.description = 'maximum number of results to return'
58
+ end
59
+ end
60
+
61
+ lists.method('Create') do |method|
62
+ method.synopsis = "Creates a list with the provided data"
63
+ method.http_method = "POST"
64
+ method.uri = "/lists"
65
+
66
+ method.parameter('body') do |p|
67
+ p.required = 'Y'
68
+ p.default = '{}'
69
+ p.type = 'json'
70
+ p.description = 'JSON representation of the list to create'
71
+ end
72
+ end
73
+
74
+ lists.method('Update') do |method|
75
+ method.synopsis = "Updates a list with the provided data"
76
+ method.http_method = "PUT"
77
+ method.uri = "/lists/:id"
78
+
79
+ method.parameter('id') do |p|
80
+ p.required = 'Y'
81
+ p.type = 'int'
82
+ p.description = "The list's ID"
83
+ end
84
+
85
+ method.parameter('body') do |p|
86
+ p.required = 'Y'
87
+ p.default = '{}'
88
+ p.type = 'json'
89
+ p.description = 'JSON attributes for updating the list'
90
+ end
91
+ end
92
+
93
+ lists.method('Destroy') do |method|
94
+ method.synopsis = "Removes the list with the matching ID"
95
+ method.http_method = "DELETE"
96
+ method.uri = "/lists/:id"
97
+
98
+ method.parameter('id') do |p|
99
+ p.required = 'Y'
100
+ p.type = 'int'
101
+ p.description = "The list's ID"
102
+ end
103
+ end
104
+
105
+ lists.method('Add people') do |method|
106
+ method.synopsis = "Adds people to a list"
107
+ method.http_method = "POST"
108
+ method.uri = "/lists/:list_id/people"
109
+
110
+ method.parameter('list_id') do |p|
111
+ p.required = 'Y'
112
+ p.type = 'int'
113
+ p.description = 'The ID of the list'
114
+ end
115
+
116
+ method.parameter('body') do |p|
117
+ p.required = 'Y'
118
+ p.type = 'json'
119
+ p.description = 'A JSON hash containing the people to add to the list'
120
+ end
121
+ end
122
+
123
+ lists.method('Destroy people') do |method|
124
+ method.synopsis = "Removes people from a list"
125
+ method.http_method = "DELETE"
126
+ method.uri = "/lists/:list_id/people"
127
+
128
+ method.parameter('list_id') do |p|
129
+ p.required = 'Y'
130
+ p.type = 'int'
131
+ p.description = 'The ID of the list'
132
+ end
133
+
134
+ method.parameter('body') do |p|
135
+ p.required = 'Y'
136
+ p.type = 'json'
137
+ p.description = 'A JSON hash containing the people to remove from the list'
138
+ end
139
+ end
140
+
141
+ lists.method('Listing Create (deprecated)') do |method|
142
+ method.synopsis = "Adds a person to a list"
143
+ method.http_method = "POST"
144
+ method.uri = "/lists/:list_id/listings"
145
+
146
+ method.parameter('list_id') do |p|
147
+ p.required = 'Y'
148
+ p.type = 'int'
149
+ p.description = 'The ID of the list'
150
+ end
151
+
152
+ method.parameter('person_id') do |p|
153
+ p.required = 'Y'
154
+ p.type = 'int'
155
+ p.description = 'The ID of the person to add to the list'
156
+ end
157
+ end
158
+
159
+ lists.method('Listing Deletion (deprecated)') do |method|
160
+ method.synopsis = "Drops a person from a list"
161
+ method.http_method = "DELETE"
162
+ method.uri = "/lists/:list_id/listings/:person_id"
163
+
164
+ method.parameter('list_id') do |p|
165
+ p.required = 'Y'
166
+ p.type = 'int'
167
+ p.description = 'The ID of the list'
168
+ end
169
+
170
+ method.parameter('person_id') do |p|
171
+ p.required = 'Y'
172
+ p.type = 'int'
173
+ p.description = 'The ID of the person to drop from the list'
174
+ end
175
+ end
176
+
177
+ lists.method('Add tag') do |method|
178
+ method.synopsis = "Adds a tag to all of the list members"
179
+ method.http_method = "POST"
180
+ method.uri = "/lists/:list_id/tag/:tag"
181
+
182
+ method.parameter('list_id') do |p|
183
+ p.required = 'Y'
184
+ p.type = 'int'
185
+ p.description = 'The ID of the list'
186
+ end
187
+
188
+ method.parameter('tag') do |p|
189
+ p.required = 'Y'
190
+ p.type = 'string'
191
+ p.description = 'The name of the tag to use'
192
+ end
193
+ end
194
+
195
+ lists.method('Delete tag') do |method|
196
+ method.synopsis = "Deletes the tag from all of the list members"
197
+ method.http_method = "DELETE"
198
+ method.uri = "/lists/:list_id/tag/:tag"
199
+
200
+ method.parameter('list_id') do |p|
201
+ p.required = 'Y'
202
+ p.type = 'int'
203
+ p.description = 'The ID of the list'
204
+ end
205
+
206
+ method.parameter('tag') do |p|
207
+ p.required = 'Y'
208
+ p.type = 'string'
209
+ p.description = 'The name of the tag to use'
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ end