Uh oh!
There was an error while loading. Please reload this page.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we missing
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bottom Line Up Front
Super happy to add it to do that and make the requirement explicit, but it works without it because of the below.
I'm aware this PR is already getting quite large - so let me know if you'd like to do this.
How do I know it'll work?
There's existing similar code in signed_request.rb that uses OpenSSL without the need for
require 'openssl'Why does it work?
My understanding is that this is because all recent versions of Ruby's https://ruby-doc.org/stdlib-2.6.1/libdoc/net/http/rdoc/Net/HTTP.html library depend on OpenSSL (search on that page for OpenSSL and you'll see references to OpenSSL specific errors and symbols)
So, by using ruby's net-related code, it loads OpenSSL. The existing codebase explicitly loads
net/https(which then, in turn, loads OpenSSL) in a few places.The most key of these are
lib/messagebird.rbloadinglib/messagebird/client.rb:ruby-rest-api/lib/messagebird.rb
Line 8 in 64bcb3f
That, in turn, then requires net/https:
ruby-rest-api/lib/messagebird/client.rb
Line 4 in 64bcb3f
Verification
As a test I ran
irbwithoutbundle execand tried to access the OpenSSL namespace:I then loaded
net/httpsand it loaded OpenSSLAs I mentioned, OpenSSL is being implicitly loaded at the moment. I'm happy to change that, but am aware that either I need to make this code inconsistent with
signed_request.rb, or I need to make changes there too, or I need to add a require for OpenSSL inlib/messagebird.rbLet me know what you think