Module: SimpleOAuth::OAuth2::ResponseBody
- Defined in:
- lib/simple_oauth/oauth2/response_body.rb,
sig/simple_oauth/oauth2.rbs
Overview
Parses the JSON bodies returned by OAuth 2.0 endpoints
Class Method Summary collapse
-
.parse(body) ⇒ Hash{String => Object}
private
Parse a response body into a Hash, or an empty Hash if it is not a JSON object.
Class Method Details
.parse(body) ⇒ Hash{String => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parse a response body into a Hash, or an empty Hash if it is not a JSON object
19 20 21 22 23 |
# File 'lib/simple_oauth/oauth2/response_body.rb', line 19 def self.parse(body) Hash.try_convert(JSON.parse(body.to_s)) || {} rescue JSON::ParserError {} end |