Skip to content
This repository
Browse code

Update src/main/java/org/scribe/builder/api/ConstantContactApi2.java

fixed indentation (4 spaces, no wrap)
  • Loading branch information...
commit 6e6fd53306824462bfb42fa7b10690570a8e7c1c 1 parent a121c3a
Eran Medan authored August 17, 2012
51  src/main/java/org/scribe/builder/api/ConstantContactApi2.java
@@ -11,47 +11,40 @@
11 11
 import org.scribe.utils.OAuthEncoder;
12 12
 import org.scribe.utils.Preconditions;
13 13
 
14  
-public class ConstantContactApi2 extends DefaultApi20 
15  
-{
16  
-	
17  
-	private static final String AUTHORIZE_URL = "https://oauth2.constantcontact.com/oauth2/oauth/siteowner/authorize?client_id=%s&response_type=code&redirect_uri=%s";
18  
-	
19  
-	@Override
20  
-	public String getAccessTokenEndpoint() 
21  
-	{
22  
-		return "https://oauth2.constantcontact.com/oauth2/oauth/token?grant_type=authorization_code";
23  
-	}
24  
-
25  
-	
26  
-	@Override
27  
-	public String getAuthorizationUrl(OAuthConfig config) 
28  
-	{
29  
-		return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
30  
-	}
31  
-	
  14
+public class ConstantContactApi2 extends DefaultApi20 {
  15
+
  16
+    private static final String AUTHORIZE_URL = "https://oauth2.constantcontact.com/oauth2/oauth/siteowner/authorize?client_id=%s&response_type=code&redirect_uri=%s";
  17
+
  18
+    @Override
  19
+    public String getAccessTokenEndpoint() {
  20
+        return "https://oauth2.constantcontact.com/oauth2/oauth/token?grant_type=authorization_code";
  21
+    }
  22
+
  23
+    @Override
  24
+    public String getAuthorizationUrl(OAuthConfig config) {
  25
+        return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
  26
+    }
  27
+
32 28
     @Override
33 29
     public Verb getAccessTokenVerb() {
34 30
         return Verb.POST;
35 31
     }
36  
-    
  32
+
37 33
     @Override
38 34
     public AccessTokenExtractor getAccessTokenExtractor() {
39 35
         return new AccessTokenExtractor() {
40  
-            
  36
+
41 37
             @Override
42 38
             public Token extract(String response) {
43 39
                 Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");
44 40
 
45 41
                 String regex = "\"access_token\"\\s*:\\s*\"([^&\"]+)\"";
46  
-				Matcher matcher = Pattern.compile(regex).matcher(response);
47  
-                if (matcher.find())
48  
-                {
49  
-                  String token = OAuthEncoder.decode(matcher.group(1));
50  
-                  return new Token(token, "", response);
51  
-                } 
52  
-                else
53  
-                {
54  
-                  throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
  42
+                Matcher matcher = Pattern.compile(regex).matcher(response);
  43
+                if (matcher.find()) {
  44
+                    String token = OAuthEncoder.decode(matcher.group(1));
  45
+                    return new Token(token, "", response);
  46
+                } else {
  47
+                    throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null);
55 48
                 }
56 49
             }
57 50
         };

0 notes on commit 6e6fd53

Please sign in to comment.
Something went wrong with that request. Please try again.