I yield - I've tried for hours to crack this nut but can't figure it out. I'm too new to Ruby (and have no Python background!) to translate this and then post my JSON data to a site that requires user/pass, and then get the response data.
This is the Python code:
r = requests.post('https://keychain.oneid.com/validate/', json.dumps(data), auth=('username', 'password'))
r.json()
where data is:
{"some" => "data", "fun" => "times"}
I'm trying to replicate the functionality of this code in Ruby for use with a Rails application, but between figuring out how the Python requests.post() function operates and then writing the Ruby code for POST and GET, I've become totally lost.
I tried Net::HTTP but I'm not clear if I should be putting the username/pass in the body or use the basic_auth method -- basic_auth seems to only work inside Net::HTTP.get ... and Net::HTTP doesn't seem to easily handle JSON, but again, I could be totally out to lunch at this point.
Any suggestions or help would be greatly appreciated!