shiftcommerce / flex-ruby-gem

💎 The Ruby library used to integrate with the Shift Platform API
MIT License
2 stars 0 forks source link

Upgrade json_api_client gem #158

Closed adamdullenty closed 6 years ago

adamdullenty commented 6 years ago

Related ticket: #157

This PR upgrades the json_api_client gem from 1.1.1 to 1.5.3 and makes relevant changes to support changes in the gem.

Note that the matalan-rails-site will not be compatible with this version - work needs to be done to bring this up to date (some issues exist with nested line items and out-of-date fixtures)

Deployment

adamdullenty commented 6 years ago

Before this is merged ideally we'd like to see the F/E (https://github.com/shiftcommerce/matalan-rails-site/pull/2820/) and B/E (https://github.com/shiftcommerce/flex-platform/pull/7240) PRs which use this branch passing. These are waiting on various things e.g. https://github.com/shiftcommerce/flex-platform/pull/7015 and Metapack fixes.

adamdullenty commented 6 years ago

Updating the matalan-rails-site to use the latest updates to the gem (it was locked to an older version and I missed this) has uncovered a whole new list of JSON parsing errors in the F/E test suite over the weekend.

I've decided to remove the gzip aspect of this work (this wasn't in the original ticket) and to add a separate ticket for that work. I'm taking this as a reminder not to let extra features sneak into tickets and nipping these things in the bud earlier in the development process.

adamdullenty commented 6 years ago

I was seeing these specs fail:

bundle exec rspec ./spec/integration/tax_code_spec.rb:98 # FlexCommerce::TaxCode Creating a new tax code with invalid attributes should returns error messages
bundle exec rspec ./spec/integration/tax_code_spec.rb:150 # FlexCommerce::TaxCode Updating a tax code with invalid attributes should returns error messages

with the following error

image

This meant that the error details were returned against a key of :base instead of :code:

image

I originally thought this was due to this change in the json_api_client gem: https://github.com/JsonApiClient/json_api_client/pull/277

However it was actually due to the fact we are overriding JsonApiClient::Resource which has had changes applied to it which we were missing. Adding these changes resolves the issue.

adamdullenty commented 6 years ago

Last issue on the list is the F/E specs failing with Not all prefix parameters specified:

image

I'm just looking through what's changed in json_api_client between 1.1.1 and 1.5.3 for anything which could be related to this, although it looks like there's already an unresolved ticket about this issue from 2016...? https://github.com/JsonApiClient/json_api_client/issues/166

Edit: this is why https://github.com/shiftcommerce/flex-ruby-gem/pull/158#discussion_r221173398