Class: PassiveTotal::API

Inherits:
Object
  • Object
show all
Defined in:
lib/passivetotal/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username: ENV["PASSIVETOTAL_USERNAME"], api_key: ENV["PASSIVETOTAL_API_KEY"]) ⇒ API

Returns a new instance of API.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
# File 'lib/passivetotal/api.rb', line 8

def initialize(username: ENV["PASSIVETOTAL_USERNAME"], api_key: ENV["PASSIVETOTAL_API_KEY"])
  @username = username
  raise ArgumentError, "No usernamme has been found or provided!" unless @username

  @api_key = api_key
  raise ArgumentError, "No api key has been found or provided!" unless @api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



6
7
8
# File 'lib/passivetotal/api.rb', line 6

def api_key
  @api_key
end

#usernameObject (readonly)

Returns the value of attribute username.



5
6
7
# File 'lib/passivetotal/api.rb', line 5

def username
  @username
end

Instance Method Details

#accountObject



16
17
18
# File 'lib/passivetotal/api.rb', line 16

def 
  @account ||= Client::Account.new(username: username, api_key: api_key)
end

#actionObject



20
21
22
# File 'lib/passivetotal/api.rb', line 20

def action
  @action ||= Client::Action.new(username: username, api_key: api_key)
end

#artifactObject



24
25
26
# File 'lib/passivetotal/api.rb', line 24

def artifact
  @artifact ||= Client::Artifact.new(username: username, api_key: api_key)
end

#baseObject



28
29
30
# File 'lib/passivetotal/api.rb', line 28

def base
  @base ||= Client::Base.new(username: username, api_key: api_key)
end

#dnsObject



32
33
34
# File 'lib/passivetotal/api.rb', line 32

def dns
  @dns ||= Client::DNS.new(username: username, api_key: api_key)
end

#enrichmentObject



36
37
38
# File 'lib/passivetotal/api.rb', line 36

def enrichment
  @enrichment ||= Client::Enrichment.new(username: username, api_key: api_key)
end

#hostObject



40
41
42
# File 'lib/passivetotal/api.rb', line 40

def host
  @host ||= Client::Host.new(username: username, api_key: api_key)
end

#monitorObject



44
45
46
# File 'lib/passivetotal/api.rb', line 44

def monitor
  @monitor ||= Client::Monitor.new(username: username, api_key: api_key)
end

#projectObject



48
49
50
# File 'lib/passivetotal/api.rb', line 48

def project
  @project ||= Client::Project.new(username: username, api_key: api_key)
end

#sslObject



52
53
54
# File 'lib/passivetotal/api.rb', line 52

def ssl
  @ssl ||= Client::SSL.new(username: username, api_key: api_key)
end

#tagObject



56
57
58
# File 'lib/passivetotal/api.rb', line 56

def tag
  @tag ||= Client::Tag.new(username: username, api_key: api_key)
end

#trackerObject



60
61
62
# File 'lib/passivetotal/api.rb', line 60

def tracker
  @tracker ||= Client::Tracker.new(username: username, api_key: api_key)
end

#whoisObject



64
65
66
# File 'lib/passivetotal/api.rb', line 64

def whois
  @whois ||= Client::WHOIS.new(username: username, api_key: api_key)
end