Class: PactBroker::Api::Resources::PactContentDiff
- Inherits:
-
BaseResource
- Object
- PactBroker::Api::Resources::PactContentDiff
- Defined in:
- lib/pact_broker/api/resources/pact_content_diff.rb
Instance Method Summary collapse
- #allowed_methods ⇒ Object
- #comparison_pact_params ⇒ Object
- #content_types_provided ⇒ Object
- #pact ⇒ Object
- #pact_params ⇒ Object
- #resource_exists? ⇒ Boolean
- #to_text ⇒ Object
Instance Method Details
#allowed_methods ⇒ Object
13 14 15 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 13 def allowed_methods ["GET", "OPTIONS"] end |
#comparison_pact_params ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 34 def comparison_pact_params if identifier_from_path[:comparison_consumer_version_number] || identifier_from_path[:comparison_pact_version_sha] comparison_identifier_from_path = identifier_from_path.merge( consumer_version_number: identifier_from_path[:comparison_consumer_version_number], pact_version_sha: identifier_from_path[:comparison_pact_version_sha], base_url: base_url) PactBroker::Pacts::PactParams.from_path_info(comparison_identifier_from_path) else nil end end |
#content_types_provided ⇒ Object
9 10 11 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 9 def content_types_provided [["text/plain", :to_text]] end |
#pact ⇒ Object
26 27 28 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 26 def pact @pact ||= pact_service.find_pact(pact_params) end |
#pact_params ⇒ Object
30 31 32 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 30 def pact_params @pact_params ||= PactBroker::Pacts::PactParams.from_path_info identifier_from_path end |
#resource_exists? ⇒ Boolean
17 18 19 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 17 def resource_exists? consumer && provider end |
#to_text ⇒ Object
21 22 23 24 |
# File 'lib/pact_broker/api/resources/pact_content_diff.rb', line 21 def to_text output = PactBroker::Pacts::Diff.new.process pact_params.merge(base_url: base_url), comparison_pact_params, raw: false response.body = output end |