package de.fu_berlin.cdv.chasingpictures.api;

import android.content.Context;
import android.location.Location;
import android.support.annotation.NonNull;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

import de.fu_berlin.cdv.chasingpictures.R;
import de.fu_berlin.cdv.chasingpictures.security.Access;

/**
 * @author Simon Kalt
 */
public class LocationRequest extends ApiRequest<PlacesApiResult> {
    @NonNull
    private final Location location;

    public LocationRequest(Context context, @NonNull Location location) {
        super(context, R.string.api_path_location_request);
        this.location = location;
    }

    @Override
    protected ResponseEntity<PlacesApiResult> send() {
        Map<String, Double> queryParameters = new HashMap<>(2);
        queryParameters.put("latitude", location.getLatitude());
        queryParameters.put("longitude", location.getLongitude());

        return restTemplate.exchange(
                apiUri,
                HttpMethod.GET,
                new HttpEntity<>(headers),
                PlacesApiResult.class,
                queryParameters
        );
    }

    RestTemplate getRestTemplate() {
        return restTemplate;
    }
}

@@ -538,16 +538,131 @@
 s;%0A%0A/**%0A
+ * API request to find places near a given location.%0A * TODO: Rename this class to something like PlaceRequest?%0A *%0A
  * @auth
@@ -797,16 +797,178 @@
 ation;%0A%0A
+    /**%0A     * Create a new request.%0A     *%0A     * @param context The current context%0A     * @param location The location from which to search for places%0A     */%0A
     publ

Add Javadoc to LocationRequest