All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codota.service.client.requests.SaveToBoxRequest Maven / Gradle / Ivy

There is a newer version: 1.0.11
Show newest version
package com.codota.service.client.requests;


import com.codota.service.client.requests.base.PostRequest;
import com.codota.service.connector.ServiceConnector;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

/**
 * Created by yahave on 21/12/2016.
 */
public class SaveToBoxRequest extends PostRequest {

    private static final String BOX_SAVE_SNIPPET_ROUTE = "/user-snippet";

    public SaveToBoxRequest(ServiceConnector connector, String token) {
        super(connector, connector.getBase() + BOX_SAVE_SNIPPET_ROUTE, token);
    }

    @Override
    public String parse(String response) {
        JsonParser parser = new JsonParser();
        JsonElement root = parser.parse(response);
        JsonObject obj = root.getAsJsonObject();
        JsonElement idElem = obj.get("id");
        return idElem.getAsString();

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy