Skip to content

Commit db5429e

Browse files
committed
Updating documentation & gradle file
1 parent d33b9dd commit db5429e

File tree

5 files changed

+127
-58
lines changed

5 files changed

+127
-58
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,28 @@ Add this dependency to your project's POM:
2525
Add this dependency to your project's build file:
2626

2727
```groovy
28-
compile "com.blockscore:blockscore-java:4.0.0"
28+
compile 'com.blockscore:blockscore-java:4.0.0'
2929
```
3030

3131
### Others
3232

3333
You can download our JAR files from here: https://github.com/BlockScore/blockscore-java/releases
3434

35+
Or, alternatively, build from source by
36+
1. Cloning this repo
37+
2. `./gradlew :build`
38+
3. `./gradlew :jar` (Builds the standard JAR) or `./gradlew :fatJar` (Builds the plug and play jar)
39+
3540
## Usage
3641

3742
```java
43+
import com.blockscore.models.Address;
44+
import com.blockscore.models.Person;
45+
import com.blockscore.net.BlockscoreApiClient;
46+
47+
import java.text.SimpleDateFormat;
48+
import java.util.Date;
49+
3850
BlockscoreApiClient client = new BlockscoreApiClient("your api key here");
3951

4052
Address address = new Address();
@@ -59,11 +71,3 @@ builder.setFirstName("John")
5971

6072
Person person = builder.create();
6173
```
62-
63-
## Generating Javadocs
64-
65-
Enter `./gradlew docs` and a new copy of the Javadocs can be found in `build/docs/javadoc`.
66-
67-
## Testing
68-
69-
You must have gradle installed. Tests can be run by typing `./gradlew :test`.

build.gradle

Lines changed: 93 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,46 @@
11
buildscript {
2-
repositories {
3-
jcenter()
4-
}
2+
repositories {
3+
jcenter()
4+
}
55

6-
dependencies {
7-
classpath 'eu.appsatori:gradle-fatjar-plugin:0.3'
8-
}
6+
dependencies {
7+
classpath 'eu.appsatori:gradle-fatjar-plugin:0.3'
8+
}
99
}
1010

1111
apply plugin: 'java'
1212
apply plugin: 'findbugs'
1313
apply plugin: 'pmd'
1414
apply plugin: 'checkstyle'
1515
apply plugin: 'eu.appsatori.fatjar'
16+
apply plugin: 'maven'
17+
apply plugin: 'signing'
1618

1719
sourceCompatibility = 1.7
1820
targetCompatibility = 1.7
19-
version = '4.0.0'
2021

21-
repositories {
22-
mavenCentral()
23-
}
22+
group = "com.blockscore"
23+
archivesBaseName = "blockscore-java"
24+
version = "4.0.0"
2425

25-
checkstyle {
26-
toolVersion = "6.7"
26+
repositories {
27+
jcenter()
2728
}
2829

2930
dependencies {
30-
compile 'com.squareup.retrofit:retrofit:+'
31-
compile 'com.squareup.retrofit:converter-jackson:+'
32-
compile 'com.squareup.okhttp:okhttp:+'
33-
compile 'com.squareup.okhttp:okhttp-urlconnection:+'
31+
compile 'com.squareup.retrofit:retrofit:1.9.0'
32+
compile 'com.squareup.retrofit:converter-jackson:1.9.0'
33+
compile 'com.squareup.okhttp:okhttp:2.4.0'
34+
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
3435

35-
//Used for static analysis
36-
compile 'com.intellij:annotations:+'
37-
compile 'com.google.code.findbugs:annotations:+'
36+
compile 'com.intellij:annotations:12.0'
37+
compile 'com.google.code.findbugs:annotations:2.0.2'
3838

39-
//Used for testing only.
40-
testCompile 'junit:junit:+'
39+
testCompile 'junit:junit:4.12'
4140
}
4241

43-
task docs(type: Javadoc) {
44-
source = sourceSets.main.allJava
45-
options {
46-
links("http://docs.oracle.com/javase/7/docs/api/");
47-
}
42+
tasks.withType(JavaCompile) {
43+
options.compilerArgs << "-Xlint"
4844
}
4945

5046
jar {
@@ -57,7 +53,6 @@ jar {
5753

5854
test {
5955
testLogging {
60-
// Show that tests are run in the command-line output
6156
events 'started', 'passed'
6257
showStandardStreams true
6358
}
@@ -74,10 +69,76 @@ pmd {
7469
sourceSets = [sourceSets.main]
7570
}
7671

77-
checkstyleTest.exclude '**/src/test/**'
72+
checkstyle {
73+
toolVersion = "6.7"
74+
sourceSets = [ sourceSets.main ]
75+
}
76+
77+
task javadocJar(type: Jar) {
78+
classifier = 'javadoc'
79+
from javadoc
80+
}
7881

82+
task sourcesJar(type: Jar) {
83+
classifier = 'sources'
84+
from sourceSets.main.allSource
85+
}
7986

80-
// Use java's linting facilities
81-
tasks.withType(JavaCompile) {
82-
options.compilerArgs << "-Xlint"
83-
}
87+
artifacts {
88+
archives javadocJar, sourcesJar
89+
}
90+
91+
uploadArchives {
92+
repositories {
93+
mavenDeployer {
94+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
95+
96+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
97+
authentication(userName: '', password: '')
98+
}
99+
100+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
101+
authentication(userName: '', password: '')
102+
}
103+
104+
pom.project {
105+
name 'Blockscore API'
106+
packaging 'jar'
107+
description 'The Blockscore API wrapper for java.'
108+
url 'http://docs.blockscore.com/v4.0/java/#introduction'
109+
110+
scm {
111+
connection 'scm:git:[email protected]:BlockScore/blockscore-java.git'
112+
developerConnection 'scm:git:[email protected]:BlockScore/blockscore-java.git'
113+
url '[email protected]:BlockScore/blockscore-java.git'
114+
}
115+
116+
licenses {
117+
license {
118+
name 'MIT License'
119+
url 'http://opensource.org/licenses/MIT'
120+
}
121+
}
122+
123+
developers {
124+
developer {
125+
id 'dgollahon'
126+
name 'Daniel Gollahon'
127+
128+
}
129+
130+
developer {
131+
id 'ameier'
132+
name 'Alain Meier'
133+
134+
}
135+
}
136+
}
137+
}
138+
}
139+
}
140+
141+
signing {
142+
required { gradle.taskGraph.hasTask("uploadArchives") }
143+
sign configurations.archives
144+
}

src/main/java/com/blockscore/models/Candidate.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Candidate extends BasicResponse {
3333
@NotNull
3434
@JsonProperty("name_last")
3535
private String lastName;
36-
36+
3737
@Nullable
3838
@JsonProperty("note")
3939
private String note;
@@ -53,11 +53,11 @@ public class Candidate extends BasicResponse {
5353
@NotNull
5454
@JsonProperty("address_street1")
5555
private String addressStreet1;
56-
56+
5757
@Nullable
5858
@JsonProperty("address_street2")
5959
private String addressStreet2;
60-
60+
6161
@NotNull
6262
@JsonProperty("address_city")
6363
private String addressCity;
@@ -69,7 +69,7 @@ public class Candidate extends BasicResponse {
6969
@NotNull
7070
@JsonProperty("address_postal_code")
7171
private String addressPostalCode;
72-
72+
7373
@NotNull
7474
@JsonProperty("address_country_code")
7575
private String addressCountryCode;
@@ -97,7 +97,7 @@ public void delete() {
9797

9898
/**
9999
* Returns a complete revision history of a candidate's edits. This allows you to maintain a full
100-
* audit trail of when and how you update a client's profile over time. The latest revision is
100+
* audit trail of when and how you update a client's profile over time. The latest revision is
101101
* presented at the top of the list, and the original is at the end of the list.
102102
* @return the list of candidates
103103
*/
@@ -217,7 +217,7 @@ public Candidate setNote(@Nullable final String note) {
217217
this.note = note;
218218
return this;
219219
}
220-
220+
221221
/**
222222
* Can be either the last 4 digits of the US Social Security Number or the whole SSN.
223223
*
@@ -357,7 +357,7 @@ public Date getDateOfBirth() {
357357
public Address getAddress() {
358358
Address addressObject = new Address(addressStreet1,
359359
addressStreet2,
360-
addressCity,
360+
addressCity,
361361
addressSubdivision,
362362
addressPostalCode,
363363
addressCountryCode);
@@ -366,6 +366,8 @@ public Address getAddress() {
366366

367367
/**
368368
* Sets the internal REST api adapter needed to complete Blockscore API requests.
369+
*
370+
* @param restAdapter the REST adapter
369371
*/
370372
public void setAdapter(BlockscoreRestAdapter restAdapter) {
371373
this.restAdapter = restAdapter;
@@ -431,7 +433,7 @@ public Builder setNote(@Nullable final String note) {
431433
candidate.setNote(note);
432434
return this;
433435
}
434-
436+
435437
/**
436438
* Can be either the last 4 digits of the US Social Security Number or the whole SSN.
437439
*

src/main/java/com/blockscore/models/Person.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ public class Person extends BasicResponse {
6060
@NotNull
6161
@JsonProperty("address_street1")
6262
private String addressStreet1;
63-
63+
6464
@Nullable
6565
@JsonProperty("address_street2")
6666
private String addressStreet2;
67-
67+
6868
@NotNull
6969
@JsonProperty("address_city")
7070
private String addressCity;
@@ -76,7 +76,7 @@ public class Person extends BasicResponse {
7676
@NotNull
7777
@JsonProperty("address_postal_code")
7878
private String addressPostalCode;
79-
79+
8080
@NotNull
8181
@JsonProperty("address_country_code")
8282
private String addressCountryCode;
@@ -112,6 +112,8 @@ private Person() {
112112

113113
/**
114114
* Sets the internal REST api adapter needed to complete Blockscore API requests.
115+
*
116+
* @param restAdapter the REST adapter
115117
*/
116118
public void setAdapter(BlockscoreRestAdapter restAdapter) {
117119
this.restAdapter = restAdapter;
@@ -225,7 +227,7 @@ public Date getDateOfBirth() {
225227
public Address getAddress() {
226228
Address addressObject = new Address(addressStreet1,
227229
addressStreet2,
228-
addressCity,
230+
addressCity,
229231
addressSubdivision,
230232
addressPostalCode,
231233
addressCountryCode);
@@ -273,7 +275,7 @@ public boolean isValid() {
273275
}
274276

275277
/**
276-
* Contains a breakdown of how the status (validity) was determined. It will let you diagnose
278+
* Contains a breakdown of how the status (validity) was determined. It will let you diagnose
277279
* problems like address inconsistencies.
278280
*
279281
* @return the details breakdown
@@ -405,7 +407,7 @@ public Builder setAddress(@NotNull final Address address) {
405407
*
406408
* <p>
407409
* If you set the phone number, we will use it as an additional
408-
* 'positive' data point for the consumer. That is, if it is provided, it will help us identify
410+
* 'positive' data point for the consumer. That is, if it is provided, it will help us identify
409411
* them, but if we cannot, they will not be penalized.
410412
*
411413
* @param phoneNumber the phone number for this individual.
@@ -423,7 +425,7 @@ public Builder setPhoneNumber(@Nullable final String phoneNumber) {
423425
* <p>
424426
* Your customers' IP address can be passed to us for storage
425427
* purposes. Soon we will be using this information for anti-fraud and verification purposes.
426-
* With this information we will be able to back-test your verifications when this feature is
428+
* With this information we will be able to back-test your verifications when this feature is
427429
* released.
428430
*
429431
* @param ipAddress the IP address

src/main/java/com/blockscore/net/UserAgentInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.blockscore.net;
22

3-
import com.squareup.okhttp.Interceptor;
43
import com.squareup.okhttp.Interceptor.Chain;
5-
import com.squareup.okhttp.Response;
4+
import com.squareup.okhttp.Interceptor;
65
import com.squareup.okhttp.Request;
6+
import com.squareup.okhttp.Response;
77

88
import java.io.IOException;
99

0 commit comments

Comments
 (0)