Class: Pulsedive::API

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = ENV["PULSEDIVE_API_KEY"]) ⇒ API

Returns a new instance of API.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
# File 'lib/pulsedive/api.rb', line 10

def initialize(api_key = ENV["PULSEDIVE_API_KEY"])
  raise(ArgumentError, "'api_key' argument is required") unless api_key

  @indicator = Indicator.new(api_key)
  @threat = Threat.new(api_key)
  @feed = Feed.new(api_key)
  @analyze = Analyze.new(api_key)
end

Instance Attribute Details

#analyzeObject (readonly)

Returns the value of attribute analyze.



8
9
10
# File 'lib/pulsedive/api.rb', line 8

def analyze
  @analyze
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



4
5
6
# File 'lib/pulsedive/api.rb', line 4

def api_key
  @api_key
end

#feedObject (readonly)

Returns the value of attribute feed.



7
8
9
# File 'lib/pulsedive/api.rb', line 7

def feed
  @feed
end

#indicatorObject (readonly)

Returns the value of attribute indicator.



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

def indicator
  @indicator
end

#threatObject (readonly)

Returns the value of attribute threat.



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

def threat
  @threat
end

Instance Method Details

#search(params) ⇒ Object



19
20
21
# File 'lib/pulsedive/api.rb', line 19

def search(params)
  Search.new(api_key).search(params)
end