Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ master ]
pull_request:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [ 8, 9, 10, 11, 12 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ repositories {
dependencies {
compile group: 'org.json', name: 'json', version:'20190722'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.30'
compile group: 'commons-codec', name: 'commons-codec', version:'1.10'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
testCompile group: 'junit', name: 'junit', version:'4.13'
testCompile group: 'org.slf4j', name: 'slf4j-simple', version:'1.7.30'
testCompile group: 'org.mockito', name: 'mockito-core', version:'2.28.2'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = 5.1.0
description = HelloSign Java SDK

sourceCompatibility = 11
targetCompatibility = 11
targetCompatibility = 1.8
4 changes: 2 additions & 2 deletions src/main/java/com/hellosign/sdk/http/Authentication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.hellosign.sdk.HelloSignException;
import java.net.HttpURLConnection;
import java.util.Base64;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -134,7 +134,7 @@ public void authenticate(HttpURLConnection httpConn, String url) {
} else if (hasApiKey()) {
logger.debug("Using API Key to authenticate");
String apiKey = getApiKey() + ":";
authorization = "Basic " + Base64.getEncoder().encodeToString(apiKey.getBytes()).trim();
authorization = "Basic " + Base64.encodeBase64String(apiKey.getBytes()).trim();

}
if (authorization != null) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/hellosign/sdk/http/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
Expand Down Expand Up @@ -194,7 +195,7 @@ public File asFile(String fileName) throws HelloSignException {
private File createTemporaryFile(String filename) throws HelloSignException {
String prefix = filename.substring(0, filename.indexOf("."));
String postfix = filename.substring(filename.indexOf(".") + 1);
if (prefix.isBlank() || postfix.isBlank()) {
if (StringUtils.isBlank(prefix) || StringUtils.isBlank(postfix)) {
throw new HelloSignException("Invalid file name: " + prefix + "." + postfix);
}
File f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ protected <T> List<T> getList(Class<T> clazz, String key) {
* @param obj Provide Object needs to be type casted.
* @param key Key for Object.
* @param <T> Object
* @return
*/
protected <T> Object getObject(Class<T> Class, Object obj, String key){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,20 @@ public BulkSendJobById(JSONObject json) throws HelloSignException{

/**
* Get bulk_send_job Object.
* @return
* @throws Exception
*/
public BulkSendJobs getBulkSendJob() throws Exception{
public BulkSendJobs getBulkSendJob() throws Exception {
return (BulkSendJobs) getObject(BulkSendJobs.class, dataObj.get(BULKSENDJOB), BULKSENDJOB);
}

/**
* Get list_info Object.
* @return
*/
public Object getListInfo() {
return getJSONObject().get(LIST_INFO);
}

/**
* Get List of signature_requests.
* @return
*/
public List<SignatureRequest> getSignatureRequests(){
return getList(SignatureRequest.class, SIGNATURE_REQUESTS);
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/hellosign/sdk/resource/BulkSendJobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,27 @@ public BulkSendJobs(JSONObject jsonObject)throws HelloSignException{

/**
* Get Bulk send job id.
* @return
*/
public String getBulkSendJobId() {
return getString(BULKSENDJOB_ID);
}

/**
* Get Bulk send job total.
* @return
*/
public String getBulkSendJobTotal() {
return getString(BULKSENDJOB_TOTAL);
}

/**
* Get Bulk send job is Creator.
* @return
*/
public Boolean getBulkSendJobIsCreator() {
return getBoolean(BULKSENDJOB_ISCREATOR);
}

/**
* Get Bulk send job created at.
* @return
*/
public Date getBulkSendJobCreatedAt() {
return getDate(BULKSENDJOB_CREATEDAT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public List<Attachment> getAttachments() {

/**
* Set List of Attachments to the request.
* @param attachments
*/
public void setAttachments(List<Attachment> attachments) {
this.attachments = attachments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/**
* Represents a HelloSign signature request based on one or more Templates.
Expand Down Expand Up @@ -135,7 +136,7 @@ public void removeSignerByEmail(String email) {
if (email == null) {
return;
}
var signerSet = signers.entrySet();
Set<Entry<String, Signer>> signerSet = signers.entrySet();
for (Entry<String, Signer> entry : signerSet) {
if (email.equalsIgnoreCase(entry.getValue().getEmail())) {
signers.remove(entry.getKey());
Expand Down Expand Up @@ -236,7 +237,7 @@ public Map<String, Serializable> getPostFields() throws HelloSignException {
}
Map<String, Signer> signerz = getSigners();
for (Entry<String, Signer> entry : signerz.entrySet()) {
var role = entry.getKey();
String role = entry.getKey();
Signer s = signerz.get(role);
fields.put(TEMPLATE_SIGNERS + "[" + role + "][" + TEMPLATE_SIGNERS_EMAIL + "]",
s.getEmail());
Expand All @@ -259,7 +260,7 @@ public Map<String, Serializable> getPostFields() throws HelloSignException {
}
Map<String, String> ccz = getCCs();
for (Entry<String, String> entry : ccz.entrySet()) {
var role = entry.getKey();
String role = entry.getKey();
fields.put(TEMPLATE_CCS + "[" + role + "][" + TEMPLATE_CCS_EMAIL + "]",
ccz.get(role));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.hellosign.sdk.resource.support;

import org.apache.commons.lang3.StringUtils;

public class Attachment {
String name;
String instructions;
Expand Down Expand Up @@ -27,14 +29,13 @@ public Attachment(String name, String instructions, int signer_index, boolean is

/**
* Get Instruction for signer.
* @return
*/
public String getInstructions() {
return instructions;
}

public void setInstructions(String instructions) {
if(!instructions.isBlank()){
if(!StringUtils.isBlank(instructions)){
this.instructions = instructions;
}
}
Expand All @@ -47,7 +48,6 @@ public int getSigner() {
* Provide signer_index, in accordance to the order, signer is added.
* Example : first signer : signer_index = 0
* second signer : signer_index = 1
* @param signer_index
*/
public void setSigner_index(int signer_index) {
this.signer_index= signer_index;
Expand All @@ -73,7 +73,7 @@ public String getName() {
}

public void setName(String name) {
if(!name.isBlank()){
if(!StringUtils.isBlank(name)){
this.name = name;
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/test/java/com/hellosign/sdk/HelloSignClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.Arrays;
import org.json.JSONArray;
Expand Down Expand Up @@ -1115,13 +1117,12 @@ public void testRemovingSignersByEmail() throws HelloSignException {
request.setSigner("role", "john@example.com", "John");
request.removeSignerByEmail("john@example.com");
Map<String, Signer> signers = request.getSigners();
var set = signers.entrySet();
Set<Entry<String, Signer>> set = signers.entrySet();
Assert.assertEquals(0, set.size());
}

/**
* Test for Get bulk send job list.
* @throws Exception
*/
@Test
public void testGetBulkSendJobList() throws Exception {
Expand All @@ -1141,7 +1142,6 @@ public void testGetBulkSendJobList() throws Exception {

/**
* Test for Get bulk send job list with Page.
* @throws Exception
*/
@Test
public void testGetBulkSendJobListWithPage() throws Exception {
Expand All @@ -1161,7 +1161,6 @@ public void testGetBulkSendJobListWithPage() throws Exception {

/**
* Test for Get bulk send job list with Page and Page size.
* @throws Exception
*/
@Test
public void testGetBulkSendJobListWithPageAndSize() throws Exception {
Expand All @@ -1181,7 +1180,6 @@ public void testGetBulkSendJobListWithPageAndSize() throws Exception {

/**
* Test for Get bulk send job by id.
* @throws Exception
*/
@Test
public void testGetBulkSendJobById() throws Exception {
Expand All @@ -1203,7 +1201,6 @@ public void testGetBulkSendJobById() throws Exception {

/**
* Test to verify Remove your access to a completed signature request.
* @throws Exception
*/
@Test
public void testRemoveSignatureRequestAccess() throws Exception {
Expand Down