Skip to content

Commit

Permalink
fixed required changes in #35
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Khanna <rishabhkhanna777@gmail.com>
  • Loading branch information
Rishabhk07 committed May 27, 2017
1 parent 9341ae6 commit b891a2d
Showing 1 changed file with 1 addition and 23 deletions.
Expand Up @@ -54,7 +54,7 @@ public static String getCallbackUrl() {

static String callbackUrl;
static String authToken = "";
static Retrofit r, r2, r3;
static Retrofit r, r2;

public static void init(String clientId, String callbackUrl) {
DigitalOcean.clientId = clientId;
Expand Down Expand Up @@ -169,26 +169,4 @@ public Response intercept(Chain chain) throws IOException {
return r2.create(DigitalOceanStatisticsClient.class);
}

public static Droplet createDOdroplet(final String authToken) {
if (r3 == null) {
OkHttpClient httpClient = new OkHttpClient.Builder()
.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request().newBuilder()
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer " + authToken)
.build();
return chain.proceed(request);
}
})
.build();
r3 = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient)
.build();
}
return r3.create(Droplet.class);
}
}

0 comments on commit b891a2d

Please sign in to comment.