Class: PactBroker::Diagnostic::Resources::Dependencies

Inherits:
BaseResource
  • Object
show all
Includes:
Logging
Defined in:
lib/pact_broker/diagnostic/resources/dependencies.rb

Instance Method Summary collapse

Methods included from Logging

included, #log_error, #log_with_tag, #measure_info

Methods inherited from BaseResource

#base_url, #forbidden?, #is_authorized?

Methods included from Api::Resources::Authentication

#authenticated?

Constructor Details

#initializeDependencies

Returns a new instance of Dependencies.



12
13
14
# File 'lib/pact_broker/diagnostic/resources/dependencies.rb', line 12

def initialize
  @return_status = 200
end

Instance Method Details

#allowed_methodsObject



16
17
18
# File 'lib/pact_broker/diagnostic/resources/dependencies.rb', line 16

def allowed_methods
  ["GET"]
end

#content_types_providedObject



20
21
22
# File 'lib/pact_broker/diagnostic/resources/dependencies.rb', line 20

def content_types_provided
  [["application/hal+json", :to_json]]
end

#to_jsonObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pact_broker/diagnostic/resources/dependencies.rb', line 24

def to_json
  ok, report = database_connectivity_status
  response.body = {
    "database" => report,
    "_links" => {
      "self" => {
        "href" => base_url + "/diagnostic/status/dependencies"
      }
    }
  }.to_json

  ok ? 200 : 500
end