class Idnow::RawResponse
Attributes
raw[R]
Public Class Methods
new(raw_response)
click to toggle source
# File lib/idnow/raw_response.rb, line 7 def initialize(raw_response) @raw = raw_response.nil? ? raw_response.to_s : raw_response end
Public Instance Methods
errors()
click to toggle source
IDNow API
always returns JSON-formatted errors, even if a successful response is raw text
# File lib/idnow/raw_response.rb, line 13 def errors if valid_json?(@raw) json_data = JSON.parse(@raw) json_data['errors'] if json_data.instance_of?(Hash) end end
errors?()
click to toggle source
# File lib/idnow/raw_response.rb, line 20 def errors? !errors.nil? end
Private Instance Methods
valid_json?(json)
click to toggle source
# File lib/idnow/raw_response.rb, line 26 def valid_json?(json) JSON.parse(json) true rescue JSON::ParserError false end