Added current screen model

Necessary to model the API response payload.
This commit is contained in:
Brooke Kuhlmann
2025-04-22 14:24:33 -06:00
parent 964e347ada
commit e7bac9edc3
2 changed files with 25 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
# frozen_string_literal: true
module TRMNL
module API
module Models
# Models API response.
CurrentScreen = Data.define :refresh_rate, :image_url, :filename do
def self.for(attributes) = new(**attributes)
end
end
end
end
@@ -0,0 +1,13 @@
# frozen_string_literal: true
require "spec_helper"
RSpec.describe TRMNL::API::Models::CurrentScreen do
describe ".for" do
it "answers record for attributes" do
attributes = {refresh_rate: 1, image_url: "https://test.io", filename: "test"}
expect(described_class.for(attributes)).to eq(described_class[**attributes])
end
end
end