Class: Swagger::Diff::Diff
- Inherits:
-
Object
- Object
- Swagger::Diff::Diff
- Defined in:
- lib/swagger/diff/diff.rb
Instance Method Summary collapse
- #changes ⇒ Object
- #changes_message ⇒ Object
- #compatible? ⇒ Boolean
- #incompatibilities ⇒ Object
- #incompatibilities_message ⇒ Object
-
#initialize(old, new) ⇒ Diff
constructor
A new instance of Diff.
Constructor Details
#initialize(old, new) ⇒ Diff
Returns a new instance of Diff.
4 5 6 7 |
# File 'lib/swagger/diff/diff.rb', line 4 def initialize(old, new) @new_specification = Swagger::Diff::Specification.new(new) @old_specification = Swagger::Diff::Specification.new(old) end |
Instance Method Details
#changes ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/swagger/diff/diff.rb', line 9 def changes @changes ||= { new_endpoints: new_endpoints.to_a.sort, removed_endpoints: missing_endpoints.to_a.sort, new_request_params: new_or_changed_request_params, removed_request_params: incompatible_request_params, new_response_attributes: new_or_changed_response_attributes, removed_response_attributes: incompatible_response_attributes } end |
#changes_message ⇒ Object
20 21 22 |
# File 'lib/swagger/diff/diff.rb', line 20 def + + end |
#compatible? ⇒ Boolean
24 25 26 |
# File 'lib/swagger/diff/diff.rb', line 24 def compatible? endpoints_compatible? && requests_compatible? && responses_compatible? end |
#incompatibilities ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/swagger/diff/diff.rb', line 28 def incompatibilities @incompatibilities ||= { endpoints: missing_endpoints.to_a.sort, request_params: incompatible_request_params, response_attributes: incompatible_response_attributes } end |
#incompatibilities_message ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/swagger/diff/diff.rb', line 36 def msg = '' msg += ('missing', incompatibilities[:endpoints]) msg += ('incompatible', incompatibilities[:request_params]) msg += ('incompatible', incompatibilities[:response_attributes]) msg end |