Class: Bark::Service
- Inherits:
-
Object
- Object
- Bark::Service
- Defined in:
- lib/bark/service.rb
Overview
The Service class hits the Status Monit API endpoint
Instance Method Summary collapse
-
#each ⇒ Array
Retrieves the services which Monit has running / is monitoring.
-
#initialize(client) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(client) ⇒ Service
Returns a new instance of Service.
5 6 7 8 |
# File 'lib/bark/service.rb', line 5 def initialize(client) @client = client @status = Bark::Status.new client end |
Instance Method Details
#each ⇒ Array
Retrieves the services which Monit has running / is monitoring
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bark/service.rb', line 13 def each response = @status.current[:monit][:service] if response.is_a? Array @services = response.map do |service| service end else @services = [@hash["monit"]["service"]] end @services end |