Skip to content

Commit cfa346e

Browse files
authored
Merge pull request #353 from EasyPost/luma
feat: adds luma functions
2 parents 5b04689 + b2f2e2f commit cfa346e

File tree

19 files changed

+606
-7
lines changed

19 files changed

+606
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## v8.2.0 (2025-06-18)
4+
5+
- Adds the following functions
6+
- `shipment.createAndBuyLuma`
7+
- `shipment.buyLuma`
8+
- `luma.getPromise`
9+
310
## v8.1.0 (2025-05-29)
411

512
- Adds `reference` to Claims

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Add this to your project's POM:
1616
<dependency>
1717
<groupId>com.easypost</groupId>
1818
<artifactId>easypost-api-client</artifactId>
19-
<version>8.1.0</version>
19+
<version>8.2.0</version>
2020
</dependency>
2121
```
2222

@@ -25,7 +25,7 @@ Add this to your project's POM:
2525
Add this to your project's build file:
2626

2727
```groovy
28-
implementation "com.easypost:easypost-api-client:8.1.0"
28+
implementation "com.easypost:easypost-api-client:8.2.0"
2929
```
3030

3131
**NOTE:** [Google Gson](http://code.google.com/p/google-gson/) is required.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.1.0
1+
8.2.0

examples

Submodule examples updated 1556 files

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.easypost</groupId>
77
<artifactId>easypost-api-client</artifactId>
88

9-
<version>8.1.0</version>
9+
<version>8.2.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>com.easypost:easypost-api-client</name>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.easypost.model;
2+
3+
import lombok.Getter;
4+
5+
@Getter
6+
public final class AiResults {
7+
private String carrier;
8+
private Boolean meetsRulesetRequirements;
9+
private String predictedDeliverByDate;
10+
private Integer predictedDeliverDays;
11+
private String rateId;
12+
private String rateUsd;
13+
private String service;
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.easypost.model;
2+
3+
import java.util.List;
4+
import lombok.Getter;
5+
6+
@Getter
7+
public final class LumaInfo {
8+
private List<AiResults> aiResults;
9+
private Integer matchingRuleIdx;
10+
private String rulesetDescription;
11+
private Rate lumaSelectedRate;
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.easypost.model;
2+
3+
import lombok.Getter;
4+
5+
@Getter
6+
public class LumaPromiseResponse {
7+
private LumaInfo lumaInfo;
8+
}

src/main/java/com/easypost/service/EasyPostClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class EasyPostClient {
3232
public final EndShipperService endShipper;
3333
public final EventService event;
3434
public final InsuranceService insurance;
35+
public final LumaService luma;
3536
public final OrderService order;
3637
public final ParcelService parcel;
3738
public final PaymentMethodService paymentMethod;
@@ -143,6 +144,7 @@ public EasyPostClient(String apiKey, int connectTimeoutMilliseconds, int readTim
143144
this.endShipper = new EndShipperService(this);
144145
this.event = new EventService(this);
145146
this.insurance = new InsuranceService(this);
147+
this.luma = new LumaService(this);
146148
this.order = new OrderService(this);
147149
this.parcel = new ParcelService(this);
148150
this.paymentMethod = new PaymentMethodService(this);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.easypost.service;
2+
3+
import com.easypost.exception.EasyPostException;
4+
import com.easypost.http.Requestor;
5+
import com.easypost.http.Requestor.RequestMethod;
6+
import com.easypost.model.LumaPromiseResponse;
7+
import com.easypost.model.LumaInfo;
8+
9+
import java.util.HashMap;
10+
import java.util.Map;
11+
12+
public class LumaService {
13+
private final EasyPostClient client;
14+
15+
/**
16+
* LumaService constructor.
17+
*
18+
* @param client The client object.
19+
*/
20+
LumaService(EasyPostClient client) {
21+
this.client = client;
22+
}
23+
24+
/**
25+
* Get service recommendations from Luma that meet the criteria of your ruleset.
26+
*
27+
* @param params The map of parameters.
28+
* @return LumaInfo object.
29+
* @throws EasyPostException When the request fails.
30+
*/
31+
public LumaInfo getPromise(final Map<String, Object> params)
32+
throws EasyPostException {
33+
Map<String, Object> wrappedParams = new HashMap<>();
34+
wrappedParams.put("shipment", params);
35+
String endpoint = "luma/promise";
36+
37+
LumaPromiseResponse response = Requestor.request(RequestMethod.POST, endpoint, wrappedParams,
38+
LumaPromiseResponse.class, client);
39+
return response.getLumaInfo();
40+
}
41+
}

0 commit comments

Comments
 (0)