Class: Seer::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/seer/status.rb

Overview

Status API controller

Instance Method Summary collapse

Constructor Details

#initialize(token: '', version: '2.0', host: '') ⇒ Status

Initialize a Status object

Parameters:

  • token (string) (defaults to: '')

    API token

  • version (string) (defaults to: '2.0')

    :version (‘1’) API version you want use (defaut 1)

  • host (string) (defaults to: '')

    API host (default seer.intra.nsfocus.com:8000/api)



8
9
10
11
12
13
14
15
# File 'lib/seer/status.rb', line 8

def initialize(token: '', version: '2.0', host: '')
  @host = host + '/status'
  @header = {
    content_type: 'application/json',
    x_seer_token: token,
    x_seer_version: version
  }
end

Instance Method Details

#portsHash

Get all ports

Returns:

  • (Hash)

    Result



27
28
29
30
31
# File 'lib/seer/status.rb', line 27

def ports
  url = @host + '/ports'
  response = RestClient.get url, @header
  JSON.load response
end

#servicesHash

Get SEER supported service

Returns:

  • (Hash)

    Result



19
20
21
22
23
# File 'lib/seer/status.rb', line 19

def services
  url = @host + '/services'
  response = RestClient.get url, @header
  JSON.load response
end

#tokenHash

Get token status

Returns:

  • (Hash)

    Result



35
36
37
38
39
# File 'lib/seer/status.rb', line 35

def token
  url = @host + "/token?token=#{@header[:x_seer_token]}"
  response = RestClient.get url, @header
  JSON.load response
end