Class: Fitting::Report::Response
- Inherits:
-
Object
- Object
- Fitting::Report::Response
- Defined in:
- lib/fitting/report/response.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
Instance Method Summary collapse
- #body ⇒ Object
- #combinations ⇒ Object
- #cover! ⇒ Object
- #cover? ⇒ Boolean
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #status ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 |
# File 'lib/fitting/report/response.rb', line 10 def initialize(response) @response = response @id = SecureRandom.hex @cover = false end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
32 33 34 |
# File 'lib/fitting/report/response.rb', line 32 def id @id end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
32 33 34 |
# File 'lib/fitting/report/response.rb', line 32 def tests @tests end |
Instance Method Details
#body ⇒ Object
28 29 30 |
# File 'lib/fitting/report/response.rb', line 28 def body @response['body'] || @response[:body] end |
#combinations ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fitting/report/response.rb', line 34 def combinations return @combinations if @combinations cmbntns = [] combinations = Fitting::Cover::JSONSchema.new(body).combi + Fitting::Cover::JSONSchemaEnum.new(body).combi + Fitting::Cover::JSONSchemaOneOf.new(body).combi if combinations != [] combinations.map do |combination| cmbntns.push( Fitting::Report::Combination.new( json_schema: combination[0], type: combination[1][0], combination: combination[1][1] ) ) end end @combinations = Fitting::Report::Combinations.new(cmbntns) end |
#cover! ⇒ Object
20 21 22 |
# File 'lib/fitting/report/response.rb', line 20 def cover! @cover = true end |
#cover? ⇒ Boolean
16 17 18 |
# File 'lib/fitting/report/response.rb', line 16 def cover? @cover end |
#status ⇒ Object
24 25 26 |
# File 'lib/fitting/report/response.rb', line 24 def status @response['status'] || @response[:status] end |