Created
February 9, 2015 04:51
-
-
Save moltak/4347e6bd07fc383a09d7 to your computer and use it in GitHub Desktop.
retrofit business logic for google place api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.limo.limo_passenger.rest.google.place.service; | |
import com.limo.limo_passenger.rest.google.place.model.PlaceSearchResponse; | |
import com.limo.limo_passenger.rest.google.place.PlaceApiRetrofitAdapterBuilder; | |
import com.limo.limo_passenger.rest.limo.LMCallback; | |
import com.limo.limo_passenger.rest.limo.LMNetworkBus; | |
import retrofit.RestAdapter; | |
import retrofit.client.Response; | |
import retrofit.http.GET; | |
import retrofit.http.Query; | |
/** | |
* Created by moltak on 2014. 10. 7.. | |
*/ | |
public class NearByPlaceSearch { | |
public static void search(String location, String types, String sensor, String key, | |
String language) { | |
RestAdapter restAdapter = PlaceApiRetrofitAdapterBuilder.getAdapter(); | |
restAdapter.create(Request.class) | |
.search(location, types, key, language, | |
new LMCallback<PlaceSearchResponse>() { | |
@Override | |
public void success(PlaceSearchResponse placeSearchResult, Response response) { | |
LMNetworkBus.getInstance().post(placeSearchResult); | |
} | |
}); | |
} | |
public interface Request { | |
@GET("/nearbysearch/json?sensor=true&rankby=distance") | |
public void search( | |
@Query("location") String location, | |
@Query("types") String types, | |
@Query("key") String key, | |
@Query("language") String language, | |
LMCallback<PlaceSearchResponse> callback); | |
} | |
public interface SyncRequest { | |
@GET("/nearbysearch/json?sensor=true&rankby=distance") | |
public PlaceSearchResponse search( | |
@Query("location") String location, | |
@Query("types") String types, | |
@Query("key") String key, | |
@Query("language") String language); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment