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)


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

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

  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

Instance Method Details

#analyzeObject



25
26
27
# File 'lib/pulsedive/api.rb', line 25

def analyze
  @analyze ||= Analyze.new(api_key)
end

#feedObject



21
22
23
# File 'lib/pulsedive/api.rb', line 21

def feed
  @feed ||= Feed.new(api_key)
end

#indicatorObject



13
14
15
# File 'lib/pulsedive/api.rb', line 13

def indicator
  @indicator ||= Indicator.new(api_key)
end

#search(params) ⇒ Object



29
30
31
# File 'lib/pulsedive/api.rb', line 29

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

#threatObject



17
18
19
# File 'lib/pulsedive/api.rb', line 17

def threat
  @threat ||= Threat.new(api_key)
end