Sha256: e839e62867e727a6a424674cbc129648b4c576083a913ac685f3cfc30914d265
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module Shodanz # General client container class for all three # of the available API endpoints in a # convenient place to use. # # @author Kent 'picat' Gruber class Client # @return [Shodanz::API::REST] attr_reader :rest_api # @return [Shodanz::API::Streaming] attr_reader :streaming_api # @return [Shodanz::API::Exploits] attr_reader :exploits_api # Create a new client to connect to any of the APIs. # # Optionally provide your Shodan API key, or the environment # variable SHODAN_API_KEY will be used. def initialize(key: ENV['SHODAN_API_KEY']) raise "No API key has been found or provided! ( setup your SHODAN_API_KEY environment varialbe )" if key.nil? # pass the given API key to each of the underlying clients # # Note: you can optionally change these API keys later, if you # had multiple for whatever reason. ;) # @rest_api = Shodanz.api.rest.new(key: key) @streaming_api = Shodanz.api.streaming.new(key: key) @exploits_api = Shodanz.api.exploits.new(key: key) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shodanz-1.0.6 | lib/shodanz/client.rb |