def parse_token_data(tokens, token_name)
tokens.each do |token|
return token.split("=")[1] if token.index(token_name).present?
end
end
It will be a bit slower since it iterates over every part of the response, but it does ensure the correct pieces are connected instead of relying on the order.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I did a bit of refactoring on the parsing of the response just to avoid relying on the order of the response:
With a new method:
It will be a bit slower since it iterates over every part of the response, but it does ensure the correct pieces are connected instead of relying on the order.