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

Convert json_response_body_names to array #1208

Merged
merged 4 commits into from
Sep 5, 2023

Conversation

mllemango
Copy link
Contributor

@mllemango mllemango commented Aug 30, 2023

Description

Fixes #1018
Fixes #1190

Allowing multiple response body names to be passed in so we can check and build a response based on what key matches the for the class

How has this been tested?

Created a fresh app and pre-populated test store and made sure we can create a fulfillment request without sorbet error
Get a response back from CustomerAddress.all

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.

@mllemango mllemango force-pushed the melaniew/custom-json-body-names-to-array branch from af2a839 to 17c1848 Compare August 30, 2023 16:29
session: @session, instance: self
)
response_name = self.class.json_response_body_names & response.body.keys
self.class.create_instance(data: response.body[response_name.first], session: @session, instance: self)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any risk for response.body.keys not containing any of the json_response_body_names?

Copy link
Contributor Author

@mllemango mllemango Aug 31, 2023

Choose a reason for hiding this comment

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

there is, but no riskier than the previous code, sorbet would throw the nil error

Copy link
Contributor

@zzooeeyy zzooeeyy left a comment

Choose a reason for hiding this comment

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

I think this mostly make sense to me!

@mllemango mllemango force-pushed the melaniew/custom-json-body-names-to-array branch from 368b9cb to 37120da Compare September 1, 2023 18:55
@mllemango mllemango force-pushed the melaniew/custom-json-body-names-to-array branch from 37120da to 07de972 Compare September 1, 2023 19:00
@mllemango mllemango merged commit e5ec8b2 into main Sep 5, 2023
@mllemango mllemango deleted the melaniew/custom-json-body-names-to-array branch September 5, 2023 17:39
garethson pushed a commit to garethson/shopify-api-ruby that referenced this pull request Dec 1, 2023
* Convert json_response_body_names to array to allow multiple names

* Fix customer address all not returning repsonse

* Remove failing tests

* Add changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants