-
Notifications
You must be signed in to change notification settings - Fork 472
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
Create Hashes in Object instances with_indifferent_access #1296
Labels
Comments
Hi @DaveEshopGuide , thank you for creating this issue. We'll look into this and prioritize it accordingly. Given that this is a minor issue, this may take us some time to get to it. |
Hi, I'm looking into making my first contribution. Could I work on this issue? |
hi @elizasorber , please go ahead, we always welcome contributions from the community 🎉 |
elizasorber
added a commit
to elizasorber/shopify-api-ruby
that referenced
this issue
Apr 5, 2024
…ces_from_response in the ShopifyAPI::Rest::Base class.
sle-c
pushed a commit
to elizasorber/shopify-api-ruby
that referenced
this issue
Jul 15, 2024
…ces_from_response in the ShopifyAPI::Rest::Base class.
Closed with #1308 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
Enable indifferent access on all Hashes in Shopify Objects
The proposed change involves modifying the create_instances_from_response method in the ShopifyAPI::Rest::Base class to use with_indifferent_access on the body hash. This change allows for accessing the hash keys as either strings or symbols interchangeably. This feature would be beneficial for the following reasons:
Flexibility: It provides flexibility in accessing hash keys, which can be particularly useful when dealing with JSON responses where keys can be either strings or symbols.
Error Prevention: It can help prevent potential key access errors that might occur due to mismatched key types.
Consistency: It aligns with the Rails convention of indifferent access, providing a more consistent experience for developers
We ran into this upgrading beyond V10 where we had to restructure a lot of Code and Factories in Specs for the Shopify Objects were Producing Hashes with symbol access while the "real" objects come with string keys.
If there is no strong reason against it I would be happy to see indifferent_access on the Shopify objects or at least a config parameter to enable this analog to "response_as_struct"
The text was updated successfully, but these errors were encountered: