What is the impact of this PR?
This adds a new method and deprecate an existing method. It should not impact existing users, and migration is optional.
How has this been tested?
Setup a new ruby project with the following script
[
<ShopifyAPI::DiscountCode::BatchResult code="SUMMERSALE10OFF1" errors={"code"=>["must be unique. Please try a different code."]} id=nil>,
<ShopifyAPI::DiscountCode::BatchResult code="SUMMER2" errors={"code"=>["must be unique. Please try a different code."]} id=nil>,
<ShopifyAPI::DiscountCode::BatchResult code="SUMMER3" errors={"code"=>["must be unique. Please try a different code."]} id=nil>
]
Checklist:
[ ] My commit message follow the pattern described in here
[x] I have performed a self-review of my own code.
[x] I have added tests that prove my fix is effective or that my feature works.
Description
Follow up on https://github.com/Shopify/shopify-api-ruby/pull/1205
What is the problem it is solving? DiscountCode has duplicated
errors
field which is only returned on batch operation results.What is the context of these changes? Adds new return type using
BatchResult
struct and new method to return the right type for batch result request in https://shopify.dev/docs/api/admin-rest/2024-01/resources/discountcode#get-price-rules-price-rule-id-batch-batch-id-discount-codesWhat is the impact of this PR? This adds a new method and deprecate an existing method. It should not impact existing users, and migration is optional.
How has this been tested?
Setup a new ruby project with the following script
Run it with
This script prints the following result
Checklist: