Skip to content

Commit

Permalink
allow using it as a library without spring framework (change to GdaxE…
Browse files Browse the repository at this point in the history
…xchangeImpl)
  • Loading branch information
onyxcoyote committed Dec 24, 2018
1 parent 9be4f35 commit 958d920
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.coinbase.exchange.api.exchange;

import com.coinbase.exchange.api.config.GdaxConfiguration;
import com.google.gson.Gson;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -49,6 +50,23 @@ public GdaxExchangeImpl(@Value("${gdax.key}") String publicKey,
this.restTemplate = restTemplate;
}

//Constructor that can be used without needing spring library in calling program
public GdaxExchangeImpl(@Value("${gdax.key}") String publicKey,
@Value("${gdax.passphrase}") String passphrase,
@Value("${gdax.api.baseUrl}") String baseUrl,
Signature signature) {

this.publicKey = publicKey;
this.passphrase = passphrase;
this.baseUrl = baseUrl;
this.signature = signature;
if(restTemplate == null)
{
restTemplate = new GdaxConfiguration().restTemplate();
}
this.restTemplate = restTemplate;
}

@Override
public <T> T get(String resourcePath, ParameterizedTypeReference<T> responseType) {
try {
Expand Down

0 comments on commit 958d920

Please sign in to comment.