Skip to content

Conversation

@shuaitseng
Copy link
Contributor

@shuaitseng shuaitseng commented Sep 27, 2025

Add routeplan endpoints
update changelogs
update README


Important

Add route plan endpoints to Onfleet PHP wrapper, update documentation, and improve error handling in Methods.php.

  • Endpoints:
    • Add Routeplans resource in Routeplans.php with endpoints for create, get, update, deleteOne, and addTasksToRoutePlan.
    • Update Onfleet.php to include Routeplans resource.
  • Documentation:
    • Update README.md and README.es.md to include Route Plans operations.
  • Code Improvements:
    • Modify replaceWithId() and replaceWithEndpointAndParam() in Methods.php to handle uppercase letters in IDs.
    • Add null coalescing in method() in Methods.php to handle missing error message fields.
  • Tests:
    • Update phone numbers in OnfleetTest.php and Response.php for consistency.

This description was created by Ellipsis for ab6a717. You can customize this summary. It will automatically update as commits are pushed.

@ellipsis-dev
Copy link

ellipsis-dev bot commented Sep 27, 2025

⚠️ This PR modifies application logic but lacks adequate unit test coverage. Please ensure all new logic is tested.

I noticed that this PR adds new routeplan endpoints and functionality in src/resources/Routeplans.php and updates the Onfleet class to support these endpoints, but there don't appear to be corresponding unit tests for this new functionality. The changes to the test files (tests/OnfleetTest.php and tests/Response.php) only involve updating phone numbers in existing tests.

To ensure code quality and prevent regressions, please consider adding unit tests that specifically verify the new routeplan endpoints work as expected.

@ellipsis-dev
Copy link

ellipsis-dev bot commented Sep 27, 2025

PR Summary: Add routeplan endpoints

This pull request enhances the PHP Onfleet SDK by adding support for routeplan endpoints, allowing for more comprehensive integration with Onfleet's route planning functionality.

Key Changes:

  1. New Routeplans Resource:

    • Added src/resources/Routeplans.php implementing the Routeplans class with the following endpoints:
      • create (POST /routePlans)
      • get (GET /tasks/:routePlanId)
      • update (PUT /tasks/:routePlanId)
      • deleteOne (DELETE /tasks/:routePlanId)
      • addTasksToRoutePlan (PUT /routePlans/:routePlanId/tasks)
  2. Core SDK Updates:

    • Modified src/Onfleet.php to initialize the new routeplans resource
    • Enhanced src/Methods.php with improved regex patterns to include uppercase letters
    • Added better error handling with null coalesce defaults for error messages
  3. Test Updates:

    • Updated phone numbers in test files for consistency
    • Modified test assertions to match the new expected values
  4. Documentation:

    • Updated README to include information about the new routeplan endpoints
    • Updated changelogs to reflect the new functionality

These changes expand the SDK's capabilities, allowing PHP developers to more easily integrate with Onfleet's route planning features.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed everything up to edee4d1 in 2 minutes and 2 seconds. Click for details.
  • Reviewed 172 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/Methods.php:171
  • Draft comment:
    Typo in error handling for PermissionError: using '$errorInfo[1]['message]']' is likely incorrect. It should probably be '$errorInfo[1]' since $errorInfo[1] is already set to the error message.
  • Reason this comment was not posted:
    Marked as duplicate.
2. tests/Response.php:7
  • Draft comment:
    Test fixture contains hardcoded API key and encoded API key. Ensure these values are purely dummy data and not production credentials.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_iobIOdARUob5ZmnL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed 3a09649 in 32 minutes and 38 seconds. Click for details.
  • Reviewed 11 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_3ZzIdTIYZS8Bowb8

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed 701e409 in 42 seconds. Click for details.
  • Reviewed 11 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/resources/Routeplans.php:24
  • Draft comment:
    Trailing newline added; this improves consistency and complies with best practices.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_eL9nr8NjirHIDdvq

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@shuaitseng
Copy link
Contributor Author

All tests scenarios complete:

  1. Created a routeplan using $onfleet->routeplans->create()
  2. Updated the routeplan name by using $onfleet->routeplans->update()
  3. Get routeplan by using its id $onfleet->routeplans->get(id)
  4. Get routeplan by using queryParam $onfleet->routeplans->get(queryParam) - did encounter an error and fixed the url path(included in next commit)
  5. Added a task to the routepln by using $onfleet->routeplans->addTasksToRoutePlan(id, obj)
  6. Delete the same routeplan by using $onfleet->routeplans->deleteOne(id)

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed 187741d in 2 minutes and 38 seconds. Click for details.
  • Reviewed 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/resources/Routeplans.php:16
  • Draft comment:
    The GET endpoint's altPath changed from '/routePlanId' to '/routePlans'. Confirm this aligns with the API spec.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The comment is about a change in the diff, but it does not require a code change. It asks the author to confirm their intention, which is discouraged by the review rules. The comment is not actionable and is more of a prompt for the author to double-check their work, which should be avoided. Perhaps the change could be a breaking change or a mistake, and the reviewer is trying to prevent an error. However, unless there is clear evidence that the change is incorrect, the comment should not be kept. If the reviewer had evidence that the new altPath is invalid or causes a bug, a comment would be warranted. However, as written, the comment is speculative and not actionable. The comment should be deleted because it is not actionable and asks the author to confirm their intention, which is against the review rules.
2. src/resources/Routeplans.php:20
  • Draft comment:
    New endpoint 'addTasksToRoutePlan' added with PUT method. Verify that the endpoint URL '/routePlans/:routePlanId/tasks' is correct and ensure proper validation for tasks.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_80VjOC1XKpXQEn32

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed ab6a717 in 1 minute and 3 seconds. Click for details.
  • Reviewed 24 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. README.es.md:88
  • Draft comment:
    New Route Plans row added. Confirm the URL and operations (get, create, update with addTasksToRoutePlan, deleteOne) match API specs and consider if the English entity name fits the Spanish context.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. README.md:96
  • Draft comment:
    Route Plans endpoints row added. Ensure the URL and operations (including use of
    for line breaks) are correct and render properly.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_La3lGBc22wlBL922

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Member

@gonzalogrisafi gonzalogrisafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shuaitseng shuaitseng merged commit c56e5a4 into master Oct 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants