From 268ac8d4e0418da7427d9d193898df79bc0d7752 Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Thu, 22 Jan 2026 14:57:49 -0700 Subject: [PATCH] Fixed recipe endpoint to use sort key Use of `sort-by` -- as provied by the API -- is awkward so this simplifies usage so you can use the `sort` key as a symbol which is consistent with existing keys. Milestone: minor --- lib/trmnl/api/endpoints/recipe.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/trmnl/api/endpoints/recipe.rb b/lib/trmnl/api/endpoints/recipe.rb index de42a91..0f6e6d4 100644 --- a/lib/trmnl/api/endpoints/recipe.rb +++ b/lib/trmnl/api/endpoints/recipe.rb @@ -2,6 +2,7 @@ require "inspectable" require "pipeable" +require "refinements/hash" module TRMNL module API @@ -17,9 +18,13 @@ module TRMNL include Inspectable[contract: :type] include Pipeable - def call(**) + using Refinements::Hash + + def call(**parameters) + parameters.transform_keys! sort: "sort-by" + pipe( - requester.get("recipes.json", **), + requester.get("recipes.json", **parameters), try(:parse, catch: JSON::ParserError), validate(contract, as: :to_h), to(model, :for)