update api and docs

This commit is contained in:
Connor Turland 2016-12-18 15:12:23 -05:00
parent 2beaa2e5be
commit 5c12949c8d
6 changed files with 26 additions and 2 deletions

View file

@ -18,6 +18,7 @@ module Api
def self.embeddable def self.embeddable
{ {
user: {}, user: {},
source: {},
topics: {}, topics: {},
synapses: {}, synapses: {},
mappings: {}, mappings: {},

View file

@ -1,6 +1,6 @@
#type: collection #type: collection
get: get:
is: [ searchable: { searchFields: "name, desc" }, embeddable: { embedFields: "user,topics,synapses,mappings,contributors,collaborators" }, orderable, pageable ] is: [ searchable: { searchFields: "name, desc" }, embeddable: { embedFields: "user,source,topics,synapses,mappings,contributors,collaborators" }, orderable, pageable ]
securedBy: [ null, token, oauth_2_0, cookie ] securedBy: [ null, token, oauth_2_0, cookie ]
queryParameters: queryParameters:
user_id: user_id:
@ -23,6 +23,8 @@ post:
description: description description: description
permission: permission:
description: commons, public, or private description: commons, public, or private
source_id:
description: the id of the map this map is a fork of
screenshot: screenshot:
description: url to a screenshot of the map description: url to a screenshot of the map
contributor_ids: contributor_ids:
@ -37,7 +39,7 @@ post:
/{id}: /{id}:
#type: item #type: item
get: get:
is: [ embeddable: { embedFields: "user,topics,synapses,mappings,contributors,collaborators" } ] is: [ embeddable: { embedFields: "user,source,topics,synapses,mappings,contributors,collaborators" } ]
securedBy: [ null, token, oauth_2_0, cookie ] securedBy: [ null, token, oauth_2_0, cookie ]
responses: responses:
200: 200:
@ -60,6 +62,9 @@ post:
screenshot: screenshot:
description: url to a screenshot of the map description: url to a screenshot of the map
required: false required: false
source_id:
description: the id of the map this map is a fork of
required: false
responses: responses:
200: 200:
body: body:
@ -81,6 +86,9 @@ post:
screenshot: screenshot:
description: url to a screenshot of the map description: url to a screenshot of the map
required: false required: false
source_id:
description: the id of the map this map is a fork of
required: false
responses: responses:
200: 200:
body: body:

View file

@ -9,6 +9,7 @@
"created_at": "2016-03-26T08:02:05.379Z", "created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z", "updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234, "user_id": 1234,
"source_id": null,
"topic_ids": [ "topic_ids": [
58, 58,
59 59

View file

@ -9,6 +9,7 @@
"created_at": "2016-03-26T08:02:05.379Z", "created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z", "updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234, "user_id": 1234,
"source_id": null,
"topic_ids": [ "topic_ids": [
58, 58,
59 59

View file

@ -10,6 +10,7 @@
"created_at": "2016-03-26T08:02:05.379Z", "created_at": "2016-03-26T08:02:05.379Z",
"updated_at": "2016-03-27T07:20:18.047Z", "updated_at": "2016-03-27T07:20:18.047Z",
"user_id": 1234, "user_id": 1234,
"source_id": 2,
"topic_ids": [ "topic_ids": [
58, 58,
59 59

View file

@ -33,6 +33,12 @@
"user": { "user": {
"$ref": "_user.json" "$ref": "_user.json"
}, },
"source_id": {
"$ref": "_id.json"
},
"source": {
"$ref": "_map.json"
},
"topic_ids": { "topic_ids": {
"type": "array", "type": "array",
"items": { "items": {
@ -111,6 +117,12 @@
{ "required": [ "user" ] } { "required": [ "user" ] }
] ]
}, },
{
"oneOf": [
{ "required": [ "source_id" ] },
{ "required": [ "source" ] }
]
},
{ {
"oneOf": [ "oneOf": [
{ "required": [ "topic_ids" ] }, { "required": [ "topic_ids" ] },