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

REST resource API rate limit information #1257

Merged
merged 9 commits into from
Jan 9, 2024

Conversation

lizkenyon
Copy link
Contributor

@lizkenyon lizkenyon commented Dec 15, 2023

When using the REST resources there is currently no way to access the rate limit information

Description

Fixes #1218

Please, include a summary of what the PR is for:
Commit for adding resources

  • This PR adds two nilable variables to the resources
  • api_call_limit which is a hash with the header information from X-Shopify-Shop-Api-Call-Limit
  • retry_request_after which is the header information from Retry-After

Commit for fixing flacky test

With this PR we uncovered several flaky tests, because to of the way they were updating context. We went with the easiest solution for now and set the context back to original after the test completes.

Commit for regenerating REST resources

Because some tests in the test suite use real resources instead of FakeResource we need to regenerate the REST resources to have the new variables for them to pass.

Commit for Docs

  • There are some failing test right now due to core changes. I am working with the internal teams to get those updated.

How has this been tested?

Please, describe the tests that you ran to verify your changes.

Checklist:

  • My commit message follow the pattern described in here
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the project documentation.
  • I have added a changelog line.

When using rest resources there was no way to access the rate limit info

This was because we do not allow direct access to the headers

Add relevant rate limit info to rest resource as instance vars
@lizkenyon lizkenyon force-pushed the liz/rest-resource-rate-limit branch 2 times, most recently from 29a764c to a76ad14 Compare December 18, 2023 20:48
@lizkenyon lizkenyon marked this pull request as ready for review December 19, 2023 16:12
@lizkenyon lizkenyon requested a review from a team as a code owner December 19, 2023 16:12
@lizkenyon lizkenyon changed the title [WIP] REST resource API rate limit information REST resource API rate limit information Dec 19, 2023
@@ -6,20 +6,22 @@
########################################################################################################################

module ShopifyAPI
class GiftCardAdjustment < ShopifyAPI::Rest::Base
class Giftcardadjustment < ShopifyAPI::Rest::Base
Copy link
Contributor Author

@lizkenyon lizkenyon Dec 19, 2023

Choose a reason for hiding this comment

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

I wonder if this change was intentional?

Copy link
Contributor

@nelsonwittwer nelsonwittwer left a comment

Choose a reason for hiding this comment

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

Thanks for improving the CI and REST resources, Liz!

@lizkenyon lizkenyon merged commit 6ef42c0 into main Jan 9, 2024
7 checks passed
@lizkenyon lizkenyon deleted the liz/rest-resource-rate-limit branch January 9, 2024 15:17
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.

ShopifyAPI.credit_left alternative as it's not working
2 participants