mirror of
https://github.com/usetrmnl/trmnl-api.git
synced 2026-04-29 13:35:13 -07:00
Added current screen model
Necessary to model the API response payload.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user