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,128 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Blogs' do |bp|
4
+
5
+ bp.method('Index') do |m|
6
+
7
+ m.synopsis = "Shows a list of all blogs"
8
+ m.http_method = "GET"
9
+ m.uri = "/sites/:site_slug/pages/blogs"
10
+
11
+ m.parameter('site_slug') do |p|
12
+ p.required = 'Y'
13
+ p.type = 'string'
14
+ p.description = 'the site holding the blog'
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
+ bp.method('Show') do |m|
39
+
40
+ m.synopsis = "Show the details of a blog"
41
+ m.http_method = "GET"
42
+ m.uri = "/sites/:site_slug/pages/blogs/:id"
43
+
44
+ m.parameter('site_slug') do |p|
45
+ p.required = 'Y'
46
+ p.type = 'string'
47
+ p.description = 'the site holding the blog'
48
+ end
49
+
50
+ m.parameter('id') do |p|
51
+ p.required = 'Y'
52
+ p.type = 'int'
53
+ p.description = 'the ID of the blog'
54
+ end
55
+
56
+ end
57
+
58
+ bp.method('Create') do |m|
59
+
60
+ m.synopsis = "Creates a new blog"
61
+ m.http_method = "POST"
62
+ m.uri = "/sites/:site_slug/pages/blogs"
63
+
64
+ m.parameter('site_slug') do |p|
65
+ p.required = 'Y'
66
+ p.type = 'string'
67
+ p.description = 'the site holding the blog'
68
+ end
69
+
70
+ m.parameter('body') do |p|
71
+ p.required = 'Y'
72
+ p.default = '1'
73
+ p.type = 'json'
74
+ p.description = 'a JSON representation of the new blog'
75
+ end
76
+
77
+ end
78
+
79
+ bp.method('Update') do |m|
80
+
81
+ m.synopsis = "Updates the attributes of a blog"
82
+ m.http_method = "PUT"
83
+ m.uri = "/sites/:site_slug/pages/blogs/:id"
84
+
85
+ m.parameter('site_slug') do |p|
86
+ p.required = 'Y'
87
+ p.type = 'string'
88
+ p.description = 'the site holding the blog'
89
+ end
90
+
91
+ m.parameter('id') do |p|
92
+ p.required = 'Y'
93
+ p.type = 'int'
94
+ p.description = 'the ID of the blog'
95
+ end
96
+
97
+ m.parameter('body') do |p|
98
+ p.required = 'Y'
99
+ p.default = '1'
100
+ p.type = 'json'
101
+ p.description = 'JSON containing updates'
102
+ end
103
+
104
+ end
105
+
106
+ bp.method('Destroy') do |m|
107
+
108
+ m.synopsis = "Removes a blog"
109
+ m.http_method = "DELETE"
110
+ m.uri = "/sites/:site_slug/pages/blogs/:id"
111
+
112
+ m.parameter('site_slug') do |p|
113
+ p.required = 'Y'
114
+ p.type = 'string'
115
+ p.description = 'the site holding the blog'
116
+ end
117
+
118
+ m.parameter('id') do |p|
119
+ p.required = 'Y'
120
+ p.type = 'int'
121
+ p.description = 'the ID of the blog'
122
+ end
123
+
124
+ end
125
+
126
+ end
127
+
128
+ end
@@ -0,0 +1,128 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Calendars' do |bp|
4
+
5
+ bp.method('Index') do |m|
6
+
7
+ m.synopsis = "Shows a list of calendars"
8
+ m.http_method = "GET"
9
+ m.uri = "/sites/:site_slug/pages/calendars"
10
+
11
+ m.parameter('site_slug') do |p|
12
+ p.required = 'Y'
13
+ p.type = 'string'
14
+ p.description = 'the site holding the calendars'
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
+ bp.method('Show') do |m|
39
+
40
+ m.synopsis = "Show the details of a calendar"
41
+ m.http_method = "GET"
42
+ m.uri = "/sites/:site_slug/pages/calendars/:id"
43
+
44
+ m.parameter('site_slug') do |p|
45
+ p.required = 'Y'
46
+ p.type = 'string'
47
+ p.description = 'the site holding the calendar'
48
+ end
49
+
50
+ m.parameter('id') do |p|
51
+ p.required = 'Y'
52
+ p.type = 'int'
53
+ p.description = 'the ID of the calendar'
54
+ end
55
+
56
+ end
57
+
58
+ bp.method('Create') do |m|
59
+
60
+ m.synopsis = "Creates a new calendar"
61
+ m.http_method = "POST"
62
+ m.uri = "/sites/:site_slug/pages/calendars"
63
+
64
+ m.parameter('site_slug') do |p|
65
+ p.required = 'Y'
66
+ p.type = 'string'
67
+ p.description = 'the site holding the calendar'
68
+ end
69
+
70
+ m.parameter('body') do |p|
71
+ p.required = 'Y'
72
+ p.default = '1'
73
+ p.type = 'json'
74
+ p.description = 'a JSON representation of the new calendar'
75
+ end
76
+
77
+ end
78
+
79
+ bp.method('Update') do |m|
80
+
81
+ m.synopsis = "Updates the attributes of a calendar"
82
+ m.http_method = "PUT"
83
+ m.uri = "/sites/:site_slug/pages/calendars/:id"
84
+
85
+ m.parameter('site_slug') do |p|
86
+ p.required = 'Y'
87
+ p.type = 'string'
88
+ p.description = 'the site holding the calendar'
89
+ end
90
+
91
+ m.parameter('id') do |p|
92
+ p.required = 'Y'
93
+ p.type = 'int'
94
+ p.description = 'the ID of the calendar'
95
+ end
96
+
97
+ m.parameter('body') do |p|
98
+ p.required = 'Y'
99
+ p.default = '1'
100
+ p.type = 'json'
101
+ p.description = 'JSON containing updates'
102
+ end
103
+
104
+ end
105
+
106
+ bp.method('Destroy') do |m|
107
+
108
+ m.synopsis = "Removes a calendar"
109
+ m.http_method = "DELETE"
110
+ m.uri = "/sites/:site_slug/pages/calendars/:id"
111
+
112
+ m.parameter('site_slug') do |p|
113
+ p.required = 'Y'
114
+ p.type = 'string'
115
+ p.description = 'the site holding the calendar'
116
+ end
117
+
118
+ m.parameter('id') do |p|
119
+ p.required = 'Y'
120
+ p.type = 'int'
121
+ p.description = 'the ID of the calendar'
122
+ end
123
+
124
+ end
125
+
126
+ end
127
+
128
+ end
@@ -0,0 +1,15 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Campaign Data' do |bp|
4
+
5
+ bp.method('Show') do |m|
6
+
7
+ m.synopsis = "Shows campaign metadata about the nation"
8
+ m.http_method = "GET"
9
+ m.uri = "/campaign_data"
10
+
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,155 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Contacts' do |c|
4
+
5
+ c.method('Index') do |m|
6
+
7
+ m.synopsis = "View a paginated list of a person's contacts"
8
+ m.http_method = "GET"
9
+ m.uri = "/people/:person_id/contacts"
10
+
11
+ m.parameter('person_id') do |p|
12
+ p.required = 'Y'
13
+ p.type = 'int'
14
+ p.description = 'the person\'s ID'
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
+ c.method('Create') do |m|
39
+
40
+ m.synopsis = "Record a contact for a person"
41
+ m.http_method = "POST"
42
+ m.uri = "/people/:person_id/contacts"
43
+
44
+ m.parameter('person_id') do |p|
45
+ p.required = 'Y'
46
+ p.type = 'int'
47
+ p.description = 'the person\'s ID'
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 contact'
54
+ end
55
+
56
+ end
57
+
58
+ end
59
+
60
+ endpoint 'Contact Types' do |c|
61
+
62
+ c.method('Index') do |m|
63
+
64
+ m.synopsis = "Returns paginated list of nation-defined contact types"
65
+ m.http_method = "GET"
66
+ m.uri = "/settings/contact_types"
67
+
68
+ m.parameter('__token') do |p|
69
+ p.required = 'N'
70
+ p.type = 'string'
71
+ p.description = 'pagination token'
72
+ end
73
+
74
+ m.parameter('__nonce') do |p|
75
+ p.required = 'N'
76
+ p.type = 'string'
77
+ p.description = 'pagination nonce'
78
+ end
79
+
80
+ m.parameter('limit') do |p|
81
+ p.required = 'N'
82
+ p.default = '10'
83
+ p.type = 'int'
84
+ p.description = 'maximum number of results to return'
85
+ end
86
+
87
+ end
88
+
89
+ c.method('Create') do |m|
90
+
91
+ m.synopsis = "Creates a new contact type"
92
+ m.http_method = "POST"
93
+ m.uri = "/settings/contact_types"
94
+
95
+ m.parameter('body') do |p|
96
+ p.required = 'Y'
97
+ p.type = 'json'
98
+ p.description = 'a JSON representation of the new contact type'
99
+ end
100
+
101
+ end
102
+
103
+ c.method('Update') do |m|
104
+
105
+ m.synopsis = "Updates an existing contact type"
106
+ m.http_method = "PUT"
107
+ m.uri = "/settings/contact_types/:id"
108
+
109
+ m.parameter('id') do |p|
110
+ p.required = 'Y'
111
+ p.type = 'int'
112
+ p.description = 'the ID of the existing contact type'
113
+ end
114
+
115
+ m.parameter('body') do |p|
116
+ p.required = 'Y'
117
+ p.type = 'json'
118
+ p.description = 'a JSON representation of the updates to make'
119
+ end
120
+
121
+ end
122
+
123
+ c.method('Destroy') do |m|
124
+
125
+ m.synopsis = "Destroys a contact type"
126
+ m.http_method = "DELETE"
127
+ m.uri = "/settings/contact_types/:id"
128
+
129
+ m.parameter('id') do |p|
130
+ p.required = 'Y'
131
+ p.type = 'int'
132
+ p.description = 'the ID of the existing contact type'
133
+ end
134
+
135
+ end
136
+
137
+ c.method('List Methods') do |m|
138
+
139
+ m.synopsis = "Lists all contact methods"
140
+ m.http_method = "GET"
141
+ m.uri = "/settings/contact_methods"
142
+
143
+ end
144
+
145
+ c.method('List Statuses') do |m|
146
+
147
+ m.synopsis = "Lists all contact status types"
148
+ m.http_method = "GET"
149
+ m.uri = "/settings/contact_statuses"
150
+
151
+ end
152
+
153
+ end
154
+
155
+ end
@@ -0,0 +1,76 @@
1
+ class ApiSpec::Spec
2
+
3
+ endpoint 'Donations' do |donation|
4
+
5
+ donation.method('Index') do |method|
6
+ method.synopsis = "Returns a list of donations"
7
+ method.http_method = "GET"
8
+ method.uri = "/donations"
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
+ donation.method('Create') do |method|
31
+ method.synopsis = "Creates a donation with the provided data"
32
+ method.http_method = "POST"
33
+ method.uri = "/donations"
34
+
35
+ method.parameter('body') do |p|
36
+ p.required = 'Y'
37
+ p.default = '{}'
38
+ p.type = 'json'
39
+ p.description = 'JSON representation of a donation'
40
+ end
41
+ end
42
+
43
+ donation.method('Update') do |method|
44
+ method.synopsis = "Updates a donation with the provided data"
45
+ method.http_method = "PUT"
46
+ method.uri = "/donations/:id"
47
+
48
+ method.parameter('id') do |p|
49
+ p.required = 'Y'
50
+ p.type = 'int'
51
+ p.description = "The donation's ID"
52
+ end
53
+
54
+ method.parameter('body') do |p|
55
+ p.required = 'Y'
56
+ p.default = '{}'
57
+ p.type = 'json'
58
+ p.description = 'JSON attributes for updating the donation'
59
+ end
60
+ end
61
+
62
+ donation.method('Destroy') do |method|
63
+ method.synopsis = "Removes the donation with the matching ID"
64
+ method.http_method = "DELETE"
65
+ method.uri = "/donations/:id"
66
+
67
+ method.parameter('id') do |p|
68
+ p.required = 'Y'
69
+ p.type = 'int'
70
+ p.description = "The donation's ID"
71
+ end
72
+ end
73
+
74
+ end
75
+
76
+ end