Class: DebtManagementCenter::DebtsResponse
- Inherits:
-
Object
- Object
- DebtManagementCenter::DebtsResponse
- Defined in:
- lib/debt_management_center/responses/debts_response.rb
Instance Attribute Summary collapse
-
#debts ⇒ Object
readonly
Returns the value of attribute debts.
Instance Method Summary collapse
-
#initialize(res) ⇒ DebtsResponse
constructor
A new instance of DebtsResponse.
- #to_json(*_args) ⇒ Object
- #validate_response_against_schema(response) ⇒ Object private
Constructor Details
#initialize(res) ⇒ DebtsResponse
Returns a new instance of DebtsResponse.
7 8 9 10 |
# File 'lib/debt_management_center/responses/debts_response.rb', line 7 def initialize(res) validate_response_against_schema(res) @debts = res end |
Instance Attribute Details
#debts ⇒ Object (readonly)
Returns the value of attribute debts.
5 6 7 |
# File 'lib/debt_management_center/responses/debts_response.rb', line 5 def debts @debts end |
Instance Method Details
#to_json(*_args) ⇒ Object
12 13 14 |
# File 'lib/debt_management_center/responses/debts_response.rb', line 12 def to_json(*_args) @debts.to_json end |
#validate_response_against_schema(response) ⇒ Object (private)
18 19 20 21 |
# File 'lib/debt_management_center/responses/debts_response.rb', line 18 def validate_response_against_schema(response) schema_path = Rails.root.join('lib', 'debt_management_center', 'schemas', 'debts.json').to_s JSON::Validator.validate!(schema_path, response, strict: false) end |