Class: MISP::SharingGroupServer
- Defined in:
- lib/misp/sharing_group_server.rb
Instance Attribute Summary collapse
- #all_orgs ⇒ Boolean readonly
- #id ⇒ String readonly
- #server_id ⇒ String readonly
- #servers ⇒ Array<MISP::Server> readonly
- #sharing_group_id ⇒ String readonly
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ SharingGroupServer
constructor
A new instance of SharingGroupServer.
-
#to_h ⇒ Hash
Returns a hash representation of the attribute data.
Constructor Details
#initialize(**attributes) ⇒ SharingGroupServer
Returns a new instance of SharingGroupServer.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/misp/sharing_group_server.rb', line 17 def initialize(**attributes) attributes = normalize_attributes(attributes) @id = attributes.dig(:id) @sharing_group_id = attributes.dig(:sharing_group_id) @server_id = attributes.dig(:server_id) @all_orgs = attributes.dig(:all_orgs) @servers = build_plural_attribute(items: attributes.dig(:Server), klass: Server) end |
Instance Attribute Details
#all_orgs ⇒ Boolean (readonly)
12 13 14 |
# File 'lib/misp/sharing_group_server.rb', line 12 def all_orgs @all_orgs end |
#id ⇒ String (readonly)
6 7 8 |
# File 'lib/misp/sharing_group_server.rb', line 6 def id @id end |
#server_id ⇒ String (readonly)
10 11 12 |
# File 'lib/misp/sharing_group_server.rb', line 10 def server_id @server_id end |
#servers ⇒ Array<MISP::Server> (readonly)
15 16 17 |
# File 'lib/misp/sharing_group_server.rb', line 15 def servers @servers end |
#sharing_group_id ⇒ String (readonly)
8 9 10 |
# File 'lib/misp/sharing_group_server.rb', line 8 def sharing_group_id @sharing_group_id end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of the attribute data.
33 34 35 36 37 38 39 40 41 |
# File 'lib/misp/sharing_group_server.rb', line 33 def to_h { id: id, sharing_group_id: sharing_group_id, server_id: server_id, all_orgs: all_orgs, Server: servers.map(&:to_h) }.compact end |