Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ dependencies {
compile 'junit:junit:4.12'
compile 'commons-configuration:commons-configuration:1.10'
}

jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}


11 changes: 7 additions & 4 deletions src/main/java/CloudScrapeAPI/CloudScrapeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.*;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
Expand Down Expand Up @@ -48,6 +45,7 @@ public CloudScrapeResponse request(String url, String method, String body) throw

HttpPost httpPost = null;
HttpGet httpGet = null;
HttpDelete httpDelete = null;

List<Header> headerList = new ArrayList<Header>();
headerList.add(new BasicHeader("X-CloudScrape-Access", DigestUtils.md5Hex(this.accountId + this.apiKey).toLowerCase()));
Expand All @@ -61,6 +59,9 @@ public CloudScrapeResponse request(String url, String method, String body) throw
httpPost.setHeaders(headerList.toArray(new Header[headerList.size()]));
StringEntity bodyEntity = new StringEntity(body);
httpPost.setEntity(bodyEntity);
} else if (method.equalsIgnoreCase("DELETE")) {
httpDelete = new HttpDelete(this.endPoint + url);
httpDelete.setHeaders(headerList.toArray(new Header[headerList.size()]));
} else {
httpGet = new HttpGet(this.endPoint + url);
httpGet.setHeaders(headerList.toArray(new Header[headerList.size()]));
Expand All @@ -74,6 +75,8 @@ public CloudScrapeResponse request(String url, String method, String body) throw
{
if (method.equalsIgnoreCase("POST")) {
httpResponse = httpClient.execute(httpPost);
} else if (method.equalsIgnoreCase("DELETE")) {
httpResponse = httpClient.execute(httpDelete);
} else {
httpResponse = httpClient.execute(httpGet);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/CloudScrapeAPI/CloudScrapeFileDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public String getMimeType() {
return this.mimeType;
}

public void setMimeType(String mimeType) {
private void setMimeType(String mimeType) {
this.mimeType = mimeType;
}

public String getContents() {
return this.contents;
}

public void setContents(String contents) {
private void setContents(String contents) {
this.contents = contents;
}

Expand Down
8 changes: 0 additions & 8 deletions src/main/java/CloudScrapeAPI/CloudScrapeRunDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ public String getId() {
return this._id;
}

public void setId(String id) {
this._id = id;
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}
}