Class: Mindee::V2::Parsing::Search::PaginationMetadata
- Inherits:
-
Object
- Object
- Mindee::V2::Parsing::Search::PaginationMetadata
- Defined in:
- lib/mindee/v2/parsing/search/pagination_metadata.rb
Overview
Pagination Metadata data associated with model search.
Instance Attribute Summary collapse
-
#page ⇒ Integer
readonly
1-indexed page number.
-
#per_page ⇒ Integer
readonly
Number of items per page.
-
#total_items ⇒ Integer
readonly
Total items.
-
#total_pages ⇒ Integer
readonly
Total number of pages.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ PaginationMetadata
constructor
A new instance of PaginationMetadata.
-
#to_s ⇒ String
String representation of the pagination metadata.
Constructor Details
#initialize(raw_response) ⇒ PaginationMetadata
Returns a new instance of PaginationMetadata.
22 23 24 25 26 27 |
# File 'lib/mindee/v2/parsing/search/pagination_metadata.rb', line 22 def initialize(raw_response) @per_page = raw_response['per_page'] @page = raw_response['page'] @total_items = raw_response['total_items'] @total_pages = raw_response['total_pages'] end |
Instance Attribute Details
#page ⇒ Integer (readonly)
Returns 1-indexed page number.
13 14 15 |
# File 'lib/mindee/v2/parsing/search/pagination_metadata.rb', line 13 def page @page end |
#per_page ⇒ Integer (readonly)
Returns Number of items per page.
10 11 12 |
# File 'lib/mindee/v2/parsing/search/pagination_metadata.rb', line 10 def per_page @per_page end |
#total_items ⇒ Integer (readonly)
Returns Total items.
16 17 18 |
# File 'lib/mindee/v2/parsing/search/pagination_metadata.rb', line 16 def total_items @total_items end |
#total_pages ⇒ Integer (readonly)
Returns Total number of pages.
19 20 21 |
# File 'lib/mindee/v2/parsing/search/pagination_metadata.rb', line 19 def total_pages @total_pages end |
Instance Method Details
#to_s ⇒ String
String representation of the pagination metadata.
31 32 33 34 35 36 37 38 39 |
# File 'lib/mindee/v2/parsing/search/pagination_metadata.rb', line 31 def to_s [ ":Per Page: #{@per_page}", ":Page: #{@page}", ":Total Items: #{@total_items}", ":Total Pages: #{@total_pages}", '', ].join("\n") end |