mirror of
https://github.com/usetrmnl/trmnl-api.git
synced 2026-04-29 13:35:13 -07:00
Added primary Object API
Necessary to obtain an API client with access to all endpoints. Milestone: minor
This commit is contained in:
@@ -18,5 +18,7 @@ module TRMNL
|
||||
def self.loader registry = Zeitwerk::Registry
|
||||
@loader ||= registry.loaders.find { |loader| loader.tag == "trmnl-api" }
|
||||
end
|
||||
|
||||
def self.new(&) = Client.new(&)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,4 +13,27 @@ RSpec.describe TRMNL::API do
|
||||
expect(described_class.loader.tag).to eq("trmnl-api")
|
||||
end
|
||||
end
|
||||
|
||||
describe ".new" do
|
||||
include_context "with application dependencies"
|
||||
|
||||
it "configures client" do
|
||||
described_class.new do |settings|
|
||||
settings.content_type = "application/json"
|
||||
settings.uri = "https://api.test.io"
|
||||
end
|
||||
|
||||
expect(settings).to eq(
|
||||
TRMNL::API::Configuration::Content[
|
||||
content_type: "application/json",
|
||||
uri: "https://api.test.io"
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it "answers client" do
|
||||
described_class.new
|
||||
expect(described_class.new).to be_a(TRMNL::API::Client)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user