Sha256: f0b73f8af937f2bd3f5d65a072f7d87b825c51629fad79616944803529f4696d

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

window.jNorthPole =
  root: Math.sqrt,
  square: (x) -> x * x,
  cube: (x) -> x * this.square x,
  createUser: (api_key, secret, success, failer) ->
    jsonObj = {'api_key': api_key, 'secret': secret}
    $.ajax
      type: "POST"
      url: "/user.json"
      data: JSON.stringify(jsonObj)
      success: (data, textStatus, jqXHR) ->
        success()
      error: (jqXHR, textstatus, errorthrown) ->
        failer(jqXHR)
  genericRequest: (jsonObj, method, responseHandler) ->
    $.ajax
      type: method
      url: "/storage.json"
      data: JSON.stringify(jsonObj)
      success: (data, textStatus, jqXHR) ->
        responseHandler(data)
      error: (jqXHR, textstatus, errorthrown) ->
        console.log(jqXHR.responseText)
        responseHandler(JSON.parse(jqXHR.responseText))
  createStorage: (jsonObj, responseHandler) ->
    this.genericRequest(jsonObj, 'POST', responseHandler)
  putStorage: (jsonObj, responseHandler) ->
    this.genericRequest(jsonObj, 'PUT', responseHandler)
  getStorage: (jsonObj, responseHandler) ->
    this.genericRequest(jsonObj, 'SEARCH', responseHandler)
  deleteStorage: (jsonObj, responseHandler) ->
    this.genericRequest(jsonObj, 'DELETE', responseHandler)
  getUrl: (id) ->
    "http://localhost:9292/storage.json?id=" + id

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ki-0.4.9 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.8 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.7 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.6 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.5 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.4 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.3 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.2 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee
ki-0.4.1 spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee