Class: BudaApi::Models::PaginationMeta
- Defined in:
- lib/buda_api/models.rb
Overview
Pagination metadata
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#total_count ⇒ Object
readonly
Returns the value of attribute total_count.
-
#total_pages ⇒ Object
readonly
Returns the value of attribute total_pages.
Instance Method Summary collapse
- #has_next_page? ⇒ Boolean
- #has_previous_page? ⇒ Boolean
-
#initialize(data) ⇒ PaginationMeta
constructor
A new instance of PaginationMeta.
Methods inherited from BaseModel
Constructor Details
#initialize(data) ⇒ PaginationMeta
Returns a new instance of PaginationMeta.
303 304 305 306 307 308 |
# File 'lib/buda_api/models.rb', line 303 def initialize(data) super(data) @current_page = data["current_page"]&.to_i @total_count = data["total_count"]&.to_i @total_pages = data["total_pages"]&.to_i end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
310 311 312 |
# File 'lib/buda_api/models.rb', line 310 def current_page @current_page end |
#total_count ⇒ Object (readonly)
Returns the value of attribute total_count.
310 311 312 |
# File 'lib/buda_api/models.rb', line 310 def total_count @total_count end |
#total_pages ⇒ Object (readonly)
Returns the value of attribute total_pages.
310 311 312 |
# File 'lib/buda_api/models.rb', line 310 def total_pages @total_pages end |
Instance Method Details
#has_next_page? ⇒ Boolean
312 313 314 |
# File 'lib/buda_api/models.rb', line 312 def has_next_page? @current_page && @total_pages && @current_page < @total_pages end |
#has_previous_page? ⇒ Boolean
316 317 318 |
# File 'lib/buda_api/models.rb', line 316 def has_previous_page? @current_page && @current_page > 1 end |