node-box-sdk
Advanced tools
Comparing version 0.1.7 to 0.1.8
var _ = require('lodash'); | ||
var api = require('../../api'); | ||
var async = require('async'); | ||
var async = require('async'); | ||
var generate = require('../generate'); | ||
@@ -16,5 +16,2 @@ | ||
}, | ||
update: function update(id, data, options, callback) { | ||
api.execute[this.api]('PUT', this.url + '/' + id, data, options, callback); | ||
}, | ||
upload: function upload(data, options, callback) { | ||
@@ -21,0 +18,0 @@ options.multipart = true; |
{ | ||
"name": "node-box-sdk", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Node.js Box SDK", | ||
"main": "box.js", | ||
"scripts": { | ||
"test": "mocha --recursive test" | ||
"test": "echo \"Error: Configure Tests Before Running\" && exit 1" | ||
}, | ||
@@ -9,0 +9,0 @@ "author": "Cydney Auman", |
# Node.js Box SDK | ||
---------- | ||
### Deprecated | ||
In July 2015 Box released their official node module. This has since been deprecated in favor of supporting development efforts there. | ||
https://www.npmjs.com/package/box-node-sdk | ||
https://github.com/box/box-node-sdk | ||
---------- | ||
Node.js module for both [Box.com Content API](https://box-content.readme.io/) & [Box.com View API](https://box-view.readme.io/) | ||
@@ -7,3 +17,3 @@ | ||
Examples of how to integrate this module into Express as middleware and into Hapi as a plugin are located in the examples folder. The examples provided show how to attach the node-box-sdk to the server object, set the returned encrypted token string as a cookie and how to use this encrypted token string with the node-box-sdk methods. | ||
Examples of how to integrate this module into Express as middleware and into Hapi as a plugin are located in the examples folder. The examples provided show how to attach the node-box-sdk to the server object, set the returned encrypted token string as a cookie and how to use this encrypted token string with the node-box-sdk methods. | ||
@@ -19,3 +29,2 @@ Contributors Welcome! | ||
- Shared Items - Completed | ||
- Search - Completed | ||
- All Additional Methods - In Progress | ||
@@ -35,4 +44,4 @@ | ||
npm install node-box-sdk | ||
---------- | ||
@@ -48,5 +57,5 @@ | ||
}); | ||
---------- | ||
@@ -66,3 +75,3 @@ | ||
#### Generate Tokens | ||
Returns the access tokens. If the box client was configured using encrypt with a password then the tokens will be returned as an encrypted string. Otherwise the tokens will be returned as an object. Either the encrypted token string or the token object will need to be persisted, because the box client will handle refreshing the authorization tokens as needed. | ||
Returns the access tokens. If the box client was configured using encrypt with a password then the tokens will be returned as an encrypted string. Otherwise the tokens will be returned as an object. Either the encrypted token string or the token object will need to be persisted, because the box client will handle refreshing the authorization tokens as needed. | ||
@@ -78,3 +87,3 @@ One option is to set the encrypted token string as cookie in a web application. Examples of this strategy are provided. | ||
###Folder Operations | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
@@ -106,3 +115,3 @@ The reason for this is because - iIf the access token was expired, node-box-sdk will attempt to refresh this token and then returns the updated version of the access tokens as an encrypted string. If no refresh was needed then it returns the same access tokens as an encrypted string. | ||
#### Delete | ||
Moves the folder to trash. | ||
Moves the folder to trash. | ||
Returns an empty response.body and a 204 if successful. | ||
@@ -124,3 +133,3 @@ *A recursive parameter must be included in order to delete folders that have items inside of them | ||
var data = { parent: { id : 0 }, name: "AnotherBoxTest" }; | ||
box.content.folder.copy(folderID, data, { tokens: tokens }, function(err, res, tokens) { }); | ||
box.content.folder.copy(folderID, data, { tokens: tokens }, function(err, res, tokens) { }); | ||
@@ -143,5 +152,5 @@ #### Restore | ||
Creates a shared link for this folder, returns a full folder object in the response.body. | ||
var data = { shared_link: { } }; // default access | ||
box.content.folder.share(folderID, data, { tokens: tokens }, function(err, res, tokens) { }); | ||
box.content.folder.share(folderID, data, { tokens: tokens }, function(err, res, tokens) { }); | ||
@@ -151,3 +160,3 @@ #### Collaborations | ||
box.content.folder.collaborations(folderID, { tokens: tokens }, function(err, res, tokens) { }); | ||
box.content.folder.collaborations(folderID, { tokens: tokens }, function(err, res, tokens) { }); | ||
@@ -158,31 +167,12 @@ ---------- | ||
###File Operations | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
The reason for this is because - iIf the access token was expired, node-box-sdk will attempt to refresh this token and then returns the updated version of the access tokens as an encrypted string. If no refresh was needed then it returns the same access tokens as an encrypted string. | ||
#### Upload | ||
Returns a full file object inside response.body if the folderID is valid. | ||
// TODO update docs | ||
var data = { name: 'Penguin Facts', folder: folderId, file: file, filename: 'penguin_fact_sheet.pdf' }; | ||
var options = {}; | ||
box.content.file.upload(data, options, function(err, res, tokens) { }); | ||
#### Get | ||
Returns a full file object inside response.body. | ||
var options = {}; | ||
box.content.file.get(fileId, options, function(err, res, tokens) { }); | ||
#### Update | ||
Returns the updated full file object inside response.body. | ||
var data = { name: 'Penguin Facts v2', description: 'updated version of penguin fact sheet' }; | ||
box.content.file.update(fileId, data, options, function(err, res, tokens) { }); | ||
---------- | ||
###Shared Items Operations | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
@@ -195,28 +185,2 @@ The reason for this is because - iIf the access token was expired, node-box-sdk will attempt to refresh this token and then returns the updated version of the access tokens as an encrypted string. If no refresh was needed then it returns the same access tokens as an encrypted string. | ||
###Search | ||
All methods have a 3rd argument in the callback function 'tokens'. Each time the node-box-sdk callsback with the access tokens as an encrypted string. | ||
The reason for this is because - if the access token was expired, node-box-sdk will attempt to refresh this token and then returns the updated version of the access tokens as an encrypted string. If no refresh was needed then it returns the same access tokens as an encrypted string. | ||
var options = { | ||
query: '', | ||
scope: '', | ||
file_extensions: '', | ||
created_at_range: '', | ||
updated_at_range: '', | ||
size_range: '', | ||
owner_user_ids '', | ||
ancestor_folder_ids: '', | ||
content_types: '', | ||
type: '', | ||
trash_content: '', | ||
limit: '', | ||
offset: '' | ||
} | ||
box.content.search(query, { tokens: tokens }, function(err, res, tokens) { }); | ||
---------- | ||
## View API | ||
@@ -229,10 +193,2 @@ | ||
### Running Integration Tests | ||
1. npm install -g phantomjs (phantom.js is used with casper.js to login into box.com via a headless client) | ||
2. Setup the config.json with the credentials your application will use. | ||
3. npm test | ||
---------- | ||
### Express Use Example | ||
@@ -239,0 +195,0 @@ [Using node-box-sdk inside Express](https://github.com/cydneymikel/node-box-sdk/tree/master/examples/express) |
@@ -40,3 +40,3 @@ var box = require('../box'); | ||
before(function(done) { | ||
var args = [redirect, config.headlessClient.username, config.headlessClient.password]; | ||
var args = [redirect, config.username, config.password]; | ||
@@ -43,0 +43,0 @@ util.runHeadlessClient(args, function(resource) { |
@@ -42,17 +42,2 @@ var async = require('async'); | ||
// UPDATE File Info | ||
it('should update info for a file from box folder', function(done) { | ||
var data = { name: 'Penguin Facts v2', description: 'updated version of penguin fact sheet' }; | ||
box.content.file.update(global.fileId, data, global.options, function(err, res, tokens) { | ||
expect(res.body).to.have.property('id', global.fileId); | ||
expect(res.body).to.have.property('type', 'file'); | ||
expect(res.body).to.have.property('name', data.name); | ||
expect(res.body).to.have.property('description', data.description); | ||
global.options = { tokens: tokens }; | ||
done(); | ||
}); | ||
}); | ||
// PUT Create Shared Link | ||
@@ -59,0 +44,0 @@ it('should create a shared link for a file', function(done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
319183
959
195