forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
box.js
55 lines (42 loc) · 734 Bytes
/
box.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
hello.init({
box: {
name: 'Box',
oauth: {
version: 2,
auth: 'https://app.box.com/api/oauth2/authorize',
grant: 'https://api.box.com/oauth2/token',
response_type: 'code'
},
scope: {
basic: ''
},
base: 'https://api.box.com/2.0/',
get: {
me: 'users/me',
'me/files': 'files'
},
wrap: {
me: function(o) {
if (o.id) {
o.picture = o.thumbnail = o.avatar_url;
if (o.login.match('@')) {
o.email = o.login;
}
}
return o;
},
'me/files': function(o) {
if (Array.isArray(o)) {
return {data:o};
}
return o;
}
},
xhr: function(p) {
p.proxy = true;
p.proxy_response_type = 'proxy';
return true;
},
jsonp: false
}
});