-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add smartrate endpoints functions (#318)
- Loading branch information
Showing
20 changed files
with
645 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; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/easypost/model/RecommendShipDateForShipmentResult.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,9 @@ | ||
package com.easypost.model; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class RecommendShipDateForShipmentResult { | ||
private TimeInTransitDetailsForShipDateRecommendation easypostTimeInTransitData; | ||
private Rate rate; | ||
} |
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; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/easypost/model/RecommendShipDateResponse.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,9 @@ | ||
package com.easypost.model; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class RecommendShipDateResponse { | ||
private List<RecommendShipDateForShipmentResult> rates; | ||
} |
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 TimeInTransitDetailsForShipDate easypostTimeInTransitData; | ||
} |
10 changes: 10 additions & 0 deletions
10
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,10 @@ | ||
package com.easypost.model; | ||
|
||
import java.util.Date; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class TimeInTransitDetailsForDeliveryDate { | ||
private Date easypostEstimatedDeliveryDate; | ||
private TimeInTransit daysInTransit; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/easypost/model/TimeInTransitDetailsForShipDate.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 TimeInTransitDetailsForShipDate { | ||
private Date shipOnDate; | ||
private Float deliveryDateConfidence; | ||
private int estimatedTransitDays; | ||
private TimeInTransit daysInTransit; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/easypost/model/TimeInTransitDetailsForShipDateRecommendation.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,13 @@ | ||
package com.easypost.model; | ||
|
||
import java.util.Date; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class TimeInTransitDetailsForShipDateRecommendation { | ||
private Date desiredDeliveryDate; | ||
private Float deliveryDateConfidence; | ||
private String estimatedTransitDays; | ||
private String shipOnDate; | ||
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); | ||
} | ||
} |
Oops, something went wrong.