Exception: Onfido::OnfidoError
- Inherits:
-
StandardError
- Object
- StandardError
- Onfido::OnfidoError
- Defined in:
- lib/onfido/errors/onfido_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response_body ⇒ Object
Returns the value of attribute response_body.
-
#response_code ⇒ Object
Returns the value of attribute response_code.
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(message = nil, response_code: nil, response_body: nil) ⇒ OnfidoError
constructor
A new instance of OnfidoError.
- #json_body ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(message = nil, response_code: nil, response_body: nil) ⇒ OnfidoError
Returns a new instance of OnfidoError.
7 8 9 10 11 12 13 14 |
# File 'lib/onfido/errors/onfido_error.rb', line 7 def initialize( = nil, response_code: nil, response_body: nil) @response_code = response_code @response_body = response_body super() end |
Instance Attribute Details
#response_body ⇒ Object
Returns the value of attribute response_body.
5 6 7 |
# File 'lib/onfido/errors/onfido_error.rb', line 5 def response_body @response_body end |
#response_code ⇒ Object
Returns the value of attribute response_code.
5 6 7 |
# File 'lib/onfido/errors/onfido_error.rb', line 5 def response_code @response_code end |
Instance Method Details
#fields ⇒ Object
26 27 28 |
# File 'lib/onfido/errors/onfido_error.rb', line 26 def fields json_body && json_body['error'] && json_body['error']['fields'] end |
#json_body ⇒ Object
16 17 18 19 20 |
# File 'lib/onfido/errors/onfido_error.rb', line 16 def json_body JSON.parse(response_body.to_s) rescue JSON::ParserError nil end |
#type ⇒ Object
22 23 24 |
# File 'lib/onfido/errors/onfido_error.rb', line 22 def type json_body && json_body['error'] && json_body['error']['type'] end |