Sha256: a9bec61c291f3d8c1d1a62b28901f4d23eac69d3a80655175e19946a799f7603

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

module MISP
  class Server < Base
    attr_reader :id
    attr_reader :url
    attr_reader :name

    def initialize(**attributes)
      attributes = normalize_attributes(attributes)

      @id = attributes.dig(:id)
      @url = attributes.dig(:url)
      @name = attributes.dig(:name)
    end

    def to_h
      {
        id: id,
        url: url,
        name: name,
      }.compact
    end

    def list
      _get("/servers/") do |servers|
        servers.map do |server|
          Server.new symbolize_keys(server)
        end
      end
    end

    def self.list
      new.list
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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