Added Code Generator For Ruby (Faraday) #374
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
This PR adds automated code generation for Ruby's Faraday library and also tests the generated code.
Related Issues
Checklist
main
branch before making this PRflutter test
) and all tests are passingAdded/updated tests?
Instructions to run the generated code in local computer
ruby
andgem
executable are available.to install
bundle
as a command line tool.4. Inside a directory create one
GemFile
andmain.rb
file.5. Add faraday as mentioned in the Documentation and Faraday Multipart for sending multipart form requests. Add them inside the
GemFile
along with onesource
attribute at the top of theGemFile
. Then runto install the dependencies.
6. Copy the generated code inside
main.rb
file.7. Run
ruby ./main.rb
to run the generated code.Note: For
HEAD 2
test case, the initial response has status code 301 but faraday_middleware gem, which was previously required for following redirections, is deprecated and a curated list has been published under awesome-faraday by the maintainers. The redirection middleware is now bundled as it's own gem faraday-follow-redirects which is an external dependency which I have not included in code generator.I wish to add that after discussing that with maintainers. Integrating redirection following is mentioned in the documentation as
and can be achieved by adding the
faraday.response :follow_redirects
statement above adapter setup.Along with that, we need to add the require statement with the existing require statements so that the respective code is imported.
Thus currently running generated code for
HEAD 2
returns 301 but API Dash returns 405, which can be modified accordingly for both to return 405 and get the desired output of the user. If required, I am willing to add the support for redirection and modify the required code.