Permalink
Browse files

remove all the rest of old-fauna.

  • Loading branch information...
robey committed Apr 29, 2013
1 parent 5f47388 commit 08bfa42b96b20f77bd6d99cf36067fa418de2241
Showing with 0 additions and 116 deletions.
  1. +0 −116 src/fauna.coffee
View
@@ -14,119 +14,3 @@ exports.Schema = schema.Schema
# useful for debugging
util = require 'util'
exports.dump = (x) -> util.inspect(x, false, null, true)
-
-
-
-# ----- RUBBISH -----
-
-Q = require 'q'
-util = require 'util'
-
-dump = (x) -> util.inspect(x, false, null, true)
-
-
-
-
-class Fauna
-
-
-
-
-
- # ----- client keys
-
-
- getOrCreateClientKey: ->
- @getClientKeys().then (keys) =>
- if keys.length > 0 then return keys[0].key
- @createClientKey().then (key) => key.key
-
- deleteClientKey: (ref) ->
- if ref.indexOf("keys/client/") == 0 then ref = ref.split("/")[2]
- @delete("keys/client/#{ref}")
-
- deleteClientKeys: (refs) ->
- if refs.length == 0 then return
- ref = refs.shift()
- @deleteClientKey(ref).then (_) => @deleteClientKeys(refs)
-
- deleteAllClientKeys: ->
- @getClientKeys().then (keys) =>
- @deleteClientKeys keys.map((key) => key.ref)
-
-
- ## ----- classes
-
- # auth: token or publisher
- listInstancesOfClass: (className, params) ->
- @getEventSet("classes/#{className}", params)
-
-
- ## ----- event sets
-
-
-
- # auth: token or publisher
- # returns: list containing the new object
- addToEventSet: (setName, ref) ->
- @post("#{setName}", resource: ref).then (data) =>
- @collapseEvents(data)
-
- # auth: token or publisher
- # returns: usually an empty set, because the event was a delete.
- deleteFromEventSet: (setName, ref) ->
- @delete("#{setName}", resource: ref).then (data) => @collapseEvents(data)
-
-
- ## ----- users
-
-
- # auth: publisher
- getUserByEmail: (email) ->
- @get("users/email/#{email}").then (data) => @schema.inflate(data.resource, @)
-
- # auth: token or publisher
- getUser: (ref) ->
- @get("#{ref}").then (data) => @schema.inflate(data.resource, @)
-
- # auth: client or publisher
- createUser: (user) ->
- @post("users", user).then (data) =>
- data.resource
- .fail (error) =>
- obj = JSON.parse(error.body)
- if obj.error? then throw new FaunaError(obj) else throw error
-
- # auth: token or publisher
- deleteUser: (ref) ->
- @delete(ref)
-
- # auth: client or publisher
- login: (email, password) ->
- @post("tokens", { email: email, password: password }).then (data) =>
- data.resource
- .fail (error) =>
- obj = JSON.parse(error.body)
- if obj.error? then throw new FaunaError(obj) else throw error
-
-
- ## ----- instances
-
- # auth: token or publisher
- # returns: object
- getInstance: (ref) ->
- @get("#{ref}").then (data) => @schema.inflate(data.resource, @)
-
- # auth: token or publisher
- createInstance: (obj) ->
- className = @schema.classNameFor(obj)
- @post("classes/#{className}", @schema.deflate(obj)).then (data) =>
- @schema.setFaunaData(obj, @, className, data.resource)
- obj
-
- deleteInstance: (ref) ->
- if ref.indexOf("instances/") == 0 then ref = ref.split("/")[1]
- @delete("instances/#{ref}")
-
-
-exports.Fauna = Fauna

0 comments on commit 08bfa42

Please sign in to comment.