Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added semicolons in order to avoid religious fury.

  • Loading branch information...
commit a2afa43e282ff3a61e97daf4c489d3432f349ef3 1 parent 99e3b60
@evnm authored
View
2  index.js
@@ -1 +1 @@
-module.exports = require('./lib/dropbox-node')
+module.exports = require('./lib/dropbox-node');
View
41 lib/dropbox-node/index.js
@@ -2,14 +2,14 @@ var http = require('http'),
sys = require('sys'),
API_URI = 'http://api.dropbox.com/',
CONTENT_API_URI = 'https://api-content.dropbox.com/',
- API_VERSION = '0'
+ API_VERSION = '0';
// Returns a Dropbox Client, through which API calls can be made.
var DropboxClient = exports.DropboxClient =
function(oauth, access_token, access_token_secret) {
- this.oauth = oauth
- this.access_token = access_token
- this.access_token_secret = access_token_secret
+ this.oauth = oauth;
+ this.access_token = access_token;
+ this.access_token_secret = access_token_secret;
}
// Retrieves information about the user's account as a JSON response.
@@ -17,7 +17,8 @@ DropboxClient.prototype.getAccountInfo = function(callback) {
this.oauth.get(API_URI + API_VERSION + '/account/info/',
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Retrieves contents of a file specified by path argument, relative to
@@ -26,7 +27,8 @@ DropboxClient.prototype.getFile = function(path, callback) {
this.oauth.get(CONTENT_API_URI + API_VERSION + '/files/dropbox/' + path,
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Uploads contents of a file specified by path argument, relative to
@@ -34,20 +36,21 @@ DropboxClient.prototype.getFile = function(path, callback) {
DropboxClient.prototype.putFile = function(file, path, callback) {
var boundary = 'sAxIqse3tPlHqUIUI9ofVlHvtdt3tpaG',
content_type = 'multipart/form-data; boundary=' + boundary,
- file_contents = require('fs').readFileSync(file)
+ file_contents = require('fs').readFileSync(file);
// Build request body.
var body = '--' + boundary + '\r\n' +
'Content-Disposition: form-data; name=file; filename=' + file + '\r\n' +
'Content-type: application/octet-stream\r\n' +
'\r\n' + file_contents + '\r\n' +
- '--' + boundary + '--'
+ '--' + boundary + '--';
this.oauth.post(CONTENT_API_URI + API_VERSION + '/files/dropbox/' + path +
'?file=' + file,
this.access_token, this.access_token_secret,
body, content_type,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Gets metadata of file/folder specified by path relative to user's
@@ -57,19 +60,21 @@ DropboxClient.prototype.getMetadata = function(path, callback) {
this.oauth.get(API_URI + API_VERSION + '/metadata/dropbox/' + path,
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Downloads a minimized jpeg thumbnail for a photo. See
// https://www.dropbox.com/developers/docs#thumbnails for a list of
// valid size specifiers.
DropboxClient.prototype.getThumbnail = function(path, size, callback) {
- if (typeof(size) == 'function') callback = size, size = null
+ if (typeof(size) == 'function') callback = size, size = null;
this.oauth.get(CONTENT_API_URI + API_VERSION + '/thumbnails/dropbox/' +
path + ((size) ? '?size=' + size : ''),
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Copies a file or folder to a new location.
@@ -80,7 +85,8 @@ DropboxClient.prototype.copy = function(from_path, to_path, callback) {
from_path + '&root=dropbox&to_path=' + to_path,
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Creates a folder relative to the user's Dropbox root.
@@ -91,7 +97,8 @@ DropboxClient.prototype.createFolder = function(path, callback) {
+ path +'&root=dropbox',
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Deletes a file or folder.
@@ -102,7 +109,8 @@ DropboxClient.prototype.delete = function(path, callback) {
path + '&root=dropbox',
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
// Moves a file or folder.
@@ -113,5 +121,6 @@ DropboxClient.prototype.move = function(from_path, to_path, callback) {
from_path + '&root=dropbox&to_path=' + to_path,
this.access_token, this.access_token_secret,
function(err, data, res) {
- callback(err, data)})
+ callback(err, data);
+ });
}
View
24 spec/DropboxClientSpec.js
@@ -1,22 +1,22 @@
var DropboxClient = require('../lib/dropbox-node').DropboxClient,
- OAuth = require('oauth').OAuth
+ OAuth = require('oauth').OAuth;
describe('dropbox-node', function() {
oauth = new OAuth(null, null, null, null,
- null, null, 'HMAC-SHA1')
+ null, null, 'HMAC-SHA1');
it('sets oauth object', function() {
- var dropbox = new DropboxClient(oauth, null, null)
- expect(dropbox.oauth).toBe(oauth)
- })
+ var dropbox = new DropboxClient(oauth, null, null);
+ expect(dropbox.oauth).toBe(oauth);
+ });
it('sets access token', function() {
- var dropbox = new DropboxClient(null, 'foo', null)
- expect(dropbox.access_token).toEqual('foo')
- })
+ var dropbox = new DropboxClient(null, 'foo', null);
+ expect(dropbox.access_token).toEqual('foo');
+ });
it('sets access token secret', function() {
- var dropbox = new DropboxClient(null, null, 'bar')
- expect(dropbox.access_token_secret).toEqual('bar')
- })
-})
+ var dropbox = new DropboxClient(null, null, 'bar');
+ expect(dropbox.access_token_secret).toEqual('bar');
+ });
+});
View
18 specs.js
@@ -1,21 +1,21 @@
var jasmine = require('jasmine'),
- sys = require('sys')
+ sys = require('sys');
for (var key in jasmine) {
- global[key] = jasmine[key]
+ global[key] = jasmine[key];
}
var isVerbose = false,
- showColors = true
+ showColors = true;
process.argv.forEach(function(arg) {
switch (arg) {
- case '--color': showColors = true; break
- case '--noColor': showColors = false; break
- case '--verbose': isVerbose = true; break
+ case '--color': showColors = true; break;
+ case '--noColor': showColors = false; break;
+ case '--verbose': isVerbose = true; break;
}
-})
+});
jasmine.executeSpecsInFolder(__dirname + '/spec', function(runner, log) {
- process.exit(runner.results().failedCount)
-}, isVerbose, showColors)
+ process.exit(runner.results().failedCount);
+}, isVerbose, showColors);
Please sign in to comment.
Something went wrong with that request. Please try again.