lib/api_spec/lib/api_spec/specs/contacts.rb in nationbuilder-rb-1.3.5 vs lib/api_spec/lib/api_spec/specs/contacts.rb in nationbuilder-rb-1.3.6
- old
+ new
@@ -1,19 +1,18 @@
class ApiSpec::Spec
endpoint 'Contacts' do |c|
c.method('Index') do |m|
-
m.synopsis = "View a paginated list of a person's contacts"
- m.http_method = "GET"
- m.uri = "/people/:person_id/contacts"
+ m.http_method = 'GET'
+ m.uri = '/people/:person_id/contacts'
m.parameter('person_id') do |p|
p.required = 'Y'
p.type = 'int'
- p.description = 'the person\'s ID'
+ p.description = "the person's ID"
end
m.parameter('__token') do |p|
p.required = 'N'
p.type = 'string'
@@ -30,43 +29,37 @@
p.required = 'N'
p.default = '10'
p.type = 'int'
p.description = 'maximum number of results to return'
end
-
end
c.method('Create') do |m|
+ m.synopsis = 'Record a contact for a person'
+ m.http_method = 'POST'
+ m.uri = '/people/:person_id/contacts'
- m.synopsis = "Record a contact for a person"
- m.http_method = "POST"
- m.uri = "/people/:person_id/contacts"
-
m.parameter('person_id') do |p|
p.required = 'Y'
p.type = 'int'
- p.description = 'the person\'s ID'
+ p.description = "the person's ID"
end
m.parameter('body') do |p|
p.required = 'Y'
p.type = 'json'
p.description = 'a JSON representation of the new contact'
end
-
end
-
end
endpoint 'Contact Types' do |c|
-
c.method('Index') do |m|
+ m.synopsis = 'Returns paginated list of nation-defined contact types'
+ m.http_method = 'GET'
+ m.uri = '/settings/contact_types'
- m.synopsis = "Returns paginated list of nation-defined contact types"
- m.http_method = "GET"
- m.uri = "/settings/contact_types"
-
m.parameter('__token') do |p|
p.required = 'N'
p.type = 'string'
p.description = 'pagination token'
end
@@ -81,33 +74,29 @@
p.required = 'N'
p.default = '10'
p.type = 'int'
p.description = 'maximum number of results to return'
end
-
end
c.method('Create') do |m|
+ m.synopsis = 'Creates a new contact type'
+ m.http_method = 'POST'
+ m.uri = '/settings/contact_types'
- m.synopsis = "Creates a new contact type"
- m.http_method = "POST"
- m.uri = "/settings/contact_types"
-
m.parameter('body') do |p|
p.required = 'Y'
p.type = 'json'
p.description = 'a JSON representation of the new contact type'
end
-
end
c.method('Update') do |m|
+ m.synopsis = 'Updates an existing contact type'
+ m.http_method = 'PUT'
+ m.uri = '/settings/contact_types/:id'
- m.synopsis = "Updates an existing contact type"
- m.http_method = "PUT"
- m.uri = "/settings/contact_types/:id"
-
m.parameter('id') do |p|
p.required = 'Y'
p.type = 'int'
p.description = 'the ID of the existing contact type'
end
@@ -115,41 +104,32 @@
m.parameter('body') do |p|
p.required = 'Y'
p.type = 'json'
p.description = 'a JSON representation of the updates to make'
end
-
end
c.method('Destroy') do |m|
+ m.synopsis = 'Destroys a contact type'
+ m.http_method = 'DELETE'
+ m.uri = '/settings/contact_types/:id'
- m.synopsis = "Destroys a contact type"
- m.http_method = "DELETE"
- m.uri = "/settings/contact_types/:id"
-
m.parameter('id') do |p|
p.required = 'Y'
p.type = 'int'
p.description = 'the ID of the existing contact type'
end
-
end
c.method('List Methods') do |m|
-
- m.synopsis = "Lists all contact methods"
- m.http_method = "GET"
- m.uri = "/settings/contact_methods"
-
+ m.synopsis = 'Lists all contact methods'
+ m.http_method = 'GET'
+ m.uri = '/settings/contact_methods'
end
c.method('List Statuses') do |m|
-
- m.synopsis = "Lists all contact status types"
- m.http_method = "GET"
- m.uri = "/settings/contact_statuses"
-
+ m.synopsis = 'Lists all contact status types'
+ m.http_method = 'GET'
+ m.uri = '/settings/contact_statuses'
end
-
end
-
end