Added firmware model

Necessary to model the API response payload.
This commit is contained in:
Brooke Kuhlmann
2025-04-22 14:24:33 -06:00
parent 8137e1f5f0
commit 3d183df433
2 changed files with 24 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
# frozen_string_literal: true
module TRMNL
module API
module Models
# Models API response.
Firmware = Data.define :url, :version do
def self.for(attributes) = new(**attributes)
end
end
end
end
@@ -0,0 +1,12 @@
# frozen_string_literal: true
require "spec_helper"
RSpec.describe TRMNL::API::Models::Firmware do
describe ".for" do
it "answers record for attributes" do
attributes = {url: "https://test.io/FW1.0.0.bin", version: "1.0.0"}
expect(described_class.for(attributes)).to eq(described_class[**attributes])
end
end
end