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.
5 6 7 8 9 10 11 12 |
# File 'lib/onfido/errors/onfido_error.rb', line 5 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.
3 4 5 |
# File 'lib/onfido/errors/onfido_error.rb', line 3 def response_body @response_body end |
#response_code ⇒ Object
Returns the value of attribute response_code.
3 4 5 |
# File 'lib/onfido/errors/onfido_error.rb', line 3 def response_code @response_code end |
Instance Method Details
#fields ⇒ Object
24 25 26 |
# File 'lib/onfido/errors/onfido_error.rb', line 24 def fields json_body && json_body['error'] && json_body['error']['fields'] end |
#json_body ⇒ Object
14 15 16 17 18 |
# File 'lib/onfido/errors/onfido_error.rb', line 14 def json_body JSON.parse(response_body.to_s) rescue JSON::ParserError nil end |
#type ⇒ Object
20 21 22 |
# File 'lib/onfido/errors/onfido_error.rb', line 20 def type json_body && json_body['error'] && json_body['error']['type'] end |