If you create a new “machine to machine application”, then go to the “quick start” tab under the settings for that app, there is sample code for a variety of languages listed there. The Ruby example includes the following line:
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
Can I suggest that this line be removed, or at least commented out. It disable SSL certificate validation, which enables MITM attacks.