Skip to content
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build and Test
run: mvn clean test post-integration-test
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
tags: [ 'v*' ]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: maven-central-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Deploy to Maven Central
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn deploy -DskipTests=true
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

104 changes: 0 additions & 104 deletions .travis/ipdata-java.crypted.gpg.key

This file was deleted.

6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# ipdata-java-client
![Build Status](https://www.travis-ci.org/yassine/ipdata-java-client.svg?branch=master)
[![Coverage Status](https://sonarcloud.io/api/project_badges/measure?metric=coverage&project=yassine_ipdata-java-client)](https://sonarcloud.io/dashboard/index/yassine_ipdata-java-client)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?metric=alert_status&project=yassine_ipdata-java-client)](https://sonarcloud.io/dashboard/index/yassine_ipdata-java-client)
[![Maintainability](https://sonarcloud.io/api/project_badges/measure?metric=sqale_rating&project=yassine_ipdata-java-client)](https://sonarcloud.io/dashboard/index/yassine_ipdata-java-client)
[![Reliability](https://sonarcloud.io/api/project_badges/measure?metric=reliability_rating&project=yassine_ipdata-java-client)](https://sonarcloud.io/dashboard/index/yassine_ipdata-java-client)
![Build Status](https://github.com/ipdata/java/actions/workflows/ci.yml/badge.svg)


An 100% compliant [ipdata.co](https://ipdata.co) API java client.
Expand Down
22 changes: 5 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,7 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/code-coverage/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.links.homepage>https://github.com/ipdata/java</sonar.links.homepage>
<sonar.links.issue>https://github.com/ipdata/java</sonar.links.issue>
<sonar.links.scm>https://github.com/ipdata/java</sonar.links.scm>
<sonar.organization>yassine-github</sonar.organization>
<sonar.projectKey>yassine_ipdata-java-client</sonar.projectKey>
<sonar.projectName>ipdata-java-client</sonar.projectName>
<sonar.projectVersion>${project.version}</sonar.projectVersion>
<version.build.jacoco>0.8.14</version.build.jacoco>
<version.build.sonar>3.11.0.3922</version.build.sonar>
<version.build.surefire>3.5.5</version.build.surefire>
<version.client.feign>11.10</version.client.feign>
</properties>
Expand All @@ -68,6 +58,7 @@
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>${version.client.feign}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand All @@ -81,13 +72,15 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
Expand Down Expand Up @@ -168,12 +161,7 @@
<argLine>${surefireArgLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${version.build.sonar}</version>
</plugin>
<plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/ipdata/client/model/Blocklist.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.ipdata.client.model;

import lombok.Getter;
import lombok.ToString;

@Getter @ToString
public class Blocklist {
private String name;
private String site;
private String type;
}
3 changes: 0 additions & 3 deletions src/main/java/io/ipdata/client/model/IpdataModel.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package io.ipdata.client.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;

@Setter(AccessLevel.PACKAGE)
@ToString
@Getter
@Accessors(fluent = true)
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/io/ipdata/client/model/Scores.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.ipdata.client.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.ToString;

@Getter @ToString
public class Scores {
@JsonProperty("vpn_score")
private int vpnScore;
@JsonProperty("proxy_score")
private int proxyScore;
@JsonProperty("threat_score")
private int threatScore;
@JsonProperty("trust_score")
private int trustScore;
}
5 changes: 5 additions & 0 deletions src/main/java/io/ipdata/client/model/ThreatModel.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package io.ipdata.client.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import lombok.Getter;
import lombok.ToString;

@Getter @ToString
public class ThreatModel {
@JsonProperty("is_tor")
private boolean tor;
@JsonProperty("is_vpn")
private boolean vpn;
@JsonProperty("is_proxy")
private boolean proxy;
@JsonProperty("is_anonymous")
Expand All @@ -24,4 +27,6 @@ public class ThreatModel {
private boolean icloudRelay;
@JsonProperty("is_datacenter")
private boolean datacenter;
private List<Blocklist> blocklists;
private Scores scores;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.extern.slf4j.Slf4j;

import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

@RequiredArgsConstructor
@Slf4j
Expand All @@ -22,7 +23,7 @@ class ApiKeyRequestInterceptor implements RequestInterceptor {
String version;
try {
version = CharStreams.toString(new InputStreamReader(ApiKeyRequestInterceptor.class
.getResourceAsStream("/io/ipdata/client/VERSION"))).replaceAll("\\n", "");
.getResourceAsStream("/io/ipdata/client/VERSION"), StandardCharsets.UTF_8)).replaceAll("\\n", "");
version = String.format("io.ipdata.client.java.%s", version);
} catch (Exception e) {
log.error(e.getMessage(), e);
Expand Down
Loading