mirror of
https://github.com/usetrmnl/trmnl-api.git
synced 2026-04-29 13:35:13 -07:00
Added firmware 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.
|
||||
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
|
||||
Reference in New Issue
Block a user