From 9cd951f908e027b30586a8b3dddace3bde494efa Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Thu, 22 Jan 2026 14:20:11 -0700 Subject: [PATCH] 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 --- lib/trmnl/api/models/recipe.rb | 2 +- lib/trmnl/api/models/recipes/{entry.rb => data.rb} | 2 +- spec/lib/trmnl/api/endpoints/recipe_spec.rb | 2 +- spec/lib/trmnl/api/models/recipe_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename lib/trmnl/api/models/recipes/{entry.rb => data.rb} (95%) diff --git a/lib/trmnl/api/models/recipe.rb b/lib/trmnl/api/models/recipe.rb index c571c17..998efbf 100644 --- a/lib/trmnl/api/models/recipe.rb +++ b/lib/trmnl/api/models/recipe.rb @@ -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 diff --git a/lib/trmnl/api/models/recipes/entry.rb b/lib/trmnl/api/models/recipes/data.rb similarity index 95% rename from lib/trmnl/api/models/recipes/entry.rb rename to lib/trmnl/api/models/recipes/data.rb index 6f1c19a..4f9753e 100644 --- a/lib/trmnl/api/models/recipes/entry.rb +++ b/lib/trmnl/api/models/recipes/data.rb @@ -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, diff --git a/spec/lib/trmnl/api/endpoints/recipe_spec.rb b/spec/lib/trmnl/api/endpoints/recipe_spec.rb index 9aefc40..d7bd532 100644 --- a/spec/lib/trmnl/api/endpoints/recipe_spec.rb +++ b/spec/lib/trmnl/api/endpoints/recipe_spec.rb @@ -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"), diff --git a/spec/lib/trmnl/api/models/recipe_spec.rb b/spec/lib/trmnl/api/models/recipe_spec.rb index 5c257bd..d2e15d9 100644 --- a/spec/lib/trmnl/api/models/recipe_spec.rb +++ b/spec/lib/trmnl/api/models/recipe_spec.rb @@ -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",