-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
601 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/com/easypost/model/DeliveryDateForZipPairEstimate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.easypost.model; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class DeliveryDateForZipPairEstimate { | ||
private String carrier; | ||
private String service; | ||
private TimeInTransitDetailsForDeliveryDate easypostTimeInTransitData; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/easypost/model/EstimateDeliveryDateForZipPairResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.easypost.model; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class EstimateDeliveryDateForZipPairResult { | ||
private Boolean saturdayDelivery; | ||
private List<DeliveryDateForZipPairEstimate> results; | ||
private List<String> carriersWithoutTintEstimates; | ||
private String desiredDeliveryDate; | ||
private String fromZip; | ||
private String toZip; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/easypost/model/RecommendShipDateForZipPairResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.easypost.model; | ||
|
||
import java.util.List; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class RecommendShipDateForZipPairResult { | ||
private Boolean saturdayDelivery; | ||
private List<ShipDateForZipPairRecommendation> results; | ||
private List<String> carriersWithoutTintEstimates; | ||
private String desiredDeliveryDate; | ||
private String fromZip; | ||
private String toZip; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/easypost/model/ShipDateForZipPairRecommendation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.easypost.model; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ShipDateForZipPairRecommendation { | ||
private String carrier; | ||
private String service; | ||
private TimeInTransitDetailsForDeliveryDate easypostTimeInTransitData; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/easypost/model/TimeInTransitDetailsForDeliveryDate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.easypost.model; | ||
|
||
import java.util.Date; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class TimeInTransitDetailsForDeliveryDate { | ||
private Date shipOnDate; | ||
private Float deliveryDateConfidence; | ||
private int estimatedTransitDays; | ||
private TimeInTransit daysInTransit; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.easypost.service; | ||
|
||
import java.util.Map; | ||
|
||
import com.easypost.exception.EasyPostException; | ||
import com.easypost.http.Requestor; | ||
import com.easypost.http.Requestor.RequestMethod; | ||
import com.easypost.model.EstimateDeliveryDateForZipPairResult; | ||
import com.easypost.model.RecommendShipDateForZipPairResult; | ||
|
||
public class SmartRateService { | ||
private final EasyPostClient client; | ||
|
||
/** | ||
* TrackerService constructor. | ||
* | ||
* @param client The client object. | ||
*/ | ||
SmartRateService(EasyPostClient client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, | ||
* based on a specific desired delivery date. | ||
* | ||
* @param params Parameters to include on the API call. | ||
* @return EstimatedDeliveryDate object. | ||
* @throws EasyPostException When the request fails. | ||
*/ | ||
public RecommendShipDateForZipPairResult recommendShipDate(final Map<String, Object> params) | ||
throws EasyPostException { | ||
String endpoint = "smartrate/deliver_on"; | ||
|
||
return Requestor.request(RequestMethod.POST, endpoint, params, RecommendShipDateForZipPairResult.class, client); | ||
} | ||
|
||
/** | ||
* Retrieve the estimated delivery date of each carrier-service level combination via the | ||
* Smart Deliver By API, based on a specific ship date and origin-destination postal code pair. | ||
* | ||
* @param params Parameters to include on the API call. | ||
* @return EstimatedDeliveryDate object. | ||
* @throws EasyPostException When the request fails. | ||
*/ | ||
public EstimateDeliveryDateForZipPairResult estimateDeliveryDate(final Map<String, Object> params) | ||
throws EasyPostException { | ||
String endpoint = "smartrate/deliver_by"; | ||
|
||
return Requestor.request(RequestMethod.POST, endpoint, params, | ||
EstimateDeliveryDateForZipPairResult.class, client); | ||
} | ||
} |
180 changes: 180 additions & 0 deletions
180
src/test/cassettes/shipment/retrieve_recommend_date.json
Large diffs are not rendered by default.
Oops, something went wrong.
94 changes: 94 additions & 0 deletions
94
src/test/cassettes/smart_rate/retrieve_estimated_delivery_date.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
src/test/cassettes/smart_rate/retrieve_recommend_ship_date.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.