diff --git a/build.gradle b/build.gradle index e877a3f..2d5902e 100644 --- a/build.gradle +++ b/build.gradle @@ -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) } + } +} + + diff --git a/src/main/java/CloudScrapeAPI/CloudScrapeClient.java b/src/main/java/CloudScrapeAPI/CloudScrapeClient.java index dfad70e..55efe9d 100644 --- a/src/main/java/CloudScrapeAPI/CloudScrapeClient.java +++ b/src/main/java/CloudScrapeAPI/CloudScrapeClient.java @@ -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; @@ -48,6 +45,7 @@ public CloudScrapeResponse request(String url, String method, String body) throw HttpPost httpPost = null; HttpGet httpGet = null; + HttpDelete httpDelete = null; List
headerList = new ArrayList
(); headerList.add(new BasicHeader("X-CloudScrape-Access", DigestUtils.md5Hex(this.accountId + this.apiKey).toLowerCase())); @@ -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()])); @@ -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); } diff --git a/src/main/java/CloudScrapeAPI/CloudScrapeFileDTO.java b/src/main/java/CloudScrapeAPI/CloudScrapeFileDTO.java index ee7ed50..6fbdf6d 100644 --- a/src/main/java/CloudScrapeAPI/CloudScrapeFileDTO.java +++ b/src/main/java/CloudScrapeAPI/CloudScrapeFileDTO.java @@ -8,7 +8,7 @@ public String getMimeType() { return this.mimeType; } - public void setMimeType(String mimeType) { + private void setMimeType(String mimeType) { this.mimeType = mimeType; } @@ -16,7 +16,7 @@ public String getContents() { return this.contents; } - public void setContents(String contents) { + private void setContents(String contents) { this.contents = contents; } diff --git a/src/main/java/CloudScrapeAPI/CloudScrapeRunDTO.java b/src/main/java/CloudScrapeAPI/CloudScrapeRunDTO.java index b3dc537..3848953 100644 --- a/src/main/java/CloudScrapeAPI/CloudScrapeRunDTO.java +++ b/src/main/java/CloudScrapeAPI/CloudScrapeRunDTO.java @@ -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; - } }