def upload(obj)
      params = if obj.is_a?(File)
        { :file => obj }
        raise Crocodoc::Error, "TODO: support raw files"
      else
        { :url => obj.to_s }
      end

      raw_body = api_call(:post, "document/upload", params)
      JSON.parse(raw_body)
    end
def upload(obj)
      params = if obj.is_a?(File)
        { :file => obj }
        raise Crocodoc::Error, "TODO: support raw files"
      else
        { :url => obj.to_s }
      end

      raw_body = api_call(:post, "document/upload", params)
      JSON.parse(raw_body)
    end
Public: Initialize a Crocodoc api object

 opts - A hash of options with which to initialize the object
        :token - The api token to use to authenticate requests. Required.

 Examples
   crocodoc = Crocodoc::API.new(:token => <token>)
   # => <Crocodoc::API:<id>>
 -- Documents --
 Public: Upload a url or file. Uploading is asynchronous, so this method
 returns immediately.

   POST https://crocodoc.com/api/v2/document/upload

 obj - a url string or file to upload

 Examples

   upload("http://www.example.com/test.doc")
   # => { "uuid": "8e5b0721-26c4-11df-b354-002170de47d3" }

 Returns a hash containing the uuid of the document and possibly an error
   explaining why the upload failed.