Added client custom inspection

Necessary to reduce verbosity of output when inspecting the client.

Milestone: minor
This commit is contained in:
Brooke Kuhlmann
2025-05-19 08:21:40 -06:00
parent 174d6ace3c
commit 9b47c7bae0
2 changed files with 22 additions and 0 deletions
+10
View File
@@ -1,5 +1,7 @@
# frozen_string_literal: true
require "inspectable"
module TRMNL
module API
# Provides the primary client for making API requests.
@@ -14,6 +16,14 @@ module TRMNL
endpoint_setup: :setup
]
include Inspectable[
endpoint_current_screen: :class,
endpoint_display: :class,
endpoint_firmware: :class,
endpoint_log: :class,
endpoint_setup: :class
]
def initialize(**)
super
yield settings if block_given?
+12
View File
@@ -75,4 +75,16 @@ RSpec.describe TRMNL::API::Client do
expect(client.setup(id: "abc")).to have_received(:call).with(id: "abc")
end
end
describe "#inspect" do
it "answers endpoint classes" do
expect(client.inspect).to include(
"@endpoint_current_screen=TRMNL::API::Endpoints::CurrentScreen, " \
"@endpoint_display=TRMNL::API::Endpoints::Display, " \
"@endpoint_firmware=TRMNL::API::Endpoints::Firmware, " \
"@endpoint_log=TRMNL::API::Endpoints::Log, " \
"@endpoint_setup=TRMNL::API::Endpoints::Setup, "
)
end
end
end