           data: filepath: @get("file_path")
         , options)
       )
-  
+
     parse: (response, options) ->
       # if response is blob content from /blobs
       if _.isString(response)

      @on("sync", -> @set("id", "fakeIDtoenablePUT"))
      @on("change", @parseFilePath)
      @parseFilePath()
  
    parseFilePath: (model, options) ->
      if @get("file_path")
        @set("name", _.last(@get("file_path").split("/")))
  
    sync: (method, model, options) ->
      options = options || {}
      baseURL = "#{root.url}/projects/#{@project.escaped_path()}/repository"

        xhr.setRequestHeader "PRIVATE-TOKEN", root.token if root.token
    , options)
    Backbone.sync method, model, extendedOptions

  @Model = Backbone.Model.extend(sync: @sync)
  @Collection = Backbone.Collection.extend(sync: @sync)

  # Users
  # --------------------------------------------------------

  @User = @Model.extend(
    backboneClass: "User"
    url: -> "#{root.url}/user"
    initialize: ->
      @sshkeys = new root.SSHKeys()
  )

  # SSH Keys
  # --------------------------------------------------------

  @SSHKey = @Model.extend(
    backboneClass: "SSHKey",
    initialize: ->
      @truncate()

    truncate: ->
      key = @get('key').split(/\s/)
      @set "truncated_key", "...#{S(key[1]).right(20)} #{key[2]}"
      true

  )

  @SSHKeys = @Collection.extend(
    backboneClass: "SSHKeys"
    url: -> "#{root.url}/user/keys"
    model: root.SSHKey
  )

  # Project
  # --------------------------------------------------------

  @Project = @Model.extend(
    backboneClass: "Project"
    url: -> "#{root.url}/projects/#{@id || @escaped_path()}"
