Class: TRMNL::API::Models::Recipe
- Inherits:
-
Data
- Object
- Data
- TRMNL::API::Models::Recipe
- Defined in:
- lib/trmnl/api/models/recipe.rb
Overview
Models the payload of the API response.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Class Method Summary collapse
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data
9 10 11 |
# File 'lib/trmnl/api/models/recipe.rb', line 9 def data @data end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta
9 10 11 |
# File 'lib/trmnl/api/models/recipe.rb', line 9 def @meta end |
Class Method Details
.empty(meta: Recipes::Meta.new) ⇒ Object
10 |
# File 'lib/trmnl/api/models/recipe.rb', line 10 def self.empty(meta: Recipes::Meta.new) = new(data: Core::EMPTY_ARRAY, meta:) |
.for(**attributes) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/trmnl/api/models/recipe.rb', line 12 def self.for(**attributes) = attributes.slice :from, :to, :current_page, :per_page, :total, :prev_page_url, :next_page_url data = attributes[:data].map { Recipes::Data.for(**it) } new meta: Recipes::Meta[**], data: end |