Class: Pwnix::Api::Client::Service

Inherits:
Object
  • Object
show all
Includes:
HTTParty, HTTPartyTime
Defined in:
lib/pwnix-api-client/service.rb

Instance Method Summary collapse

Methods included from HTTPartyTime

#clear_errors, #errors, #has_errors?, included, #last_error, #safe_api_call

Constructor Details

#initialize(service_name) ⇒ Service

Returns a new instance of Service.



8
9
10
# File 'lib/pwnix-api-client/service.rb', line 8

def initialize(service_name)
  @service_name = service_name
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/pwnix-api-client/service.rb', line 24

def available?
  safe_api_call("/services/#{@service_name}/available")
end

#disableObject



40
41
42
# File 'lib/pwnix-api-client/service.rb', line 40

def disable
  safe_api_call("/services/#{@service_name}/disable")
end

#enable(params = {}) ⇒ Object



36
37
38
# File 'lib/pwnix-api-client/service.rb', line 36

def enable(params={})
  safe_api_call("/services/#{@service_name}/enable", params )
end

#running?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/pwnix-api-client/service.rb', line 20

def running?
  safe_api_call("/services/#{@service_name}/running")
end

#start(params) ⇒ Object



28
29
30
# File 'lib/pwnix-api-client/service.rb', line 28

def start(params)
  safe_api_call("/services/#{@service_name}/start", params )
end

#statusObject



12
13
14
# File 'lib/pwnix-api-client/service.rb', line 12

def status
  safe_api_call("/services/#{@service_name}/status")
end

#status_stringObject



16
17
18
# File 'lib/pwnix-api-client/service.rb', line 16

def status_string
  safe_api_call("/services/#{@service_name}/status_string")
end

#stopObject



32
33
34
# File 'lib/pwnix-api-client/service.rb', line 32

def stop
  safe_api_call("/services/#{@service_name}/stop")
end