Module: PiholeApi::AuthorisedEndpoints
- Included in:
- Client
- Defined in:
- lib/pihole-api/authorised_endpoints.rb
Instance Method Summary collapse
- #disable ⇒ Object
- #enable ⇒ Object
- #get_all_queries(params: {}, from_time: nil, until_time: nil, latest_number_of_items: nil) ⇒ Object
- #get_forward_destinations ⇒ Object
- #get_query_sources(number_of_items = 10) ⇒ Object
- #get_query_types ⇒ Object
- #over_time_data_10_mins ⇒ Object
- #recent_blocked ⇒ Object
- #summary(params: {}) ⇒ Object
-
#summary_raw ⇒ Object
These endpoints need to be authorised discourse.pi-hole.net/t/pi-hole-api/1863.
- #top_clients(number_of_items = 10) ⇒ Object
- #top_items(number_of_items = 10) ⇒ Object
Instance Method Details
#disable ⇒ Object
77 78 79 80 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 77 def disable command = 'disable' (http_method: :get, command: command) end |
#enable ⇒ Object
72 73 74 75 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 72 def enable command = 'enable' (http_method: :get, command: command) end |
#get_all_queries(params: {}, from_time: nil, until_time: nil, latest_number_of_items: nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 46 def get_all_queries(params: {}, from_time: nil, until_time: nil, latest_number_of_items: nil) # API version 3: # First column: Timestamp of query # Second column: Type of query (IPv4 or IPv6) # Third column: Requested domain name # Fourth column: Requesting client # Fifth column: Answer type (1 = blocked by gravity.list, 2 = forwarded to upstream server, 3 = answered by local cache, 4 = blocked by wildcard blocking) if latest_number_of_items command = "getAllQueries=#{latest_number_of_items}" else command = 'getAllQueries' end if from_time command = "#{command}&from=#{from_time.to_i}&until=#{until_time.to_i}" end (http_method: :get, command: command, params: params) end |
#get_forward_destinations ⇒ Object
36 37 38 39 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 36 def get_forward_destinations command = 'getForwardDestinations' (http_method: :get, command: command) end |
#get_query_sources(number_of_items = 10) ⇒ Object
26 27 28 29 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 26 def get_query_sources(number_of_items=10) command = "getQuerySources=#{number_of_items}" (http_method: :get, command: command) end |
#get_query_types ⇒ Object
41 42 43 44 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 41 def get_query_types command = 'getQueryTypes' (http_method: :get, command: command) end |
#over_time_data_10_mins ⇒ Object
16 17 18 19 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 16 def over_time_data_10_mins command = 'overTimeData10mins' (http_method: :get, command: command) end |
#recent_blocked ⇒ Object
67 68 69 70 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 67 def recent_blocked command = 'recentBlocked' (http_method: :get, command: command) end |
#summary(params: {}) ⇒ Object
11 12 13 14 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 11 def summary(params: {}) command = 'summary' (http_method: :get, command: command, params: params) end |
#summary_raw ⇒ Object
These endpoints need to be authorised discourse.pi-hole.net/t/pi-hole-api/1863
6 7 8 9 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 6 def summary_raw command = "summaryRaw&auth=#{password}" (http_method: :get, command: command) end |
#top_clients(number_of_items = 10) ⇒ Object
31 32 33 34 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 31 def top_clients(number_of_items=10) command = "topClients=#{number_of_items}" (http_method: :get, command: command) end |
#top_items(number_of_items = 10) ⇒ Object
21 22 23 24 |
# File 'lib/pihole-api/authorised_endpoints.rb', line 21 def top_items(number_of_items=10) command = "topItems=#{number_of_items}" (http_method: :get, command: command) end |