package com.pengrad.telegrambot;

import com.google.gson.Gson;
import com.pengrad.telegrambot.impl.FileApi;
import com.pengrad.telegrambot.impl.TelegramBotClient;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;

/**
 * stas
 * 8/4/15.
 */
public class TelegramBotAdapter {

    public static final String API_URL = "https://api.telegram.org/bot";

    public static TelegramBot build(String botToken) {
        return buildCustom(botToken, client(null));
    }

    public static TelegramBot buildDebug(String botToken) {
        return buildCustom(botToken, client(httpLoggingInterceptor()));
    }

    public static TelegramBot buildCustom(String botToken, OkHttpClient okHttpClient) {
        TelegramBotClient client = new TelegramBotClient(okHttpClient, gson(), apiUrl(botToken));
        FileApi fileApi = new FileApi(botToken);
        return new TelegramBot(client, fileApi);
    }

    private static OkHttpClient client(Interceptor interceptor) {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        if (interceptor != null) builder.addInterceptor(interceptor);
        return builder.build();
    }

    private static Interceptor httpLoggingInterceptor() {
        return new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
    }

    private static Gson gson() {
        return new Gson();
    }

    private static String apiUrl(String botToken) {
        return API_URL + botToken + "/";
    }
}

@@ -734,24 +734,195 @@
 tpClient) %7B%0A
+        return buildCustom(botToken, okHttpClient, API_URL);%0A    %7D%0A%0A    public static TelegramBot buildCustom(String botToken, OkHttpClient okHttpClient, String apiUrl) %7B%0A
         Tele
@@ -995,16 +995,24 @@
  apiUrl(
+apiUrl, 
 botToken
@@ -1615,32 +1615,47 @@
 g apiUrl(String 
+apiUrl, String 
 botToken) %7B%0A    
@@ -1665,23 +1665,22 @@
  return 
-API_URL
+apiUrl
  + botTo

Change hardcoded telegram API URL for CI mocks (#91)