Added support for Google's 'scope' param

This commit is contained in:
Pablo Fernandez committed 2010-10-20 10:25:26 -03:00
1 parent c3f113f39b
commit 1f94997120
6 files changed
+48 -3

No files matched your search

@@ -20,6 +20,7 @@ public class ServiceBuilder
private String apiSecret;
private String callback;
private Api api;
private String scope;
public ServiceBuilder()
{
@@ -92,6 +93,18 @@ public class ServiceBuilder
return this;
}
/**
* Configures the OAuth scope. This is only necessary in some APIs (like Google's).
*
* @param scope The OAuth scope
* @return the {@link ServiceBuilder} instance for method chaining
*/
public ServiceBuilder scope(String scope)
{
this.scope = scope;
return this;
}
/**
* Returns the fully configured {@link OAuthService}
*
@@ -102,6 +115,6 @@ public class ServiceBuilder
Preconditions.checkNotNull(api, "You must specify a valid api through the provider() method");
Preconditions.checkEmptyString(apiKey, "You must provide an api key");
Preconditions.checkEmptyString(apiSecret, "You must provide an api secret");
return api.createService(apiKey, apiSecret, callback);
return api.createService(apiKey, apiSecret, callback, scope);
}
}