Class: Fitting::Records::Unit::Response
- Inherits:
-
Object
- Object
- Fitting::Records::Unit::Response
- Defined in:
- lib/fitting/records/unit/response.rb
Instance Method Summary collapse
-
#initialize(documented_response, tested_responses) ⇒ Response
constructor
A new instance of Response.
- #json_schemas ⇒ Object
- #status ⇒ Object
- #tested_bodies ⇒ Object
Constructor Details
#initialize(documented_response, tested_responses) ⇒ Response
Returns a new instance of Response.
7 8 9 10 |
# File 'lib/fitting/records/unit/response.rb', line 7 def initialize(documented_response, tested_responses) @documented_response = documented_response @tested_responses = tested_responses end |
Instance Method Details
#json_schemas ⇒ Object
16 17 18 19 20 |
# File 'lib/fitting/records/unit/response.rb', line 16 def json_schemas @json_schemas ||= @documented_response['json_schemas'].inject([]) do |res, documented_json_schema| res.push(Fitting::Records::Unit::JsonSchema.new(documented_json_schema, tested_bodies)) end end |
#status ⇒ Object
12 13 14 |
# File 'lib/fitting/records/unit/response.rb', line 12 def status @status ||= @documented_response['status'] end |
#tested_bodies ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/fitting/records/unit/response.rb', line 22 def tested_bodies @tested_bodies ||= @tested_responses.inject([]) do |res, tested_response| next res unless status == tested_response.status.to_s res.push(tested_response.body) end end |