Class: Threatstack::Response
- Inherits:
-
Object
- Object
- Threatstack::Response
- Defined in:
- lib/threatstack/response.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #agents ⇒ Object
- #alerts ⇒ Object
-
#initialize(entity, raw) ⇒ Response
constructor
A new instance of Response.
- #logs ⇒ Object
- #organizations ⇒ Object
- #policies ⇒ Object
Constructor Details
#initialize(entity, raw) ⇒ Response
Returns a new instance of Response.
11 12 13 14 |
# File 'lib/threatstack/response.rb', line 11 def initialize(entity, raw) @raw = raw @entity = entity end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
10 11 12 |
# File 'lib/threatstack/response.rb', line 10 def entity @entity end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
10 11 12 |
# File 'lib/threatstack/response.rb', line 10 def raw @raw end |
Instance Method Details
#agents ⇒ Object
16 17 18 19 |
# File 'lib/threatstack/response.rb', line 16 def agents raise InvalidEntity unless entity == :agent raw.map{ |a| Agent.new(a) } end |
#alerts ⇒ Object
21 22 23 24 |
# File 'lib/threatstack/response.rb', line 21 def alerts raise InvalidEntity unless entity == :alert raw.map{ |a| Alert.new(a) } end |
#logs ⇒ Object
26 27 28 29 |
# File 'lib/threatstack/response.rb', line 26 def logs raise InvalidEntity unless entity == :log raw.map{ |a| Log.new(a) } end |
#organizations ⇒ Object
31 32 33 34 |
# File 'lib/threatstack/response.rb', line 31 def organizations raise InvalidEntity unless entity == :organization raw.map{ |a| Organization.new(a) } end |
#policies ⇒ Object
36 37 38 39 |
# File 'lib/threatstack/response.rb', line 36 def policies raise InvalidEntity unless entity == :policy raw.map{ |a| Policy.new(a) } end |