nationbuilder-rb 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,63 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'People Tags' do |tags|
4
+
5
+ tags.method('Index') do |method|
6
+ method.synopsis = "Returns a list of previously used tags"
7
+ method.http_method = "GET"
8
+ method.uri = "/tags"
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
+ tags.method('People') do |method|
31
+ method.synopsis = "Searches for people with the given tag"
32
+ method.http_method = "GET"
33
+ method.uri = "/tags/:tag/people"
34
+
35
+ method.parameter('tag') do |p|
36
+ p.required = 'Y'
37
+ p.type = 'string'
38
+ p.description = 'the name of the tag'
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
+ end
62
+
63
+ end
@@ -0,0 +1,89 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Precincts' do |precinct|
4
+
5
+ precinct.method('Index') do |method|
6
+ method.synopsis = "Returns a list of current precincts"
7
+ method.http_method = "GET"
8
+ method.uri = "/precincts"
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
+ precinct.method('Show') do |method|
31
+ method.synopsis = "Returns a representation of the precinct"
32
+ method.http_method = "GET"
33
+ method.uri = "/precincts/:id"
34
+
35
+ method.parameter('id') do |p|
36
+ p.required = 'Y'
37
+ p.default = '1'
38
+ p.type = 'int'
39
+ p.description = "the precinct's id"
40
+ end
41
+ end
42
+
43
+ precinct.method('Create') do |method|
44
+ method.synopsis = "Creates a precinct with the provided data"
45
+ method.http_method = "POST"
46
+ method.uri = "/precincts"
47
+
48
+ method.parameter('body') do |p|
49
+ p.required = 'Y'
50
+ p.default = '{}'
51
+ p.type = 'json'
52
+ p.description = 'JSON representation of the precinct to create'
53
+ end
54
+ end
55
+
56
+ precinct.method('Update') do |method|
57
+ method.synopsis = "Updates a precinct with the provided data"
58
+ method.http_method = "PUT"
59
+ method.uri = "/precincts/:id"
60
+
61
+ method.parameter('id') do |p|
62
+ p.required = 'Y'
63
+ p.type = 'int'
64
+ p.description = "The precinct's ID"
65
+ end
66
+
67
+ method.parameter('body') do |p|
68
+ p.required = 'Y'
69
+ p.default = '{}'
70
+ p.type = 'json'
71
+ p.description = 'JSON attributes for updating the precinct'
72
+ end
73
+ end
74
+
75
+ precinct.method('Destroy') do |method|
76
+ method.synopsis = "Removes the precinct with the matching ID"
77
+ method.http_method = "DELETE"
78
+ method.uri = "/precincts/:id"
79
+
80
+ method.parameter('id') do |p|
81
+ p.required = 'Y'
82
+ p.type = 'int'
83
+ p.description = "The precinct's ID"
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+ end
@@ -0,0 +1,32 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Sites' do |tags|
4
+
5
+ tags.method('Index') do |method|
6
+ method.synopsis = "Returns a list of all sites"
7
+ method.http_method = "GET"
8
+ method.uri = "/sites"
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
+ end
31
+
32
+ end
@@ -0,0 +1,64 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Survey Responses' do |surveys|
4
+
5
+ surveys.method('Index') do |m|
6
+
7
+ m.synopsis = "Lists all survey responses"
8
+ m.http_method = "GET"
9
+ m.uri = "/survey_responses"
10
+
11
+ m.parameter('start_time') do |p|
12
+ p.required = 'N'
13
+ p.type = 'string'
14
+ p.description = 'the starting time for results'
15
+ end
16
+
17
+ m.parameter('end_time') do |p|
18
+ p.required = 'N'
19
+ p.type = 'string'
20
+ p.description = 'the ending time for results'
21
+ end
22
+
23
+ m.parameter('survey_id') do |p|
24
+ p.required = 'N'
25
+ p.type = 'int'
26
+ p.description = 'the id for a parent survey'
27
+ end
28
+
29
+ m.parameter('__token') do |p|
30
+ p.required = 'N'
31
+ p.type = 'string'
32
+ p.description = 'pagination token'
33
+ end
34
+
35
+ m.parameter('__nonce') do |p|
36
+ p.required = 'N'
37
+ p.type = 'string'
38
+ p.description = 'pagination nonce'
39
+ end
40
+
41
+ m.parameter('limit') do |p|
42
+ p.required = 'N'
43
+ p.default = '10'
44
+ p.type = 'int'
45
+ p.description = 'maximum number of results to return'
46
+ end
47
+
48
+ end
49
+
50
+ surveys.method('Create') do |m|
51
+ m.synopsis = "Creates responses for a survey"
52
+ m.http_method = "POST"
53
+ m.uri = "/survey_responses"
54
+
55
+ m.parameter('body') do |p|
56
+ p.required = 'Y'
57
+ p.type = 'json'
58
+ p.description = 'a JSON representation of the survey responses'
59
+ end
60
+ end
61
+ end
62
+
63
+
64
+ end
@@ -0,0 +1,106 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Surveys' do |surveys|
4
+
5
+ surveys.method('Index') do |m|
6
+
7
+ m.synopsis = "Shows a list of all surveys for the a site"
8
+ m.http_method = "GET"
9
+ m.uri = "/sites/:site_slug/pages/surveys"
10
+
11
+ m.parameter('site_slug') do |p|
12
+ p.required = 'Y'
13
+ p.type = 'string'
14
+ p.description = 'the site holding the survey'
15
+ end
16
+
17
+ m.parameter('__token') do |p|
18
+ p.required = 'N'
19
+ p.type = 'string'
20
+ p.description = 'pagination token'
21
+ end
22
+
23
+ m.parameter('__nonce') do |p|
24
+ p.required = 'N'
25
+ p.type = 'string'
26
+ p.description = 'pagination nonce'
27
+ end
28
+
29
+ m.parameter('limit') do |p|
30
+ p.required = 'N'
31
+ p.default = '10'
32
+ p.type = 'int'
33
+ p.description = 'maximum number of results to return'
34
+ end
35
+
36
+ end
37
+
38
+ surveys.method('Create') do |m|
39
+
40
+ m.synopsis = "Creates a survey for a site"
41
+ m.http_method = "POST"
42
+ m.uri = "/sites/:site_slug/pages/surveys"
43
+
44
+ m.parameter('site_slug') do |p|
45
+ p.required = 'Y'
46
+ p.type = 'string'
47
+ p.description = 'the site holding the survey'
48
+ end
49
+
50
+ m.parameter('body') do |p|
51
+ p.required = 'Y'
52
+ p.type = 'json'
53
+ p.description = 'a JSON representation of the new survey'
54
+ end
55
+
56
+ end
57
+
58
+ surveys.method('Update') do |m|
59
+
60
+ m.synopsis = "Updates the attributes of a survey"
61
+ m.http_method = "PUT"
62
+ m.uri = "/sites/:site_slug/pages/surveys/:id"
63
+
64
+ m.parameter('site_slug') do |p|
65
+ p.required = 'Y'
66
+ p.type = 'string'
67
+ p.description = 'the site holding the survey'
68
+ end
69
+
70
+ m.parameter('id') do |p|
71
+ p.required = 'Y'
72
+ p.type = 'int'
73
+ p.description = 'the ID of the survey'
74
+ end
75
+
76
+ m.parameter('body') do |p|
77
+ p.required = 'Y'
78
+ p.type = 'json'
79
+ p.description = 'JSON containing updates'
80
+ end
81
+
82
+ end
83
+
84
+ surveys.method('Destroy') do |m|
85
+
86
+ m.synopsis = "Removes a survey"
87
+ m.http_method = "DELETE"
88
+ m.uri = "/sites/:site_slug/pages/surveys/:id"
89
+
90
+ m.parameter('site_slug') do |p|
91
+ p.required = 'Y'
92
+ p.type = 'string'
93
+ p.description = 'the site holding the survey'
94
+ end
95
+
96
+ m.parameter('id') do |p|
97
+ p.required = 'Y'
98
+ p.type = 'int'
99
+ p.description = 'the ID of the survey'
100
+ end
101
+
102
+ end
103
+
104
+ end
105
+
106
+ end
@@ -0,0 +1,75 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Webhooks' do |surveys|
4
+
5
+ surveys.method('Index') do |m|
6
+
7
+ m.synopsis = "Lists all webhooks"
8
+ m.http_method = "GET"
9
+ m.uri = "/webhooks"
10
+
11
+ m.parameter('__token') do |p|
12
+ p.required = 'N'
13
+ p.type = 'string'
14
+ p.description = 'pagination token'
15
+ end
16
+
17
+ m.parameter('__nonce') do |p|
18
+ p.required = 'N'
19
+ p.type = 'string'
20
+ p.description = 'pagination nonce'
21
+ end
22
+
23
+ m.parameter('limit') do |p|
24
+ p.required = 'N'
25
+ p.default = '10'
26
+ p.type = 'int'
27
+ p.description = 'maximum number of results to return'
28
+ end
29
+
30
+ end
31
+
32
+ surveys.method('Show') do |m|
33
+
34
+ m.synopsis = "Shows the details of an individual webhook"
35
+ m.http_method = "GET"
36
+ m.uri = "/webhooks/:id"
37
+
38
+ m.parameter('id') do |p|
39
+ p.required = 'Y'
40
+ p.type = 'string'
41
+ p.description = 'the ID of the webhook to display'
42
+ end
43
+
44
+ end
45
+
46
+ surveys.method('Create') do |m|
47
+ m.synopsis = "Creates a new webhook"
48
+ m.http_method = "POST"
49
+ m.uri = "/webhooks"
50
+
51
+ m.parameter('body') do |p|
52
+ p.required = 'Y'
53
+ p.type = 'json'
54
+ p.description = 'a JSON representation of the new webhook'
55
+ end
56
+ end
57
+
58
+ surveys.method('Destroy') do |m|
59
+
60
+ m.synopsis = "Destroys a webhook"
61
+ m.http_method = "DELETE"
62
+ m.uri = "/webhooks/:id"
63
+
64
+ m.parameter('id') do |p|
65
+ p.required = 'Y'
66
+ p.type = 'int'
67
+ p.description = 'the ID a webhook'
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+
75
+ end
@@ -1757,28 +1757,28 @@
1757
1757
  "Required": "N",
1758
1758
  "Default": null,
1759
1759
  "Type": "string",
1760
- "Description": null
1760
+ "Description": "deprecated"
1761
1761
  },
1762
1762
  {
1763
1763
  "Name": "last_name",
1764
1764
  "Required": "N",
1765
1765
  "Default": null,
1766
1766
  "Type": "string",
1767
- "Description": null
1767
+ "Description": "deprecated"
1768
1768
  },
1769
1769
  {
1770
1770
  "Name": "phone",
1771
1771
  "Required": "N",
1772
1772
  "Default": null,
1773
1773
  "Type": "string",
1774
- "Description": null
1774
+ "Description": "deprecated"
1775
1775
  },
1776
1776
  {
1777
1777
  "Name": "mobile",
1778
1778
  "Required": "N",
1779
1779
  "Default": null,
1780
1780
  "Type": "string",
1781
- "Description": null
1781
+ "Description": "deprecated"
1782
1782
  }
1783
1783
  ]
1784
1784
  },
@@ -2252,6 +2252,21 @@
2252
2252
  }
2253
2253
  ]
2254
2254
  },
2255
+ {
2256
+ "MethodName": "Add",
2257
+ "Synopsis": "Updates a matched person (without overriding data) or creates a new one if the person doesn't exist",
2258
+ "HTTPMethod": "PUT",
2259
+ "URI": "/people/add",
2260
+ "parameters": [
2261
+ {
2262
+ "Name": "body",
2263
+ "Required": "Y",
2264
+ "Default": "{}",
2265
+ "Type": "json",
2266
+ "Description": "JSON attributes for updating/matching the person"
2267
+ }
2268
+ ]
2269
+ },
2255
2270
  {
2256
2271
  "MethodName": "Destroy",
2257
2272
  "Synopsis": "Removes the person with the matching ID",
@@ -2266,6 +2281,28 @@
2266
2281
  "Description": "The person's ID"
2267
2282
  }
2268
2283
  ]
2284
+ },
2285
+ {
2286
+ "MethodName": "Private Note Create",
2287
+ "Synopsis": "Creates a private note for the given person",
2288
+ "HTTPMethod": "POST",
2289
+ "URI": "/people/:id/notes",
2290
+ "parameters": [
2291
+ {
2292
+ "Name": "id",
2293
+ "Required": "Y",
2294
+ "Default": null,
2295
+ "Type": "int",
2296
+ "Description": "the ID of the person"
2297
+ },
2298
+ {
2299
+ "Name": "body",
2300
+ "Required": "Y",
2301
+ "Default": null,
2302
+ "Type": "json",
2303
+ "Description": "JSON representation of the note to create"
2304
+ }
2305
+ ]
2269
2306
  }
2270
2307
  ]
2271
2308
  },
@@ -2339,6 +2376,107 @@
2339
2376
  }
2340
2377
  ]
2341
2378
  },
2379
+ {
2380
+ "name": "Precincts",
2381
+ "methods": [
2382
+ {
2383
+ "MethodName": "Index",
2384
+ "Synopsis": "Returns a list of current precincts",
2385
+ "HTTPMethod": "GET",
2386
+ "URI": "/precincts",
2387
+ "parameters": [
2388
+ {
2389
+ "Name": "__token",
2390
+ "Required": "N",
2391
+ "Default": null,
2392
+ "Type": "string",
2393
+ "Description": "pagination token"
2394
+ },
2395
+ {
2396
+ "Name": "__nonce",
2397
+ "Required": "N",
2398
+ "Default": null,
2399
+ "Type": "string",
2400
+ "Description": "pagination nonce"
2401
+ },
2402
+ {
2403
+ "Name": "limit",
2404
+ "Required": "N",
2405
+ "Default": "10",
2406
+ "Type": "int",
2407
+ "Description": "maximum number of results to return"
2408
+ }
2409
+ ]
2410
+ },
2411
+ {
2412
+ "MethodName": "Show",
2413
+ "Synopsis": "Returns a representation of the precinct",
2414
+ "HTTPMethod": "GET",
2415
+ "URI": "/precincts/:id",
2416
+ "parameters": [
2417
+ {
2418
+ "Name": "id",
2419
+ "Required": "Y",
2420
+ "Default": "1",
2421
+ "Type": "int",
2422
+ "Description": "the precinct's id"
2423
+ }
2424
+ ]
2425
+ },
2426
+ {
2427
+ "MethodName": "Create",
2428
+ "Synopsis": "Creates a precinct with the provided data",
2429
+ "HTTPMethod": "POST",
2430
+ "URI": "/precincts",
2431
+ "parameters": [
2432
+ {
2433
+ "Name": "body",
2434
+ "Required": "Y",
2435
+ "Default": "{}",
2436
+ "Type": "json",
2437
+ "Description": "JSON representation of the precinct to create"
2438
+ }
2439
+ ]
2440
+ },
2441
+ {
2442
+ "MethodName": "Update",
2443
+ "Synopsis": "Updates a precinct with the provided data",
2444
+ "HTTPMethod": "PUT",
2445
+ "URI": "/precincts/:id",
2446
+ "parameters": [
2447
+ {
2448
+ "Name": "id",
2449
+ "Required": "Y",
2450
+ "Default": null,
2451
+ "Type": "int",
2452
+ "Description": "The precinct's ID"
2453
+ },
2454
+ {
2455
+ "Name": "body",
2456
+ "Required": "Y",
2457
+ "Default": "{}",
2458
+ "Type": "json",
2459
+ "Description": "JSON attributes for updating the precinct"
2460
+ }
2461
+ ]
2462
+ },
2463
+ {
2464
+ "MethodName": "Destroy",
2465
+ "Synopsis": "Removes the precinct with the matching ID",
2466
+ "HTTPMethod": "DELETE",
2467
+ "URI": "/precincts/:id",
2468
+ "parameters": [
2469
+ {
2470
+ "Name": "id",
2471
+ "Required": "Y",
2472
+ "Default": null,
2473
+ "Type": "int",
2474
+ "Description": "The precinct's ID"
2475
+ }
2476
+ ]
2477
+ }
2478
+ ]
2479
+ },
2342
2480
  {
2343
2481
  "name": "Sites",
2344
2482
  "methods": [
@@ -2637,4 +2775,4 @@
2637
2775
  ]
2638
2776
  }
2639
2777
  ]
2640
- }
2778
+ }