Sha256: 823c983bc53502ced3f0f6efcbeaccb45b2c26aed46698f9e9461720e8f486f2

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Spyse
  class API
    def initialize(api_key = ENV["SPYSE_API_KEY"])
      @api_key = api_key
      raise ArgumentError, "No api key has been found or provided!" unless @api_key
    end

    def as
      @as ||= Client::AS.new(@api_key)
    end

    def cert
      @cert ||= Client::Cert.new(@api_key)
    end

    def cve
      @cve ||= Client::CVE.new(@api_key)
    end

    def domain
      @domain ||= Client::Domain.new(@api_key)
    end

    def ip
      @ip ||= Client::IP.new(@api_key)
    end

    def get(path, params = {})
      base._get(path, params) { |json| json }
    end

    def post(path, params = {})
      base._post(path, params) { |json| json }
    end

    private

    def base
      @base ||= Client::Base.new(@api_key)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spysex-0.2.0 lib/spyse/api.rb