lib/fb_graph/node.rb in fb_graph-2.1.8 vs lib/fb_graph/node.rb in fb_graph-2.1.9

- old
+ new

@@ -112,10 +112,15 @@ # ref) http://forum.developers.facebook.com/viewtopic.php?pid=228256#p228256 raise NotFound.new('Graph API returned false, so probably it means your requested object is not found.') when 'null' nil else + # NOTE: User#app_request! returns ID as a JSON string not as a JSON object.. + if response.body.gsub('"', '').to_i.to_s == response.body.gsub('"', '') + return response.body.gsub('"', '') + end + _response_ = JSON.parse(response.body) _response_ = case _response_ when Array _response_.map!(&:with_indifferent_access) when Hash @@ -123,9 +128,9 @@ Exception.handle_httpclient_error(_response_, response.headers) if _response_[:error] _response_ end end rescue JSON::ParserError - raise Exception.new(response.status, 'Unparsable Error Response') + raise Exception.new(response.status, "Unparsable Response: #{response.body}") end end end