Class: TqlOtrFactoringDataExchange::ProblemDetailsErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- TqlOtrFactoringDataExchange::ProblemDetailsErrorException
- Defined in:
- lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb
Overview
[RFC 7807](datatracker.ietf.org/doc/html/rfc7807) Problem Details response returned for validation errors and other non-success outcomes.
Instance Attribute Summary collapse
-
#detail ⇒ String
Detailed, human-readable explanation specific to this occurrence.
-
#status ⇒ Integer
HTTP status code.
-
#title ⇒ String
Short, human-readable summary of the problem type.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ ProblemDetailsErrorException
constructor
The constructor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ ProblemDetailsErrorException
The constructor.
28 29 30 31 32 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 28 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#detail ⇒ String
Detailed, human-readable explanation specific to this occurrence.
23 24 25 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 23 def detail @detail end |
#status ⇒ Integer
HTTP status code.
19 20 21 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 19 def status @status end |
#title ⇒ String
Short, human-readable summary of the problem type.
15 16 17 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 15 def title @title end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
52 53 54 55 56 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 52 def inspect class_name = self.class.name.split('::').last "<#{class_name} title: #{@title.inspect}, status: #{@status.inspect}, detail:"\ " #{@detail.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
46 47 48 49 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 46 def to_s class_name = self.class.name.split('::').last "<#{class_name} title: #{@title}, status: #{@status}, detail: #{@detail}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
37 38 39 40 41 42 43 |
# File 'lib/tql_otr_factoring_data_exchange/exceptions/problem_details_error_exception.rb', line 37 def unbox(hash) return nil unless hash @title = hash.key?('title') ? hash['title'] : SKIP @status = hash.key?('status') ? hash['status'] : SKIP @detail = hash.key?('detail') ? hash['detail'] : SKIP end |