Class: TRMNL::API::Models::Recipes::Meta
- Inherits:
-
Data
- Object
- Data
- TRMNL::API::Models::Recipes::Meta
- Defined in:
- lib/trmnl/api/models/recipes/meta.rb
Overview
Models the metadata of the API response.
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#next_page_url ⇒ Object
readonly
Returns the value of attribute next_page_url.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
-
#prev_page_url ⇒ Object
readonly
Returns the value of attribute prev_page_url.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(from: 0, to: 0, current_page: 0, per_page: 0, total: 0, prev_page_url: nil, next_page_url: nil) ⇒ Meta
constructor
A new instance of Meta.
- #more? ⇒ Boolean
- #next_page ⇒ Object
Constructor Details
#initialize(from: 0, to: 0, current_page: 0, per_page: 0, total: 0, prev_page_url: nil, next_page_url: nil) ⇒ Meta
Returns a new instance of Meta.
17 18 19 20 21 22 23 24 25 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 17 def initialize from: 0, to: 0, current_page: 0, per_page: 0, total: 0, prev_page_url: nil, next_page_url: nil super end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def current_page @current_page end |
#from ⇒ Object (readonly)
Returns the value of attribute from
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def from @from end |
#next_page_url ⇒ Object (readonly)
Returns the value of attribute next_page_url
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def next_page_url @next_page_url end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def per_page @per_page end |
#prev_page_url ⇒ Object (readonly)
Returns the value of attribute prev_page_url
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def prev_page_url @prev_page_url end |
#to ⇒ Object (readonly)
Returns the value of attribute to
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def to @to end |
#total ⇒ Object (readonly)
Returns the value of attribute total
8 9 10 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 8 def total @total end |
Instance Method Details
#more? ⇒ Boolean
27 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 27 def more? = to.positive? && to < total |
#next_page ⇒ Object
29 |
# File 'lib/trmnl/api/models/recipes/meta.rb', line 29 def next_page = current_page + 1 |