Class: Shodan::Clients::Base
- Inherits:
-
Object
- Object
- Shodan::Clients::Base
- Defined in:
- lib/shodan/clients/base.rb
Constant Summary collapse
- HOST =
The path to the REST API endpoint.
"api.shodan.io"
- BASE_URL =
"https://#{HOST}"
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key: ENV["SHODAN_API_KEY"]) ⇒ Base
constructor
A new instance of Base.
- #key? ⇒ Boolean
Constructor Details
#initialize(key: ENV["SHODAN_API_KEY"]) ⇒ Base
Returns a new instance of Base.
16 17 18 19 |
# File 'lib/shodan/clients/base.rb', line 16 def initialize(key: ENV["SHODAN_API_KEY"]) @key = key warn 'No key has been found or provided!' unless key? end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
14 15 16 |
# File 'lib/shodan/clients/base.rb', line 14 def key @key end |
Instance Method Details
#key? ⇒ Boolean
21 22 23 |
# File 'lib/shodan/clients/base.rb', line 21 def key? !key.nil? end |