Class: MISP::Server
Instance Attribute Summary collapse
- #id ⇒ String readonly
- #name ⇒ String readonly
- #url ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ Server
constructor
A new instance of Server.
-
#list ⇒ Array<MISP::Server>
List servers.
-
#to_h ⇒ Hash
Returns a hash representation of the attribute data.
Constructor Details
#initialize(**attributes) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 |
# File 'lib/misp/server.rb', line 12 def initialize(**attributes) attributes = normalize_attributes(**attributes) @id = attributes.dig(:id) @url = attributes.dig(:url) @name = attributes.dig(:name) end |
Instance Attribute Details
#id ⇒ String (readonly)
6 7 8 |
# File 'lib/misp/server.rb', line 6 def id @id end |
#name ⇒ String (readonly)
10 11 12 |
# File 'lib/misp/server.rb', line 10 def name @name end |
#url ⇒ String (readonly)
8 9 10 |
# File 'lib/misp/server.rb', line 8 def url @url end |
Class Method Details
.list ⇒ Object
47 48 49 |
# File 'lib/misp/server.rb', line 47 def list new.list end |
Instance Method Details
#list ⇒ Array<MISP::Server>
List servers
38 39 40 41 42 43 44 |
# File 'lib/misp/server.rb', line 38 def list _get("/servers/") do |servers| servers.map do |server| Server.new server end end end |
#to_h ⇒ Hash
Returns a hash representation of the attribute data.
25 26 27 28 29 30 31 |
# File 'lib/misp/server.rb', line 25 def to_h { id: id, url: url, name: name, }.compact end |