// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/AppConfig.java
// public class AppConfig {
//     public static final String ANALYTICS_PROPERTY_KEY = BuildConfig.APP_ANALYTICS_PROPERTY_KEY;
//     public static final String APP_VERSION = BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")";
//     public static final String WIDESPACE_SID = BuildConfig.DEBUG ? BuildConfig.APP_WIDESPACE_DEBUG_SID : BuildConfig.APP_WIDESPACE_SID;
//     public static final String STHLM_TRAVELING_API_KEY = BuildConfig.APP_STHLMTRAVELING_API_KEY;
//     public static final String USER_AGENT = "STHLMTraveling-Android/" + BuildConfig.VERSION_NAME;
//     public static final String STHLM_TRAVELING_API_ENDPOINT = "http://api.sthlmtraveling.se/";
//     public static final String ADMOB_ROUTE_DETAILS_AD_UNIT_ID = BuildConfig.ADMOB_ROUTE_DETAILS_AD_UNIT_ID;
//     public static final String[] ADMOB_TEST_DEVICES = TextUtils.split(BuildConfig.ADMOB_TEST_DEVICES, ",");
// 
//     public static boolean shouldServeAds() {
//         return BuildConfig.APP_IS_ADS_ENABLED;
//     }
// }
// 
// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/data/api/ApiService.java
// public interface ApiService {
//     @GET("/v1/planner/")
//     void getPlan(
//             @Query("from") PlaceQuery from,
//             @Query("to") PlaceQuery to,
//             @Query("mode") String mode,
//             @Query("alternative") boolean alternative,
//             @Query("via") PlaceQuery via,
//             @Query("arriveBy") boolean arriveBy,
//             @Query("time") String time,
//             @Query("travelMode") TravelModeQuery travelMode,
//             @Query("dir") String dir,
//             @Query("paginateRef") String paginateRef,
//             Callback<Plan> callback);
// 
//     @GET("/v1/planner/intermediate/")
//     void getIntermediateStops(
//             @Query("reference") List<String> reference,
//             Callback<IntermediateResponse> callback);
// 
//     @GET("/v1/semistatic/site/near/")
//     void getNearbyStops(
//             @Query("latitude") double latitude,
//             @Query("longitude") double longitude,
//             Callback<NearbyStopsResponse> callback);
// }


import com.markupartist.sthlmtraveling.AppConfig;
import com.markupartist.sthlmtraveling.BuildConfig;
import com.markupartist.sthlmtraveling.data.api.ApiService;
import com.squareup.okhttp.OkHttpClient;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.OkClient;
import retrofit.converter.GsonConverter;
/*
 * Copyright (C) 2009-2015 Johan Nilsson <http://markupartist.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.markupartist.sthlmtraveling.data.misc;



/**
 *
 */
public class ApiServiceProvider {
    public static RestAdapter getRestAdapter(OkHttpClient client) {
        RequestInterceptor requestInterceptor = new RequestInterceptor() {
            @Override
            public void intercept(RequestFacade request) {
                request.addHeader("User-Agent", AppConfig.USER_AGENT);
                request.addHeader("X-STHLMTraveling-API-Key", AppConfig.STHLM_TRAVELING_API_KEY);
            }
        };

        return new RestAdapter.Builder()
                .setLogLevel(BuildConfig.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE)
                .setEndpoint(AppConfig.STHLM_TRAVELING_API_ENDPOINT)
                .setConverter(new GsonConverter(GsonProvider.provideGson()))
                .setRequestInterceptor(requestInterceptor)
                .setClient(new OkClient(client))
// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/AppConfig.java
// public class AppConfig {
//     public static final String ANALYTICS_PROPERTY_KEY = BuildConfig.APP_ANALYTICS_PROPERTY_KEY;
//     public static final String APP_VERSION = BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")";
//     public static final String WIDESPACE_SID = BuildConfig.DEBUG ? BuildConfig.APP_WIDESPACE_DEBUG_SID : BuildConfig.APP_WIDESPACE_SID;
//     public static final String STHLM_TRAVELING_API_KEY = BuildConfig.APP_STHLMTRAVELING_API_KEY;
//     public static final String USER_AGENT = "STHLMTraveling-Android/" + BuildConfig.VERSION_NAME;
//     public static final String STHLM_TRAVELING_API_ENDPOINT = "http://api.sthlmtraveling.se/";
//     public static final String ADMOB_ROUTE_DETAILS_AD_UNIT_ID = BuildConfig.ADMOB_ROUTE_DETAILS_AD_UNIT_ID;
//     public static final String[] ADMOB_TEST_DEVICES = TextUtils.split(BuildConfig.ADMOB_TEST_DEVICES, ",");
// 
//     public static boolean shouldServeAds() {
//         return BuildConfig.APP_IS_ADS_ENABLED;
//     }
// }
// 
// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/data/api/ApiService.java
// public interface ApiService {
//     @GET("/v1/planner/")
//     void getPlan(
//             @Query("from") PlaceQuery from,
//             @Query("to") PlaceQuery to,
//             @Query("mode") String mode,
//             @Query("alternative") boolean alternative,
//             @Query("via") PlaceQuery via,
//             @Query("arriveBy") boolean arriveBy,
//             @Query("time") String time,
//             @Query("travelMode") TravelModeQuery travelMode,
//             @Query("dir") String dir,
//             @Query("paginateRef") String paginateRef,
//             Callback<Plan> callback);
// 
//     @GET("/v1/planner/intermediate/")
//     void getIntermediateStops(
//             @Query("reference") List<String> reference,
//             Callback<IntermediateResponse> callback);
// 
//     @GET("/v1/semistatic/site/near/")
//     void getNearbyStops(
//             @Query("latitude") double latitude,
//             @Query("longitude") double longitude,
//             Callback<NearbyStopsResponse> callback);
// }


// Path: sthlmtraveling/src/main/java/com/markupartist/sthlmtraveling/data/misc/ApiServiceProvider.java
import com.markupartist.sthlmtraveling.AppConfig;
import com.markupartist.sthlmtraveling.BuildConfig;
import com.markupartist.sthlmtraveling.data.api.ApiService;
import com.squareup.okhttp.OkHttpClient;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.OkClient;
import retrofit.converter.GsonConverter;

/*
 * Copyright (C) 2009-2015 Johan Nilsson <http://markupartist.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.markupartist.sthlmtraveling.data.misc;



/**
 *
 */
public class ApiServiceProvider {
    public static RestAdapter getRestAdapter(OkHttpClient client) {
        RequestInterceptor requestInterceptor = new RequestInterceptor() {
            @Override
            public void intercept(RequestFacade request) {
                request.addHeader("User-Agent", AppConfig.USER_AGENT);
                request.addHeader("X-STHLMTraveling-API-Key", AppConfig.STHLM_TRAVELING_API_KEY);
            }
        };

        return new RestAdapter.Builder()
                .setLogLevel(BuildConfig.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE)
                .setEndpoint(AppConfig.STHLM_TRAVELING_API_ENDPOINT)
                .setConverter(new GsonConverter(GsonProvider.provideGson()))
                .setRequestInterceptor(requestInterceptor)
                .setClient(new OkClient(client))
                .build();