Skip to content

Commit 1a59a84

Browse files
committed
rename rest client from CryptomktRestClient to CryptomarketRestClient, same with implementation
1 parent 0eb1acb commit 1a59a84

File tree

9 files changed

+20
-23
lines changed

9 files changed

+20
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ add the Maven dependency
2626
// instance a client
2727
String api_key = "AB32B3201";
2828
String api_secret= "21b12401";
29-
CryptomktRestClient client = new CryptomktRestClientImpl(api_key, api_secret);
29+
CryptomarketRestClient client = new CryptomarketRestClientImpl(api_key, api_secret);
3030

3131
// get all currencies
3232
List<Currency> currencies = client.getCurrencies(null);
@@ -208,7 +208,7 @@ try {
208208
```java
209209

210210
// rest exceptions
211-
CryptomktRestClient client = new CryptomktRestClientImpl(api_key, api_secret);
211+
CryptomarketRestClient client = new CryptomarketRestClientImpl(api_key, api_secret);
212212

213213
// all rest client methods can throw a CryptomarketApiException
214214
try {

src/main/java/com/cryptomarket/sdk/CryptomktRestClient.java renamed to src/main/java/com/cryptomarket/sdk/CryptomarketRestClient.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/**
3333
* Client
3434
*/
35-
public interface CryptomktRestClient {
35+
public interface CryptomarketRestClient {
3636

3737
/**
3838
* Get a list of all currencies or specified currencies.
@@ -403,17 +403,16 @@ public Order createOrder(
403403
public Order createOrder(OrderRequest orderRequest) throws CryptomarketSDKException;
404404

405405
/**
406-
* Cancel all active orders, or all active orders for a specified symbol.
406+
* Cancel all active orders.
407407
* <p>
408408
* Requires authentication
409409
* <p>
410410
* https://api.exchange.cryptomkt.com/#cancel-orders
411411
*
412-
* @param symbol Optional. If given, cancels all orders of the symbol. If not given, cancels all orders of all symbols
413412
* @return All the canceled orders
414413
* @throws CryptomarketSDKException
415414
*/
416-
public List<Order> cancelAllOrders(@Nullable String symbol) throws CryptomarketSDKException;
415+
public List<Order> cancelAllOrders() throws CryptomarketSDKException;
417416

418417
/**
419418
* Cancel the order with clientOrderId.

src/main/java/com/cryptomarket/sdk/CryptomktRestClientImpl.java renamed to src/main/java/com/cryptomarket/sdk/CryptomarketRestClientImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
import com.cryptomarket.sdk.models.Trade;
3131
import com.cryptomarket.sdk.models.Transaction;
3232

33-
public class CryptomktRestClientImpl implements CryptomktRestClient {
33+
public class CryptomarketRestClientImpl implements CryptomarketRestClient {
3434
HttpClient httpClient;
3535
Adapter adapter = new Adapter();
3636

37-
public CryptomktRestClientImpl(String apiKey, String apiSecret) {
37+
public CryptomarketRestClientImpl(String apiKey, String apiSecret) {
3838
// httpClient = new HttpClientImpl(apiKey, apiSecret);
3939
// httpClient = new HttpClientApacheWithBasic(apiKey, apiSecret);
4040
httpClient = new HttpClientImpl(apiKey, apiSecret);
4141
}
4242

43-
public CryptomktRestClientImpl() {
43+
public CryptomarketRestClientImpl() {
4444
this("","");
4545
}
4646

@@ -314,9 +314,8 @@ public Order createOrder(OrderRequest orderRequest) throws CryptomarketSDKExcept
314314
}
315315

316316
@Override
317-
public List<Order> cancelAllOrders(String symbol) throws CryptomarketSDKException {
317+
public List<Order> cancelAllOrders() throws CryptomarketSDKException {
318318
Map<String, String> params = new HashMap<String, String>();
319-
if (symbol != null) params.put("symbol", symbol);
320319
String jsonResponse = httpClient.delete("order", params);
321320
return adapter.listFromJson(jsonResponse, Order.class);
322321
}

src/test/java/com/cryptomarket/sdk/AppTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class AppTest
1111
extends TestCase
1212
{
13-
CryptomktRestClient client = new CryptomktRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
13+
CryptomarketRestClient client = new CryptomarketRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
1414
/**
1515
* Create the test case
1616
*

src/test/java/com/cryptomarket/sdk/TestRestClientAccountManagement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.junit.Test;
1414

1515
public class TestRestClientAccountManagement {
16-
CryptomktRestClient client = new CryptomktRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
16+
CryptomarketRestClient client = new CryptomarketRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
1717

1818
@Test
1919
public void testGetAccountBalance() {

src/test/java/com/cryptomarket/sdk/TestRestClientPublic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.junit.Test;
2323

2424
public class TestRestClientPublic {
25-
CryptomktRestClient client = new CryptomktRestClientImpl();
25+
CryptomarketRestClient client = new CryptomarketRestClientImpl();
2626

2727

2828
@Test

src/test/java/com/cryptomarket/sdk/TestRestClientTrading.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.junit.Test;
1717

1818
public class TestRestClientTrading {
19-
CryptomktRestClient client = new CryptomktRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
19+
CryptomarketRestClient client = new CryptomarketRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
2020

2121

2222
@Test
@@ -44,7 +44,7 @@ public void testGetActiveOrders() {
4444
@Test
4545
public void testCancelAllOrders() {
4646
try {
47-
List<Order> orders = client.cancelAllOrders(null);
47+
List<Order> orders = client.cancelAllOrders();
4848
orders.forEach(Checker.checkOrder);
4949
} catch (CryptomarketSDKException e) {
5050
e.printStackTrace();
@@ -55,7 +55,7 @@ public void testCancelAllOrders() {
5555
@Test
5656
public void testCancelOrdersOfSymbol() {
5757
try {
58-
client.cancelAllOrders(null);
58+
client.cancelAllOrders();
5959
client.createOrder(new OrderRequest.Builder()
6060
.symbol("EOSBTC")
6161
.side(Side.SELL)
@@ -72,10 +72,9 @@ public void testCancelOrdersOfSymbol() {
7272
.price("1000")
7373
.build()
7474
);
75-
List<Order> orders = client.cancelAllOrders("EOSBTC");
75+
List<Order> orders = client.cancelAllOrders();
7676
System.out.println(orders.size());
77-
assertTrue(orders.size() == 1);
78-
client.cancelAllOrders(null);
77+
assertTrue(orders.size() == 2);
7978

8079
orders.forEach(Checker.checkOrder);
8180
} catch (CryptomarketSDKException e) {

src/test/java/com/cryptomarket/sdk/TestRestClientTradingHistory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.junit.Test;
1313

1414
public class TestRestClientTradingHistory {
15-
CryptomktRestClient client = new CryptomktRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
15+
CryptomarketRestClient client = new CryptomarketRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
1616

1717
@Test
1818
public void testGetOrderHistoryAndGetOrders() {

src/test/java/com/cryptomarket/sdk/TestWSAccountClientSubs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
public class TestWSAccountClientSubs {
1818
CryptomarketWSAccountClient wsClient;
19-
CryptomktRestClient restClient;
19+
CryptomarketRestClient restClient;
2020
Boolean authenticated = false;
2121
Callback<Boolean> resultCallback = new Callback<Boolean>() {
2222
@Override
@@ -35,7 +35,7 @@ public void before() {
3535
try {
3636
wsClient = new CryptomarketWSAccountClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
3737
wsClient.connect();
38-
restClient = new CryptomktRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
38+
restClient = new CryptomarketRestClientImpl(KeyLoader.getApiKey(), KeyLoader.getApiSecret());
3939
try {TimeUnit.SECONDS.sleep(3);} catch (InterruptedException e) {fail();}
4040
} catch (Exception e) {
4141
e.printStackTrace();

0 commit comments

Comments
 (0)