Class: Dnsimple::PaginatedResponse
- Inherits:
-
CollectionResponse
- Object
- Response
- CollectionResponse
- Dnsimple::PaginatedResponse
- Defined in:
- lib/dnsimple/response.rb
Overview
The PaginatedResponse is a specific type of Response that also exposes pagination metadata.
Instance Attribute Summary collapse
-
#page ⇒ Integer
readonly
The current page.
-
#per_page ⇒ Integer
readonly
The number of records per page.
-
#total_entries ⇒ Integer
readonly
The total number of records.
-
#total_pages ⇒ Integer
readonly
The total number of pages.
Attributes inherited from Response
#data, #http_response, #rate_limit, #rate_limit_remaining, #rate_limit_reset
Instance Method Summary collapse
-
#initialize(http_response, collection) ⇒ PaginatedResponse
constructor
Initializes a new paginated response from the response metadata, and with given collection.
Constructor Details
#initialize(http_response, collection) ⇒ PaginatedResponse
Initializes a new paginated response from the response metadata, and with given collection.
70 71 72 73 74 75 76 77 78 |
# File 'lib/dnsimple/response.rb', line 70 def initialize(http_response, collection) super pagination = http_response["pagination"] @page = pagination["current_page"] @per_page = pagination["per_page"] @total_entries = pagination["total_entries"] @total_pages = pagination["total_pages"] end |
Instance Attribute Details
#page ⇒ Integer (readonly)
Returns The current page.
53 54 55 |
# File 'lib/dnsimple/response.rb', line 53 def page @page end |
#per_page ⇒ Integer (readonly)
Returns The number of records per page.
56 57 58 |
# File 'lib/dnsimple/response.rb', line 56 def per_page @per_page end |
#total_entries ⇒ Integer (readonly)
Returns The total number of records.
59 60 61 |
# File 'lib/dnsimple/response.rb', line 59 def total_entries @total_entries end |
#total_pages ⇒ Integer (readonly)
Returns The total number of pages.
62 63 64 |
# File 'lib/dnsimple/response.rb', line 62 def total_pages @total_pages end |