在rails中,我向api发布了帖子并得到了响应,但我不知道如何获取信息并找到“code”变量的值。
$ response
#<Net::HTTPOK 200 OK readbody=true>
$ puts response.body
{"success":true,"button":{"code":"dfhdsg7f23hjgfs7be7","type":"buy_now","style":"none","text":"Send to MeBrah","name":"MeBrah","description":"Coins you're willing to give me.","custom":"6","callback_url":null,"success_url":null,"cancel_url":null,"info_url":null,"auto_redirect":false,"price":{"cents":40000000,"currency_iso":"BTC"},"variable_price":true,"choose_price":false,"include_address":false,"include_email":false}}
$ response.code
"200"
我知道代码变量等于“dfhdsg7f23hjgfs7be7”我只是好奇什么命令会返回它的值。