Class: Idnow::RawResponse
- Inherits:
-
Object
- Object
- Idnow::RawResponse
- Defined in:
- lib/idnow/raw_response.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#errors ⇒ Object
IDNow API always returns JSON-formatted errors, even if a successful response is raw text.
- #errors? ⇒ Boolean
-
#initialize(raw_response) ⇒ RawResponse
constructor
A new instance of RawResponse.
Constructor Details
#initialize(raw_response) ⇒ RawResponse
Returns a new instance of RawResponse.
7 8 9 |
# File 'lib/idnow/raw_response.rb', line 7 def initialize(raw_response) @raw = raw_response.nil? ? raw_response.to_s : raw_response end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/idnow/raw_response.rb', line 5 def raw @raw end |
Instance Method Details
#errors ⇒ Object
IDNow API always returns JSON-formatted errors, even if a successful response is raw text
13 14 15 16 17 18 |
# 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? ⇒ Boolean
20 21 22 |
# File 'lib/idnow/raw_response.rb', line 20 def errors? !errors.nil? end |