Method: Eipiai::Resource#params
- Defined in:
- lib/eipiai/resources/base.rb
#params(body = request.body.to_s) ⇒ Hash
params
Given a string in JSON format, returns the hash representation of that object.
If the input is invalid JSON, an empty hash is returned.
If no argument is given, ‘request.body` is used as the JSON input.
177 178 179 180 181 |
# File 'lib/eipiai/resources/base.rb', line 177 def params(body = request.body.to_s) @params ||= JSON.parse(body) rescue JSON::ParserError {} end |