Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
58b2f46
test: extra webhook params
Justintime50 Feb 14, 2025
2793395
chore: debug logging on build for CI
Justintime50 Feb 18, 2025
299b5da
chore: add missing compiler arg
Justintime50 Feb 19, 2025
6955ad9
chore: switch java distribution from zulu to temurin
Justintime50 Feb 19, 2025
659867a
chore: remove unsupported java versions from CI
Justintime50 Feb 19, 2025
1146a14
chore: put back deps
Justintime50 Feb 19, 2025
c77aa45
fix: build
Justintime50 Feb 19, 2025
1d24eaf
chore: use builtin cache mechanism
Justintime50 Feb 19, 2025
e125b30
chore: enable debugging
Justintime50 Feb 19, 2025
3da7852
chore: bump all plugins
Justintime50 Feb 19, 2025
1721ca1
chore: add full stack traces
Justintime50 Feb 19, 2025
91d95a7
chore: attempt to simplify build, bump template plugin
Justintime50 Feb 19, 2025
b10ba14
chore: further simplify plugins
Justintime50 Feb 19, 2025
29e1d63
chore: bump dependencies
Justintime50 Feb 19, 2025
6513d00
fix: errorprone arg
Justintime50 Feb 19, 2025
64b1ffd
chore: attempt java 21 vs 23
Justintime50 Feb 19, 2025
99602e4
chore: put back the things
Justintime50 Feb 19, 2025
e44c8da
fix: mockito reference
Justintime50 Feb 19, 2025
2abd2be
fix: downgrade dep checker
Justintime50 Feb 19, 2025
10402f8
test: custom headers params
Justintime50 Feb 20, 2025
1491251
docs: adds missing changelog info
Justintime50 Feb 20, 2025
4f63799
fix: pom missing -
Justintime50 Feb 20, 2025
fa6072a
fix: WebhookCustomHeader does not extend EasyPostResource
Justintime50 Feb 21, 2025
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
42 changes: 9 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "23" # Always use the latest JDK for building
- name: Load Maven dependencies cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-build${{ matrix.javaversion }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
java-version: "21" # Always use the latest stable JDK for building
cache: "maven"
- name: Install dependencies
run: make install
- name: Build Library
Expand All @@ -35,22 +29,16 @@ jobs:
distribution: "zulu"
java-version: ${{ matrix.javaversion }}
- name: Run test with Java ${{ matrix.javaversion }}
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test-ci
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "23" # Always use the latest JDK for building
- name: Load Maven dependencies cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-build-coverage-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
java-version: "21" # Always use the latest stable JDK for building
cache: "maven"
- name: Install dependencies
run: make install
- name: Test coverage
Expand All @@ -77,16 +65,10 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "23" # Always use the latest JDK for building
java-version: "21" # Always use the latest stable JDK for building
cache: "maven"
- name: Install checkstyle and style guide
run: make install-checkstyle
- name: Load Maven dependencies and CVE database cache
uses: actions/cache@v3
with:
path: ~/.m2/repository # The CVE database is included in the Maven repository folder
key: ${{ runner.os }}-maven-security-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Lint
run: make lint
- name: Upload Test results
Expand All @@ -102,14 +84,8 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "23" # Always use the latest JDK for building
- name: Load Maven dependencies cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-build-coverage-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
java-version: "21" # Always use the latest stable JDK for building
cache: "maven"
- name: Install Dependencies
run: make install
- name: Generate Docs
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ on:

jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "22" # Always use the latest JDK
java-version: "21" # Always use the latest stable JDK for building
server-id: "ossrh"
# define environmental variable names
server-username: MAVEN_USERNAME
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## Next Release

- Adds `WebhookCustomHeader` model, allowing `custom_headers` to be passed when creating/updating a webhook
- Corrects payload wrapping for updating a webhook
- Bumps dependencies

## v7.4.4 (2025-01-03)

- Fixes how params are passed to the API when buying a pickup and providing a pickup rate (closes #340)
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ scan:

## test - Test the project
test:
mvn test -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true -Djacoco.skip=true

## test-ci - Test the project on CI (does not rebuild the project)
test-ci:
mvn surefire:test

## update-examples-submodule - Update the examples submodule
update-examples-submodule:
git submodule init
git submodule update --remote

.PHONY: help build clean coverage docs install-checkstyle install-styleguide install lint publish publish-dry release scan scan-strict test update-examples-submodule
.PHONY: help build clean coverage docs install-checkstyle install-styleguide install lint publish publish-dry release scan scan-strict test test-ci update-examples-submodule
2 changes: 1 addition & 1 deletion examples
Submodule examples updated 170 files
37 changes: 21 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,32 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.12.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.32.0</version>
<version>2.36.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>24.0.1</version>
<version>26.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.easypost</groupId>
Expand All @@ -80,7 +82,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -128,7 +130,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<version>0.8.12</version>
<configuration>
<excludes>
<!-- Exclude all the getters in model for code coverage -->
Expand Down Expand Up @@ -173,7 +175,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -191,7 +193,7 @@
<doclint>-html</doclint>
<quiet>true</quiet>
</configuration>
<version>3.5.0</version>
<version>3.11.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -204,7 +206,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.7</version>
<configuration>
<!-- Needed to read passphrase from settings.xml -->
<gpgArguments>
Expand Down Expand Up @@ -233,6 +235,7 @@
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
<arg>--should-stop=ifError=FLOW</arg>
<arg>-Xlint:-options</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
Expand All @@ -249,20 +252,20 @@
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.32.0</version>
<version>2.36.0</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.36</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -273,7 +276,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<version>3.0.0</version>
<executions>
<execution>
<id>filtering-java-templates</id>
Expand All @@ -286,7 +289,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.2</version>
<version>3.6.0</version>
<configuration>
<configLocation>${basedir}/easypost_java_style.xml</configLocation>
<inputEncoding>UTF-8</inputEncoding>
Expand Down Expand Up @@ -315,7 +318,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-java</id>
Expand All @@ -335,6 +338,8 @@
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<!-- Can't upgrade to `v11` or newer versions as it requires Java 11 -->
<!-- TODO: API key now recommended (we must upgrade to v10) to avoid rate limiting: https://github.com/dependency-check/DependencyCheck?tab=readme-ov-file#nvd-api-key-highly-recommended -->
<version>8.4.0</version>
<configuration>
<suppressionFile>dependency-check-suppressions.xml</suppressionFile>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/easypost/model/Webhook.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.easypost.model;

import java.util.Date;

import java.util.List;
import lombok.Getter;

@Getter
public final class Webhook extends EasyPostResource {
private String url;
private Date disabledAt;
private List<WebhookCustomHeader> customHeaders;
}
9 changes: 9 additions & 0 deletions src/main/java/com/easypost/model/WebhookCustomHeader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.easypost.model;

import lombok.Getter;

@Getter
public final class WebhookCustomHeader {
private String name;
private String value;
}
5 changes: 1 addition & 4 deletions src/main/java/com/easypost/service/WebhookService.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,8 @@ public Webhook update(final String id) throws EasyPostException {
* @throws EasyPostException when the request fails.
*/
public Webhook update(final String id, final Map<String, Object> params) throws EasyPostException {
Map<String, Object> wrappedParams = new HashMap<String, Object>();
wrappedParams.put("webhook", params);

String endpoint = "webhooks/" + id;

return Requestor.request(RequestMethod.PUT, endpoint, wrappedParams, Webhook.class, client);
return Requestor.request(RequestMethod.PUT, endpoint, params, Webhook.class, client);
}
}
Loading
Loading