Class: PiHole::Endpoint
- Inherits:
-
Object
- Object
- PiHole::Endpoint
- Defined in:
- lib/pi_hole/endpoint.rb
Overview
The main entrypoint for this SDK. Describes the location and interaction with the PiHole API
Instance Method Summary collapse
- #execute(command) ⇒ Object
-
#initialize(location:, api_key:) ⇒ Endpoint
constructor
A new instance of Endpoint.
Constructor Details
#initialize(location:, api_key:) ⇒ Endpoint
Returns a new instance of Endpoint.
10 11 12 13 |
# File 'lib/pi_hole/endpoint.rb', line 10 def initialize(location:, api_key:) @location = location @api_key = api_key end |
Instance Method Details
#execute(command) ⇒ Object
16 17 18 19 |
# File 'lib/pi_hole/endpoint.rb', line 16 def execute(command) uri = URI "#{location}/admin/api.php?#{command.query_string}&#{auth_query_string}" Net::HTTP.get_response uri end |