Class: Threatstack::Response

Inherits:
Object
  • Object
show all
Includes:
Serializable
Defined in:
lib/threatstack/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serializable

#attrs, #camelize, included, #initialize, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Threatstack::Serializable

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



12
13
14
# File 'lib/threatstack/response.rb', line 12

def client
  @client
end

#entityObject (readonly)

Returns the value of attribute entity.



12
13
14
# File 'lib/threatstack/response.rb', line 12

def entity
  @entity
end

#rawObject (readonly)

Returns the value of attribute raw.



12
13
14
# File 'lib/threatstack/response.rb', line 12

def raw
  @raw
end

Instance Method Details

#agentsObject

Raises:



15
16
17
18
# File 'lib/threatstack/response.rb', line 15

def agents
  raise InvalidEntity unless entity == :agent
  raw.map{ |a| Agent.new(a, client) }
end

#alertsObject

Raises:



20
21
22
23
# File 'lib/threatstack/response.rb', line 20

def alerts
  raise InvalidEntity unless entity == :alert
  raw.map{ |a| Alert.new(a, client) }
end

#cvesObject

Raises:



25
26
27
28
# File 'lib/threatstack/response.rb', line 25

def cves
  raise InvalidEntity unless entity == :cve
  raw.map{ |a| Cve.new(a, client) }
end

#listObject



40
41
42
# File 'lib/threatstack/response.rb', line 40

def list
  raw.map { |g| GenericObject.new(g, client) }
end

#rulesObject

Raises:



35
36
37
38
# File 'lib/threatstack/response.rb', line 35

def rules
  raise InvalidEntity unless entity == :rule
  raw.map{ |r| Rule.new(r, client) }
end

#rulesetsObject

Raises:



30
31
32
33
# File 'lib/threatstack/response.rb', line 30

def rulesets
  raise InvalidEntity unless entity == :ruleset
  raw.map{ |r| Ruleset.new(r, client) }
end