dormouse
Version:
Javascript API for Dormouse
50 lines (38 loc) • 1.25 kB
text/coffeescript
#### Project manipulation methods
# Want to get project information or create a new one?
#
# Look no further.
#### Project structure on API
#
# {
# id: '1234',
# template: '2561'
# }
#### And now for code
path = require 'path'
Connection = require('./connection').Connection
# * Projects mixin for Dormouse
# * basic API operations
class Projects extends Connection
# Get all projects from Dormouse
# @param id of project to fetch
if err then callback err, r
else callback null, r.project
# Get all projects from Dormouse
if err then callback err, r
else callback null, r.map (p) ->
p.project
post_path = 'projects.json'
this.post post_path, {}, project_info, callback
put_path = path.join 'projects', "#{project.id}.json"
this.put put_path, {}, project, callback
delete_path = path.join 'projects', "#{project.id}.json"
this.delete delete_path, callback
exports.Projects = Projects