Class: Seer::Org

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

Overview

ORG API controller

Instance Method Summary collapse

Constructor Details

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

Initialize a Org 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/org.rb', line 8

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

Instance Method Details

#asn(asn) ⇒ Hash

Get organization by AS number

Parameters:

  • asn (Fixnum)

    AS number

Returns:

  • (Hash)

    Result



30
31
32
33
34
35
# File 'lib/seer/org.rb', line 30

def asn(asn)
  body = { asn: asn }
  url = @host + '/asn'

  Seer.request(url, body, @header)
end

#ip(ip) ⇒ Hash

Get organization by ip

Parameters:

  • ip (String)

    IP address for search

Returns:

  • (Hash)

    Result



20
21
22
23
24
25
# File 'lib/seer/org.rb', line 20

def ip(ip)
  body = { ip: ip }
  url = @host + '/ip'

  Seer.request(url, body, @header)
end