Skip to content

Commit

Permalink
Add Safe Mode (Optional) in the Constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
bgsrb authored Apr 23, 2017
1 parent 8d5f614 commit 07ba48e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/com/kavenegar/sdk/KavenegarApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,25 @@
public class KavenegarApi {


static final String API_PATH = "https://api.kavenegar.com/v1/%s/%s.json";
static final String API_PATH = "%s://api.kavenegar.com/v1/%s/%s.json";

private String apiKey;
private Boolean safe;

public KavenegarApi(String apiKey) {
this.apiKey = apiKey;
this.safe =Boolean.FALSE;
}

public KavenegarApi(String apiKey ,Boolean safe) {
this.apiKey = apiKey;
this.safe = safe;
}

private String getApiPath(String method) {
return String.format(API_PATH, apiKey, method);
if(this.safe==Boolean.TRUE)
return String.format(API_PATH, "https",apiKey, method);
else
return String.format(API_PATH, "http",apiKey, method);
}

public UrlEncodedFormEntity createParams(Object... params) {
Expand Down Expand Up @@ -485,4 +494,4 @@ public SendResult verifyLookup(String receptor, String token, String template) t



}
}

0 comments on commit 07ba48e

Please sign in to comment.