added arguments to 'get_adp_data' and 'send_web_request' to accept custom headers#1
Open
Mirkoffcito wants to merge 1 commit intoheliocola:mainfrom
Open
added arguments to 'get_adp_data' and 'send_web_request' to accept custom headers#1Mirkoffcito wants to merge 1 commit intoheliocola:mainfrom
Mirkoffcito wants to merge 1 commit intoheliocola:mainfrom
Conversation
…ull response instead of json_body only. Also removed 'sslCaPath' from requests
Mirkoffcito
commented
Oct 15, 2022
Comment on lines
+114
to
115
| body = JSON.parse(response.body) rescue {} | ||
| raise ConnectionException, "Connection error: #{data['error']}, #{data['error_description']}" unless data["error"].nil? |
Author
There was a problem hiding this comment.
@heliocola Honestly I'm a little bit bummed that I couldn't come up with something smarter here. This is just weird and has "but what if" written all over it. I'll be thinking about it, I'm sure I can come up with a better error handling (well, I just wanted to re-use what ADP gem had already)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The idea behind this PR is to be able to send custom headers for using asynchronous calls (and allowing us to get 1000 registers at a time) and also to "unmask" masked data.
As ADP documentation states, sensitive data is masked per default in the API, and to receive it unmasked, a header must be sent.
In the same way, this would allow us to make asynchronous requests, by sending the header:
Also, something i find quite necessary and useful, is for the method to return the entire HTTP response, and not just the JSON body. I made changes so anyone can decide whether they just want to get the JSON body or the full response (this becomes necessary for example when making asynchronous calls, because you need to access to the headers, to get the redirection URL).