-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Limit and Offset to Search Orders by tracking Number and Schedu…
…leForDate
- Loading branch information
Showing
6 changed files
with
132 additions
and
8 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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/com/route4me/sdk/examples/orders/GetOrdersByScheduledForYYMMDDLimitOffset.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,35 @@ | ||
// codebeat:disable[SIMILARITY] | ||
package com.route4me.sdk.examples.orders; | ||
|
||
import com.route4me.sdk.exception.APIException; | ||
import com.route4me.sdk.services.orders.Order; | ||
import com.route4me.sdk.services.orders.OrdersManager; | ||
import java.util.Arrays; | ||
|
||
import java.util.List; | ||
|
||
public class GetOrdersByScheduledForYYMMDDLimitOffset { | ||
|
||
public static void main(String[] args) { | ||
String apiKey = "11111111111111111111111111111111"; | ||
OrdersManager manager = new OrdersManager(apiKey); | ||
try { | ||
List<String> scheduledDate = Arrays.asList("2021-09-10", "2021-09-10"); | ||
List<Order> orders = manager.getOrdersByScheduledDate(scheduledDate, 10, 0); | ||
System.out.println("Found " + orders.size() + " Orders"); | ||
for (Order order : orders) { | ||
System.out.println("OrderID: " + order.getId()); | ||
System.out.println("\tCreated: " + order.getCreated()); | ||
System.out.println("\tScheduled: " + order.getDateScheduled()); | ||
System.out.println("\tAddress: " + order.getAddress1()); | ||
System.out.println("\tAlias: " + order.getAddressAlias()); | ||
System.out.println("\tCustom Data: " + order.getCustomData()); | ||
System.out.println(""); | ||
} | ||
} catch (APIException e) { | ||
//handle exception | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
// codebeat:enable[SIMILARITY] |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/route4me/sdk/examples/orders/GetOrdersByTrackingNumberLimitOffset.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,38 @@ | ||
// codebeat:disable[SIMILARITY] | ||
package com.route4me.sdk.examples.orders; | ||
|
||
import com.route4me.sdk.exception.APIException; | ||
import com.route4me.sdk.services.orders.Order; | ||
import com.route4me.sdk.services.orders.OrderStatus; | ||
import com.route4me.sdk.services.orders.OrdersManager; | ||
import java.util.Arrays; | ||
|
||
import java.util.List; | ||
|
||
public class GetOrdersByTrackingNumberLimitOffset { | ||
public static void main(String[] args) { | ||
String apiKey = "11111111111111111111111111111111"; | ||
OrdersManager manager = new OrdersManager(apiKey); | ||
|
||
List<String> trackingNumbers = Arrays.asList("TRACKING01", "TRACKING02", "TRACKING03"); | ||
|
||
try { | ||
List<Order> orders = manager.getOrdersByTrackingNumber(trackingNumbers, 100, 0); | ||
System.out.println("Found " + orders.size() + " Orders"); | ||
for (Order order : orders) { | ||
System.out.println("OrderID: " + order.getId()); | ||
System.out.println("\tStatus: " + OrderStatus.get(order.getLastStatus())); | ||
System.out.println("\tTracking Number: " + order.getTrackingNumber()); | ||
System.out.println("\tCreated: " + order.getCreated()); | ||
System.out.println("\tScheduled: " + order.getDateScheduled()); | ||
System.out.println("\tAddress: " + order.getAddress1()); | ||
System.out.println("\tAlias: " + order.getAddressAlias()); | ||
System.out.println(""); | ||
} | ||
} catch (APIException e) { | ||
//handle exception | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
// codebeat:enable[SIMILARITY] |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/route4me/sdk/examples/routes/UpdateRouteNameDriver.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,37 @@ | ||
package com.route4me.sdk.examples.routes; | ||
|
||
import com.route4me.sdk.exception.APIException; | ||
import com.route4me.sdk.services.routing.Parameters; | ||
import com.route4me.sdk.services.routing.Route; | ||
import com.route4me.sdk.services.routing.RoutingManager; | ||
|
||
|
||
/** | ||
* @author Route4Me | ||
*/ | ||
public class UpdateRouteNameDriver { | ||
|
||
public static void main(String[] args) { | ||
String apiKey = "11111111111111111111111111111111"; | ||
RoutingManager routeManager = new RoutingManager(apiKey); | ||
try { | ||
// Create Route Object and Set the RouteID of the existing Route | ||
Route route = new Route(); | ||
route.setId("11111111111111111111111111111111"); | ||
// Create Parameters Object to Change Driver and Route Name | ||
Parameters params = new Parameters(); | ||
params.setRouteName("Renaming and Assining Driver to an Existing Route"); | ||
params.setMemberId("1"); | ||
// Set the parameters to the Route Object | ||
route.setParameters(params); | ||
// Update the Route | ||
route = routeManager.updateRoute(route); | ||
// Print The Updated Route | ||
System.out.println(route); | ||
} catch (APIException e) { | ||
//handle exceptions | ||
System.err.println(e); | ||
} | ||
|
||
} | ||
} |
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