Skip to content

Commit 5eda5f4

Browse files
Fix 18 & 19, change version to 1, leave some new interface unimplemented
1 parent d70f4e5 commit 5eda5f4

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#Sat Apr 30 13:24:20 CST 2011
2+
eclipse.preferences.version=1
3+
upgradeSDK/fb4=

HsDropbox/src/org/hamster/dropbox/DropboxClient.as

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ package org.hamster.dropbox
121121
email:email,
122122
first_name:first_name,
123123
last_name: last_name,
124-
password:password
124+
password:password,
125+
locale: config.locale
125126
}
126127
var urlReqHeader:URLRequestHeader = OAuthHelper.buildURLRequestHeader(url, params,
127128
config.consumerKey, config.consumerSecret,
@@ -425,13 +426,20 @@ package org.hamster.dropbox
425426
*
426427
* @param filePath
427428
* @param root, optional, default is "dropbox" 2011/01/22
429+
* @rev file revision added in v1
428430
* @return urlLoader
429431
*/
430-
public function getFile(filePath:String,
432+
public function getFile(filePath:String, rev:String = "",
431433
root:String=DropboxConfig.DROPBOX):URLLoader
432434
{
435+
var params:Object = null;
436+
if (rev != "") {
437+
params = {
438+
rev : rev
439+
}
440+
}
433441
var urlRequest:URLRequest = buildURLRequest(
434-
config.contentServer, "/files/" + root + '/' + buildFilePath(filePath), null);
442+
config.contentServer, "/files/" + root + '/' + buildFilePath(filePath), params);
435443
return this.load(urlRequest, DropboxEvent.GET_FILE_RESULT,
436444
DropboxEvent.GET_FILE_FAULT, "", URLLoaderDataFormat.BINARY);
437445
}
@@ -665,7 +673,7 @@ package org.hamster.dropbox
665673
} else {
666674
protocol += "://";
667675
}
668-
return protocol + host + portString + '/' + config.apiVersion + target;
676+
return protocol + host + portString + (target == "" ? "" : '/' + config.apiVersion + target);
669677
}
670678

671679
/**

HsDropbox/src/org/hamster/dropbox/DropboxConfig.as

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,24 @@ package org.hamster.dropbox
99
*/
1010
public class DropboxConfig
1111
{
12-
public static const API_VERSION:int = 0;
13-
public static const SERVER:String = 'api.dropbox.com';
14-
public static const CONTENT_SERVER:String = 'api-content.dropbox.com';
12+
public static const API_VERSION:int = 1;
13+
public static const SERVER:String = 'https://api.dropbox.com';
14+
public static const CONTENT_SERVER:String = 'https://api-content.dropbox.com';
1515
public static const PORT:int = 80;
16-
public static const REQUEST_TOKEN_URL:String = 'http://api.dropbox.com/0/oauth/request_token';
17-
public static const ACCESS_TOKEN_URL:String = 'http://api.dropbox.com/0/oauth/access_token';
18-
//public static const AUTHORIZATION_URL:String = 'http://api.dropbox.com/0/oauth/authorize';
19-
public static const AUTHORIZATION_URL:String = 'https://www.dropbox.com/0/oauth/authorize';
20-
public static const TOKEN_URL:String = 'https://api.dropbox.com/0/token';
16+
// public static const REQUEST_TOKEN_URL:String = 'http://api.dropbox.com/0/oauth/request_token';
17+
// public static const ACCESS_TOKEN_URL:String = 'http://api.dropbox.com/0/oauth/access_token';
18+
// public static const AUTHORIZATION_URL:String = 'https://www.dropbox.com/0/oauth/authorize';
19+
// public static const TOKEN_URL:String = 'https://api.dropbox.com/0/token';
20+
public static const REQUEST_TOKEN_URL:String = 'https://api.dropbox.com/1/oauth/request_token';
21+
public static const ACCESS_TOKEN_URL:String = 'https://api.dropbox.com/1/oauth/access_token';
22+
public static const AUTHORIZATION_URL:String = 'https://www.dropbox.com/1/oauth/authorize';
23+
public static const TOKEN_URL:String = 'https://api.dropbox.com/1/token';
2124
public static const SANDBOX:String = 'sandbox';
2225
public static const DROPBOX:String = 'dropbox';
2326
/**
2427
* xperiments UPDATE
2528
*/
26-
public static const ACCOUNT_CREATE_URL:String = 'http://api.dropbox.com/0/account';
29+
public static const ACCOUNT_CREATE_URL:String = 'https://api.dropbox.com/1/account';
2730

2831
public var consumerKey:String;
2932
public var consumerSecret:String;
@@ -70,6 +73,12 @@ package org.hamster.dropbox
7073
*/
7174
public var accountCreateUrl:String;
7275

76+
/**
77+
* * Added In Version 1
78+
* locale for response language
79+
*/
80+
public var locale:String = "en_US";
81+
7382
/**
7483
* Constructor
7584
*
@@ -83,7 +92,7 @@ package org.hamster.dropbox
8392
public function DropboxConfig(
8493
consumerKey:String, consumerSecret:String,
8594
requestTokenKey:String = "", requestTokenSecret:String = "",
86-
accessTokenKey:String = "", accessTokenSecret:String = "")
95+
accessTokenKey:String = "", accessTokenSecret:String = "", locale:String = "en_US")
8796
{
8897
this.setConsumer(consumerKey, consumerSecret);
8998
this.setRequestToken(requestTokenKey, requestTokenSecret);
@@ -100,6 +109,8 @@ package org.hamster.dropbox
100109
* xperiments UPDATE
101110
*/
102111
this.accountCreateUrl = ACCOUNT_CREATE_URL;
112+
113+
this.locale = locale;
103114
}
104115

105116
/**

HsDropbox/src/org/hamster/dropbox/utils/OAuthHelper.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ package org.hamster.dropbox.utils
208208
var aParams:Array = new Array();
209209
// loop over params, find the ones we need
210210
for (var param:String in params) {
211-
if (param != "oauth_signature") {
211+
if (param != "oauth_signature" && param != "locale") {
212212
aParams.push(param + "=" + encodeURIComponent(params[param].toString()));
213213
}
214214
}

0 commit comments

Comments
 (0)