Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gem to support latest solidus version #116

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

JustShah
Copy link

Overview:
This PR addresses various updates and fixes to ensure compatibility with the latest Solidus version and to improve the overall functionality and stability of the project.

These updates were necessary to ensure compatibility with Solidus 4, improve testing infrastructure, and fix known issues related to easypost API, assets, CI/CD, and the gem's interaction with Rails and Solidus.

@JustShah JustShah self-assigned this Feb 27, 2025
@JustShah JustShah force-pushed the fix-gem-to-support-latest-solidus-version branch 6 times, most recently from 620d57a to e42e9e2 Compare February 28, 2025 04:03
The extension will work with latest solidus version and would be conditionally
using the solidus_frontend based on the branch.

Older versions of Rails, and thus older versions of Solidus, are
incompatible with the `sqlite3` gem 1.x. This makes sure we use the
right version for each Rails version.
After this change [solidusio/solidus@16fcb10](solidusio/solidus@16fcb10)

The command `bundle exec rake` started failing with the following error:
```
An error occurred in a `before(:suite)` hook.
Failure/Error: //= link_directory ../javascripts .js

Sprockets::ArgumentError:
  link_directory argument must be a directory
```

- Ensure that the correct directory is specified in the manifest file to avoid the `Sprockets::ArgumentError`.
Enhances the security and maintainability of the SolidusEasypost API key handling and configuration. By removing the hardcoded API key assignment from the initializer, we significantly improve security.
The API key management is now centralized within the Configuration class, which streamlines the process and makes it easier to maintain.
Moreover, this change also fixes issue with the api_key for EasyPost mentioned in
[Issues solidusio-contrib#108](solidusio-contrib#108).

Additionally, this change allows for runtime updates to the API key without the need to modify the initializer,
providing greater flexibility. To ensure consistency across tests, the SolidusEasypost configuration is now set up uniformly and uses factories effectively from the core gems,
which helps maintain reliable and predictable test outcomes.
Updated the integration with EasyPost API to use the SolidusEasypost client for all Tracker API calls. Additionally, adjusted tests to reflect the new EasyPost Tracker API structure and ensure proper functionality.
Use SolidusEasypost Client for Shipment and Rate API calls. Adjusted test cases for shipment and shipping_rates to reflect new structure and restore EasyPost::Shipment and Easypost::Rate API functionality.
Additionally, stub_easypost_shipment and stub_easypost_rate from api_stubs helper holds no relevance due to updates in the API structure. So the file is removed.
Use SolidusEasypost Client to purchase a Shipment in order to populate the tracking_code and postage_label attributes for a specific shipment. The static postage_label_url in the test is adjusted to match the s3 url for the uploaded postage_label png file.
The uploaded easypost_postage_label_url includes the datestamp on which the file is uploaded and filename.
This adjusted test ensures the dynamic behaviour of easypost_postage_label_url generation.
Use SolidusEasypost Client for EasyPost::Address create API.
@JustShah JustShah force-pushed the fix-gem-to-support-latest-solidus-version branch from e42e9e2 to 434b13c Compare February 28, 2025 04:39
Use SolidusEasypost Client for EasyPost::Parcel APIs. The test for parcel_dimension is adjusted to reflect new changes.
Additionally total_weight of the Parcel is computed dynamically in the test.
This change adds newly introduced shipping method 'USPS GroundAdvantage'. EasyPost ShippingRate with 'USPS First' and 'USPS ParcelSelect' services are no longer being added with the newest version of EasyPost.
Additionally, estimated rates for 'USPS Express' and 'USPS Priority' have increased to 28.0 and 7.12 respectively.
Updated the .rubocop_todo.yml file to reflect the latest RuboCop version and adjusted exclusions for various cops. Added files with lint changes.
The VCR cassettes are being updated on running the test cases irrespective of the files being modified.
The changes in cassettes are relate to the RubyClient version, api_key, and timestamp in the API request
@JustShah JustShah force-pushed the fix-gem-to-support-latest-solidus-version branch from 434b13c to e6f2d36 Compare February 28, 2025 07:45
@JustShah JustShah marked this pull request as ready for review February 28, 2025 15:04
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.

1 participant