Skip to content

Commit bdcac18

Browse files
committed
chore: remove deprecated functions
1 parent f3f9d17 commit bdcac18

7 files changed

Lines changed: 7 additions & 191 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
- Removed the unused `Error` model
99
- Added an explicit `AddressVerificationFieldError` model
1010
- The `BetaPaymentRefund` now uses a list of `FieldError` instead of `Error` for the `errors` field
11+
- Removes deprecated functions
12+
- `TimeInTransit.getSmartRateAccuracy` (use `TimeInTransit.getSmartrateAccuracy` instead)
13+
- `paymentMethod.all` (use `billing.retrievePaymentMethods` instead)
14+
- `shipment.getSmartrates` (use `shipment.smartrates` instead)
15+
- String overload for `shipment.lowestSmartRate`, 3rd param requires a valid `SmartrateAccuracy`
16+
- `user.apiKeys` (use `apiKey.retrieveApiKeysForUser` instead)
17+
- `utilities.getLowestSmartRate` (use `utilities.findLowestSmartrate` instead)
1118
- Corrects payload wrapping for updating a webhook
1219
- Bumps dependencies
1320

src/main/java/com/easypost/model/TimeInTransit.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,6 @@ public final class TimeInTransit {
2424
@SerializedName("percentile_99")
2525
private Integer percentile99;
2626

27-
/**
28-
* Get the delivery accuracy of a specific percentile of this TimeInTransit.
29-
*
30-
* @param percentile the percentile to find the corresponding accuracy for
31-
* @return the delivery accuracy of the specified percentile
32-
* @throws EasyPostException when the percentile is not valid
33-
* @deprecated Use {@link #getBySmartrateAccuracy(SmartrateAccuracy)} instead.
34-
* Deprecated: v5.5.0 - v7.0.0
35-
*/
36-
@Deprecated
37-
public int getSmartRateAccuracy(final String percentile) throws EasyPostException {
38-
switch (percentile) {
39-
case "percentile_50":
40-
return this.percentile50;
41-
case "percentile_75":
42-
return this.percentile75;
43-
case "percentile_85":
44-
return this.percentile85;
45-
case "percentile_90":
46-
return this.percentile90;
47-
case "percentile_95":
48-
return this.percentile95;
49-
case "percentile_97":
50-
return this.percentile97;
51-
case "percentile_99":
52-
return this.percentile99;
53-
default:
54-
throw new InvalidParameterError("percentile");
55-
}
56-
}
57-
5827
/**
5928
* Get the delivery accuracy of a specific percentile of this TimeInTransit.
6029
*

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,4 @@ public class PaymentMethodService {
1818
PaymentMethodService(EasyPostClient client) {
1919
this.client = client;
2020
}
21-
22-
/**
23-
* List all payment methods.
24-
*
25-
* @return Billing object.
26-
* @throws EasyPostException when the request fails.
27-
* @deprecated Use {@link com.easypost.service.BillingService#retrievePaymentMethods()} instead.
28-
* Deprecated: v5.5.0 - v7.0.0
29-
*/
30-
@Deprecated
31-
public PaymentMethod all() throws EasyPostException {
32-
String endpoint = "payment_methods";
33-
34-
PaymentMethod response =
35-
Requestor.request(RequestMethod.GET, endpoint, null, PaymentMethod.class, client);
36-
37-
if (response.getId() == null) {
38-
throw new InvalidObjectError(Constants.ErrorMessages.NO_PAYMENT_METHODS);
39-
}
40-
41-
return response;
42-
}
4321
}

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

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,6 @@ public Shipment newRates(final String id, final Map<String, Object> params) thro
139139
return Requestor.request(RequestMethod.POST, endpoint, params, Shipment.class, client);
140140
}
141141

142-
/**
143-
* Get SmartRates for this Shipment.
144-
*
145-
* @param params The options for the query.
146-
* @param id The ID of shipment.
147-
* @return List of SmartRate objects
148-
* @throws EasyPostException when the request fails.
149-
* @deprecated Use {@link #smartrates(String, Map)} instead.
150-
* Deprecated: v5.5.0 - v7.0.0
151-
*/
152-
@Deprecated
153-
@InlineMe(replacement = "this.smartrates(id, params)")
154-
public final List<SmartRate> getSmartrates(final String id, final Map<String, Object> params)
155-
throws EasyPostException {
156-
return this.smartrates(id, params);
157-
}
158-
159142
/**
160143
* Get SmartRate for this Shipment.
161144
*
@@ -300,28 +283,6 @@ public Shipment insure(final String id, final Map<String, Object> params) throws
300283
return Requestor.request(RequestMethod.POST, endpoint, params, Shipment.class, client);
301284
}
302285

303-
/**
304-
* Get the lowest SmartRate for this Shipment.
305-
*
306-
* @param id The ID of shipment.
307-
* @param deliveryDay Delivery days restriction to use when filtering.
308-
* @param deliveryAccuracy Delivery days accuracy restriction to use when
309-
* filtering.
310-
* @return lowest SmartRate object
311-
* @throws EasyPostException when the request fails.
312-
* @deprecated use {@link #lowestSmartRate(String, int, SmartrateAccuracy)} instead.
313-
* Deprecated: v5.5.0 - v7.0.0
314-
*/
315-
@Deprecated
316-
@InlineMe(
317-
replacement = "this.lowestSmartRate(id, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))",
318-
imports = "com.easypost.model.SmartrateAccuracy"
319-
)
320-
public final SmartRate lowestSmartRate(final String id, int deliveryDay, String deliveryAccuracy)
321-
throws EasyPostException {
322-
return this.lowestSmartRate(id, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy));
323-
}
324-
325286
/**
326287
* Get the lowest SmartRate for this Shipment.
327288
*
@@ -341,43 +302,6 @@ public SmartRate lowestSmartRate(final String id, final int deliveryDay, Smartra
341302
return lowestSmartrate;
342303
}
343304

344-
/**
345-
* Get SmartRates for this Shipment.
346-
*
347-
* @param id The ID of shipment.
348-
* @return List of SmartRate objects
349-
* @throws EasyPostException when the request fails.
350-
* @deprecated Use {@link #smartrates(String, Map)} instead.
351-
* Deprecated: v5.5.0 - v7.0.0
352-
*/
353-
@Deprecated
354-
@InlineMe(replacement = "this.smartrates(id, null)")
355-
public final List<SmartRate> getSmartrates(final String id) throws EasyPostException {
356-
return this.smartrates(id, null);
357-
}
358-
359-
/**
360-
* Get the lowest SmartRate from a list of SmartRates.
361-
*
362-
* @param smartRates List of SmartRates to filter from.
363-
* @param deliveryDay Delivery days restriction to use when filtering.
364-
* @param deliveryAccuracy Delivery days accuracy restriction to use when
365-
* filtering.
366-
* @return lowest SmartRate object
367-
* @throws EasyPostException when the request fails.
368-
* @deprecated Use {@link #findLowestSmartrate(List, int, SmartrateAccuracy)} instead.
369-
* Deprecated: v5.5.0 - v7.0.0
370-
*/
371-
@Deprecated
372-
@InlineMe(replacement =
373-
"this.findLowestSmartrate(smartRates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))",
374-
imports = "com.easypost.model.SmartrateAccuracy"
375-
)
376-
public final SmartRate getLowestSmartRate(final List<SmartRate> smartRates,
377-
int deliveryDay, String deliveryAccuracy) throws EasyPostException {
378-
return findLowestSmartrate(smartRates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy));
379-
}
380-
381305
/**
382306
* Find the lowest SmartRate from a list of SmartRates.
383307
*

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -102,30 +102,6 @@ public void delete(final String id) throws EasyPostException {
102102
Requestor.request(RequestMethod.DELETE, endpoint, null, User.class, client);
103103
}
104104

105-
/**
106-
* Get this User's API keys.
107-
*
108-
* @deprecated Use {@link ApiKeyService#retrieveApiKeysForUser(String)} instead.
109-
* @param id The ID of the user.
110-
* @return List of ApiKey objects.
111-
* @throws EasyPostException when the request fails.
112-
*/
113-
public List<ApiKey> apiKeys(final String id) throws EasyPostException {
114-
ApiKeys parentKeys = client.apiKey.all();
115-
116-
if (Objects.equals(id, parentKeys.getId())) {
117-
return parentKeys.getKeys();
118-
}
119-
120-
for (int i = 0; i < parentKeys.getChildren().size(); i++) {
121-
if (id.equals(parentKeys.getChildren().get(i).getId())) {
122-
return parentKeys.getChildren().get(i).getKeys();
123-
}
124-
}
125-
126-
throw new FilteringError(String.format(Constants.ErrorMessages.NO_OBJECT_FOUND, "API keys"));
127-
}
128-
129105
/**
130106
* Update the user brand.
131107
*

src/main/java/com/easypost/utils/Utilities.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,6 @@ public static Event validateWebhook(byte[] eventBody, Map<String, Object> header
139139
}
140140
}
141141

142-
/**
143-
* Get the lowest Smartrate from a list of Smartrates.
144-
*
145-
* @param smartrates List of Smartrates to filter from.
146-
* @param deliveryDay Delivery days restriction to use when filtering.
147-
* @param deliveryAccuracy Delivery days accuracy restriction to use when
148-
* filtering.
149-
* @return lowest Smartrate object
150-
* @throws EasyPostException when the request fails.
151-
* @deprecated Use {@link #findLowestSmartrate(List, int, SmartrateAccuracy)} instead.
152-
* Deprecated: v5.5.0 - v7.0.0
153-
*/
154-
@Deprecated
155-
@InlineMe(replacement =
156-
"Utilities.findLowestSmartrate(smartrates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))",
157-
imports = {"com.easypost.model.SmartrateAccuracy", "com.easypost.utils.Utilities"})
158-
public static SmartRate getLowestSmartRate(final List<SmartRate> smartrates, int deliveryDay,
159-
String deliveryAccuracy) throws EasyPostException {
160-
return findLowestSmartrate(smartrates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy));
161-
}
162-
163142
/**
164143
* Find the lowest Smartrate from a list of Smartrates.
165144
*

src/test/java/com/easypost/ShipmentTest.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,6 @@ public void testSmartRate() throws EasyPostException {
392392
assertNotNull(smartRate.getTimeInTransit().getPercentile95());
393393
assertNotNull(smartRate.getTimeInTransit().getPercentile97());
394394
assertNotNull(smartRate.getTimeInTransit().getPercentile99());
395-
396-
assertThrows(InvalidParameterError.class,
397-
() -> smartRate.getTimeInTransit().getSmartRateAccuracy("percentile_100"));
398395
}
399396

400397
/**
@@ -536,20 +533,6 @@ public void testInstanceLowestSmartRate() throws EasyPostException {
536533
assertThrows(EasyPostException.class, () -> {
537534
vcr.client.shipment.lowestSmartRate(shipment.getId(), 0, SmartrateAccuracy.Percentile90);
538535
});
539-
540-
SmartRate deprecatedLowestSmartRateFilters = vcr.client.shipment.lowestSmartRate(shipment.getId(), 3,
541-
SmartrateAccuracy.Percentile90);
542-
543-
// Test lowest smartrate with valid filters
544-
assertEquals("GroundAdvantage", deprecatedLowestSmartRateFilters.getService());
545-
assertEquals(5.93, deprecatedLowestSmartRateFilters.getRate(), 0.01);
546-
assertEquals("USPS", deprecatedLowestSmartRateFilters.getCarrier());
547-
548-
// Test lowest smartrate with invalid filters (should error due to strict
549-
// delivery days)
550-
assertThrows(EasyPostException.class, () -> {
551-
vcr.client.shipment.lowestSmartRate(shipment.getId(), 0, SmartrateAccuracy.Percentile90);
552-
});
553536
}
554537

555538
/**

0 commit comments

Comments
 (0)