문제

I'm still new to Ruby and trying to use the HTTParty gem to help me write an API Wrapper. I feed HTTParty::get a URI and it parses JSON data. From a quick glance and the way the returned result behaves, it looks like a Hash, but is it? I can't seem to find information online. Another post on StackOverflow shows to use HTTParty::get(...).parsed_response to get the Hash, but this seems outdated.

도움이 되었습니까?

해결책

Do this in the console:

>require 'httparty'
 => true
> response = HTTParty.get( "..." )
 ....
> response.class
 => HTTParty::Response

So the response from HTTParty.get is an HTTParty::Response object.

See this blogpost titled "It's Time To HTTParty!" to learn more about how to work this response.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top