Module: Eco::API::Session::Config::Apis::ServiceUp

Included in:
Eco::API::Session::Config::Apis
Defined in:
lib/eco/api/session/config/apis/service_up.rb

Instance Method Summary collapse

Instance Method Details

#service_up?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/eco/api/session/config/apis/service_up.rb', line 18

def service_up?
  @api_test ||=
    Session::Config::Api.
      api_class(active_api.version).
      new(
        'foobar',
        host:   active_api.host,
        logger: ::Logger.new(IO::NULL)
      )

  status = @api_test.client.get('/policy_groups').status
  # 401 Unauthorized "Permission denied. API key may be invalid."
  status == 401
end