Skip to content

Commit 2af17f0

Browse files
committed
Minor refactoring and renaming
1 parent 542c84a commit 2af17f0

File tree

5 files changed

+14
-34
lines changed

5 files changed

+14
-34
lines changed

pom.xml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
<artifactId>etherscan</artifactId>
88
<version>1.0.0</version>
99

10-
<name>etherscan-api</name>
10+
<name>java-etherscan-api</name>
1111

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<maven.compiler.source>1.8</maven.compiler.source>
1515
<maven.compiler.target>1.8</maven.compiler.target>
16-
<apache.http>4.5.6</apache.http>
1716
</properties>
1817

1918
<dependencies>
@@ -24,12 +23,6 @@
2423
<scope>test</scope>
2524
</dependency>
2625

27-
<dependency>
28-
<groupId>org.apache.httpcomponents</groupId>
29-
<artifactId>httpclient</artifactId>
30-
<version>${apache.http}</version>
31-
</dependency>
32-
3326
<dependency>
3427
<groupId>com.google.code.gson</groupId>
3528
<artifactId>gson</artifactId>
@@ -41,12 +34,6 @@
4134
<artifactId>annotations</artifactId>
4235
<version>13.0</version>
4336
</dependency>
44-
45-
<dependency>
46-
<groupId>com.jsoniter</groupId>
47-
<artifactId>jsoniter</artifactId>
48-
<version>0.9.23</version>
49-
</dependency>
5037
</dependencies>
5138

5239
<build>

src/main/java/io/api/etherscan/executor/impl/HttpExecutor.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import static java.net.HttpURLConnection.HTTP_MOVED_TEMP;
1818

1919
/**
20-
* @author GoodforGod
20+
* Http client implementation
2121
* @see IHttpExecutor
22+
*
23+
* @author GoodforGod
2224
* @since 28.10.2018
2325
*/
2426
public class HttpExecutor implements IHttpExecutor {
@@ -29,7 +31,7 @@ public class HttpExecutor implements IHttpExecutor {
2931
DEFAULT_HEADERS.put("accept-language", "en,ru;q=0.9");
3032
DEFAULT_HEADERS.put("accept-encoding", "gzip, deflate, br");
3133
DEFAULT_HEADERS.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Chrome/68.0.3440.106");
32-
DEFAULT_HEADERS.put("content-Type", "application/x-www-form-urlencoded");
34+
DEFAULT_HEADERS.put("content-type", "application/x-www-form-urlencoded");
3335
}
3436

3537
private final Map<String, String> headers;
@@ -43,6 +45,11 @@ public HttpExecutor(final int timeout) {
4345
this(timeout, DEFAULT_HEADERS);
4446
}
4547

48+
/**
49+
*
50+
* @param timeout custom timeout in millis
51+
* @param headers custom HTTP headers
52+
*/
4653
public HttpExecutor(final int timeout,
4754
final Map<String, String> headers) {
4855
this.timeout = timeout;
@@ -82,7 +89,7 @@ public String post(final String urlAsString, final String dataToPost) {
8289
headers.forEach(connection::setRequestProperty);
8390

8491
final String contentLength = (BasicUtils.isEmpty(dataToPost)) ? "0" : String.valueOf(dataToPost.length());
85-
connection.setRequestProperty("Content-Length", contentLength);
92+
connection.setRequestProperty("content-length", contentLength);
8693

8794
connection.setDoOutput(true);
8895
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());

src/main/java/io/api/etherscan/model/utility/BalanceTO.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ public class BalanceTO {
1111
private String account;
1212
private String balance;
1313

14-
public BalanceTO(String account, String balance) {
15-
this.account = account;
16-
this.balance = balance;
17-
}
18-
1914
public String getAccount() {
2015
return account;
2116
}

src/test/java/io/api/etherscan/account/AccountTxInternalByHashTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.api.etherscan.core.impl.EtherScanApi;
44
import io.api.etherscan.error.InvalidTxHashException;
55
import io.api.etherscan.model.TxInternal;
6+
import io.api.etherscan.util.BasicUtils;
67
import org.junit.Assert;
78
import org.junit.Test;
89

@@ -27,7 +28,8 @@ public void correct() {
2728
assertNotNull(txs.get(0).getFrom());
2829
assertNotNull(txs.get(0).getTimeStamp());
2930
assertNotNull(txs.get(0).getGas());
30-
assertNotNull(txs.get(0).getHash());
31+
assertNotNull(txs.get(0).getValue());
32+
assertTrue(BasicUtils.isEmpty(txs.get(0).getErrCode()));
3133
}
3234

3335
@Test(expected = InvalidTxHashException.class)

src/test/java/io/api/util/BasicUtilTest.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy