mirror of
https://github.com/usetrmnl/trmnl-api.git
synced 2026-04-29 13:35:13 -07:00
Added client custom inspection
Necessary to reduce verbosity of output when inspecting the client. Milestone: minor
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user