Skip to content

Commit

Permalink
return MPApiResponse on generic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
joelibaceta committed Nov 22, 2018
1 parent 9c68d51 commit 25c2f48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.mercadopago</groupId>
<artifactId>dx-java</artifactId>
<version>1.0.30</version>
<version>1.0.31</version>
<packaging>jar</packaging>

<name>Mercadopago SDK</name>
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/com/mercadopago/MercadoPago.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import com.google.gson.JsonObject;
import com.mercadopago.core.MPApiResponse;
import com.mercadopago.core.MPCredentials;
import com.mercadopago.core.annotations.rest.PayloadType;
import com.mercadopago.exceptions.MPConfException;
Expand Down Expand Up @@ -238,14 +239,22 @@ public static void cleanConfiguration() {
baseUrl = DEFAULT_BASE_URL;
}

public static void Get(String uri) throws MPRestException {
public static MPApiResponse Get(String uri) throws MPRestException {
MPRestClient client = new MPRestClient();
client.executeRequest(HttpMethod.GET, uri, PayloadType.JSON, null, null);
MPApiResponse response = client.executeRequest(HttpMethod.GET, uri, PayloadType.JSON, null, null);
return response;
}

public static void Post(String uri, JsonObject payload) throws MPRestException {
public static MPApiResponse Post(String uri, JsonObject payload) throws MPRestException {
MPRestClient client = new MPRestClient();
client.executeRequest(HttpMethod.POST, uri, PayloadType.JSON, payload, null);
MPApiResponse response = client.executeRequest(HttpMethod.POST, uri, PayloadType.JSON, payload, null);
return response;
}

public static MPApiResponse Put(String uri, JsonObject payload) throws MPRestException {
MPRestClient client = new MPRestClient();
MPApiResponse response = client.executeRequest(HttpMethod.PUT, uri, PayloadType.JSON, payload, null);
return response;
}

}
Expand Down

0 comments on commit 25c2f48

Please sign in to comment.