I suppose you have to call either response.body or response.object from the result of the "get_balance" execution.
ex:
r = call_get_balance
You need the r.body or r.object, where the body will be as is and object the body as json.
質問
Cheers! I'm using nexmo gem in my Rails project, so, I want to get json with my balance with get_balance
method, but I get:
#<Nexmo::Response:0x007ff0c7214138 @http_response=#<Net::HTTPOK 200 OK readbody=true>, @json=JSON>
but when I trying the same thing with curl
curl -H "Accept: application/json" https://rest.nexmo.com/account/get-balance/\{#######\}/\{#######\}
It gives me exactly what I want:
{"value":0.02}
So, how to handle Nexmo::Response?
解決
I suppose you have to call either response.body or response.object from the result of the "get_balance" execution.
ex:
r = call_get_balance
You need the r.body or r.object, where the body will be as is and object the body as json.