Class: MISP::SharingGroupServer

Inherits:
Base
  • Object
show all
Defined in:
lib/misp/sharing_group_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_orgsBoolean (readonly)

Returns:

  • (Boolean)


12
13
14
# File 'lib/misp/sharing_group_server.rb', line 12

def all_orgs
  @all_orgs
end

#idString (readonly)

Returns:

  • (String)


6
7
8
# File 'lib/misp/sharing_group_server.rb', line 6

def id
  @id
end

#server_idString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/misp/sharing_group_server.rb', line 10

def server_id
  @server_id
end

#serversArray<MISP::Server> (readonly)

Returns:



15
16
17
# File 'lib/misp/sharing_group_server.rb', line 15

def servers
  @servers
end

#sharing_group_idString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/misp/sharing_group_server.rb', line 8

def sharing_group_id
  @sharing_group_id
end

Instance Method Details

#to_hHash

Returns a hash representation of the attribute data.

Returns:

  • (Hash)


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