Sha256: 24e98c256f68fd2bbbd0a8da214863ecaaa64e0edd7029917175027c89629f33

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

module MISP
  class SharingGroupServer < Server
    attr_reader :id
    attr_reader :sharing_group_id
    attr_reader :server_id
    attr_reader :all_orgs

    attr_reader :servers

    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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
misp-0.1.0 lib/misp/sharing_group_server.rb