Fixed recipe entry model to be data model

Necessary to add clarity to what this model represents as `Entry` was slightly confusing, and now that there is no conflict with native `Data` objects, we can use `Data` for the model name.

Milestone: minor
This commit is contained in:
Brooke Kuhlmann
2026-01-22 15:19:06 -07:00
parent f59688fee5
commit 9cd951f908
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ module TRMNL
:next_page_url
) do
def self.for(**attributes)
data = attributes[:data].map { Recipes::Entry.for(**it) }
data = attributes[:data].map { Recipes::Data.for(**it) }
new(**attributes.merge!(data:))
end
end
@@ -5,7 +5,7 @@ module TRMNL
module Models
module Recipes
# Models the data of the API response.
Entry = Struct.new(
Data = Struct.new(
:id,
:name,
:icon_url,
+1 -1
View File
@@ -58,7 +58,7 @@ RSpec.describe TRMNL::API::Endpoints::Recipe do
expect(endpoint.call.success).to match(
TRMNL::API::Models::Recipe[
data: [
TRMNL::API::Models::Recipes::Entry[
TRMNL::API::Models::Recipes::Data[
id: 1,
name: "test",
published_at: Time.parse("2026-01-02T03:04:05.000Z"),
+1 -1
View File
@@ -52,7 +52,7 @@ RSpec.describe TRMNL::API::Models::Recipe do
expect(described_class.for(**attributes)).to eq(
described_class[
data: [
TRMNL::API::Models::Recipes::Entry[
TRMNL::API::Models::Recipes::Data[
id: 1,
name: "Test",
published_at: "2026-01-13T13:00:32.349Z",