Class: PiholeApi::Client

Inherits:
Object
  • Object
show all
Includes:
AuthorisedEndpoints, Constants, UnauthorisedEndpoints
Defined in:
lib/pihole-api/client.rb

Constant Summary

Constants included from Constants

PiholeApi::Constants::API_PATH

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AuthorisedEndpoints

#disable, #enable, #get_all_queries, #get_forward_destinations, #get_query_sources, #get_query_types, #over_time_data_10_mins, #recent_blocked, #summary, #summary_raw, #top_clients, #top_items

Methods included from UnauthorisedEndpoints

#type, #version

Constructor Details

#initialize(base_path:, api_token:, port: 80) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
# File 'lib/pihole-api/client.rb', line 11

def initialize(base_path:, api_token:, port: 80)
  @api_token = api_token
  @base_path = base_path
  @port = port
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



9
10
11
# File 'lib/pihole-api/client.rb', line 9

def api_token
  @api_token
end

#base_pathObject (readonly)

Returns the value of attribute base_path.



9
10
11
# File 'lib/pihole-api/client.rb', line 9

def base_path
  @base_path
end

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/pihole-api/client.rb', line 9

def port
  @port
end

Class Method Details

.api_versionObject

This is the version of the API docs this client was built off-of



22
23
24
# File 'lib/pihole-api/client.rb', line 22

def self.api_version
  'v2 2023-01-21'
end

.compatible_api_versionObject



17
18
19
# File 'lib/pihole-api/client.rb', line 17

def self.compatible_api_version
  'v3'
end